/* ============================================================
   Torix Ads Manager — interactive preview
   Light "paper console" theme · Torix backoffice design system
   Fonts: Plus Jakarta Sans (display) · Inter (body) · JetBrains Mono (data)
   ============================================================ */

:root {
  /* surfaces */
  --bg: #fbfaf8;            /* oklch(.985 .003 85)  warm paper */
  --card: #fefdfc;          /* oklch(.995 .002 85)  */
  --panel2: #f6f4ef;
  --sidebar: #f0f4f9;       /* oklch(.965 .008 250) light slate */
  --sidebar-hair: #dfe6ef;

  /* ink */
  --ink: #171c26;
  --ink2: #3e4856;
  --mut: #6b7482;
  --faint: #9aa2ae;

  /* hairlines */
  --hair: #e8e5dd;
  --hair2: #f0ede6;

  /* brand gold — fill vs. text-safe step */
  --gold: #ffb300;          /* oklch(.82 .19 80) fills, accents */
  --gold-dark: #db8c00;     /* borders / hover */
  --gold-ink: #8a6410;      /* text-safe ≥4.5:1 */
  --gold-wash: #fdf3dd;
  --gold-wash2: #fbf7ec;

  /* brand blue */
  --blue: #0079f5;          /* oklch(.58 .22 250) marks / primary */
  --blue-ink: #005ac8;      /* link text */
  --blue-wash: #eef4fd;

  /* status (light-tuned) */
  --good-ink: #0e7a3e;
  --good: #17a05a;
  --good-wash: #e7f5ec;
  --bad-ink: #c02026;
  --bad: #d8433f;
  --bad-wash: #fcebea;
  --warn-ink: #96610a;
  --warn: #c07c00;
  --warn-wash: #fdf2da;
  --violet-ink: #6242c8;
  --violet: #7454d6;
  --violet-wash: #f0ecfb;

  /* validated series palette (light surface) */
  --s-blue: #0079f5;
  --s-green: #008954;
  --s-amber: #c07c00;
  --s-purple: #7454d6;
  --s-red: #cc272e;
  --s-blue-soft: #a8c9ef;

  --ring: #0079f5;

  --shadow-soft: 0 1px 2px rgba(23,28,38,.05), 0 4px 12px rgba(23,28,38,.05);
  --shadow-raise: 0 1px 3px rgba(23,28,38,.07), 0 6px 18px rgba(23,28,38,.07);
  --shadow-pop: 0 4px 10px rgba(23,28,38,.07), 0 16px 40px rgba(23,28,38,.16);

  --font-display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { font-family: var(--font-display); text-wrap: balance; }
p { text-wrap: pretty; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

#app { display: flex; min-height: 100vh; }

/* ============ sidebar ============ */
aside {
  width: 216px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-hair);
  padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo {
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  letter-spacing: .04em; margin: 0 8px 22px; color: var(--ink);
}
.logo span {
  background: linear-gradient(120deg, var(--gold-dark), #b06f00);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.navl {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); margin: 18px 8px 6px;
}
.navl.gold { color: var(--gold-ink); }
.navi {
  display: flex; align-items: center; min-height: 34px;
  padding: 6px 10px; border-radius: 8px; margin-bottom: 2px;
  color: var(--ink2); cursor: pointer; font-weight: 500;
  transition: background-color .15s ease, color .15s ease;
}
.navi:hover { background: rgba(0,90,200,.06); color: var(--ink); }
.navi:active { transform: scale(.98); }
.navi.on {
  background: linear-gradient(120deg, rgba(255,179,0,.18), rgba(255,179,0,.10));
  color: var(--gold-ink); font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(219,140,0,.25);
}
.navi.dis { opacity: .38; cursor: default; }
.navi.dis:hover { background: none; color: var(--ink2); }
.wavebox {
  margin-top: 26px; border: 1px dashed #d3cfc4; background: var(--card);
  border-radius: 10px; padding: 11px 12px; font-size: 11px; line-height: 1.55; color: var(--ink2);
}
.wavebox b { color: var(--ink); }
.wtag {
  display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: .04em;
  border-radius: 5px; padding: 1px 5px; vertical-align: 1px;
}
.w2 { background: var(--blue-wash); color: var(--blue-ink); box-shadow: inset 0 0 0 1px rgba(0,90,200,.22); }
.w3 { background: var(--violet-wash); color: var(--violet-ink); box-shadow: inset 0 0 0 1px rgba(98,66,200,.22); }

/* ============ main ============ */
main { flex: 1; min-width: 0; padding: 20px 26px 72px; transition: padding-right .34s cubic-bezier(.3,1.25,.45,1); }
.mwrap { max-width: 1160px; margin: 0 auto; }
@media (min-width: 881px) {
  body.insp-open main { padding-right: 356px; }
}

.pghead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.crumb { font-size: 12px; color: var(--mut); }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb .lk { color: var(--blue-ink); cursor: pointer; }
.crumb .lk:hover { text-decoration: underline; }
.fresh { margin-left: auto; font-size: 10.5px; color: var(--faint); font-family: var(--font-mono); }

.hint {
  display: flex; gap: 8px; align-items: baseline;
  background: linear-gradient(120deg, var(--gold-wash), var(--gold-wash2));
  border: 1px solid rgba(219,140,0,.30); border-radius: 10px;
  padding: 9px 14px; font-size: 12.5px; color: var(--gold-ink); margin-bottom: 18px;
}
.hint b { font-weight: 700; }
.hint u { text-decoration-style: dashed; text-underline-offset: 2px; }

.seclabel {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--mut); margin: 22px 2px 8px; display: flex; align-items: baseline; gap: 8px;
}
.seclabel .sub { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }

/* ============ cards & tiles ============ */
.card {
  background: var(--card); border: 1px solid var(--hair); border-radius: 12px;
  box-shadow: var(--shadow-soft);
}
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 6px; }
.tile {
  background: var(--card); border: 1px solid var(--hair); border-radius: 12px;
  padding: 12px 14px 10px; cursor: pointer; box-shadow: var(--shadow-soft); position: relative;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.tile:hover { border-color: rgba(219,140,0,.45); box-shadow: var(--shadow-raise); transform: translateY(-1px); }
.tile:active { transform: scale(.98); }
.tile.static { cursor: default; }
.tile.static:hover { border-color: var(--hair); box-shadow: var(--shadow-soft); transform: none; }
.tile .l { font-size: 9.5px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-family: var(--font-display); font-size: 23px; font-weight: 700; letter-spacing: -.015em; margin: 3px 0 1px; }
.tile .s { font-size: 10.5px; color: var(--ink2); font-family: var(--font-mono); }
.tile .s.up { color: var(--good-ink); }
.tile .s.down { color: var(--bad-ink); }
.tile .spark { display: block; margin-top: 7px; width: 100%; height: 22px; }
.up { color: var(--good-ink); } .down { color: var(--bad-ink); }
.rgood { color: var(--good-ink); font-weight: 600; } .rbad { color: var(--bad-ink); font-weight: 600; }

/* ============ tables ============ */
.tblwrap { overflow-x: auto; background: var(--card); border: 1px solid var(--hair); border-radius: 12px; box-shadow: var(--shadow-soft); }
/* scroll affordance: inset fades appear only while more columns hide off-edge */
.tblwrap.fade-r { box-shadow: var(--shadow-soft), inset -18px 0 14px -14px rgba(23,28,38,.28); }
.tblwrap.fade-l { box-shadow: var(--shadow-soft), inset 18px 0 14px -14px rgba(23,28,38,.28); }
.tblwrap.fade-l.fade-r { box-shadow: var(--shadow-soft), inset 18px 0 14px -14px rgba(23,28,38,.28), inset -18px 0 14px -14px rgba(23,28,38,.28); }
.viewpane[hidden] { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--mut); padding: 9px 11px; border-bottom: 1px solid var(--hair);
  white-space: nowrap; background: var(--panel2);
}
th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }
td { padding: 8px 11px; border-bottom: 1px solid var(--hair2); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-family: var(--font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
th.num { font-family: var(--font-body); font-size: 9.5px; }
tr.rowc { cursor: pointer; transition: background-color .12s ease; }
tr.rowc:hover { background: var(--blue-wash); }
tr.rowc.sel { background: var(--gold-wash2); box-shadow: inset 3px 0 0 var(--gold); }
.nm { color: var(--blue-ink); max-width: 355px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
@media (max-width: 880px) { .nm { max-width: 240px; } }
.nm:hover { text-decoration: underline; text-underline-offset: 2px; }
/* flag-safe name layout: the name ellipsizes, flags & icons never clip */
.nm .nmflex { display: flex; align-items: center; gap: 6px; min-width: 0; }
.nm .nmflex .nmtxt { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm .nmflex .prov { flex: none; margin-right: 0; }
.nm .nmflex .flag { flex: none; margin-left: 0; }
.nm .nmflex .lockicn { flex: none; }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 0; }
.prov {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 4px; font-size: 9.5px; font-weight: 700;
  margin-right: 6px; vertical-align: -2px; background: #1877f2; color: #fff; font-family: var(--font-display);
}
.lockicn { display: inline-block; opacity: .45; font-size: 9px; cursor: help; }
.sharebar { display: inline-block; height: 5px; border-radius: 3px; background: var(--s-blue); vertical-align: 2px; margin-right: 7px; }
.ghost td { opacity: .45; }
.totals td { border-top: 2px solid var(--hair); font-weight: 700; background: var(--panel2); }
.totals td:first-child { border-bottom-left-radius: 12px; }
.totals td:last-child { border-bottom-right-radius: 12px; }
.caret {
  cursor: pointer; color: var(--ink2); display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; font-size: 13px; position: relative;
  transition: background-color .15s ease, color .15s ease;
}
.caret::after { content: ''; position: absolute; inset: -9px; }
.caret:hover { background: var(--gold-wash); color: var(--gold-ink); }
#tree td:first-child { width: 26px; padding-right: 0; }
.ind1 td:nth-child(2) { padding-left: 30px; }
.ind2 td:nth-child(2) { padding-left: 52px; }
.ind1 td:nth-child(2) { background: linear-gradient(to right, transparent 13px, var(--hair2) 13px, var(--hair2) 14px, transparent 14px); }
.ind2 td:nth-child(2) { background: linear-gradient(to right, transparent 13px, var(--hair2) 13px, var(--hair2) 14px, transparent 14px, transparent 35px, var(--hair2) 35px, var(--hair2) 36px, transparent 36px); }
@keyframes rowIn { from { opacity: 0; } to { opacity: 1; } }
tr.reveal td { animation: rowIn .28s ease both; }

.flag {
  display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: .02em; border-radius: 6px;
  padding: 1.5px 6px; margin-left: 5px; vertical-align: 1px;
}
.fg-y { background: var(--warn-wash); color: var(--warn-ink); }
.fg-r { background: var(--bad-wash); color: var(--bad-ink); }
.fg-g { background: var(--good-wash); color: var(--good-ink); }
.kebab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 22px; border: 1px solid var(--hair); border-radius: 6px;
  color: var(--mut); cursor: pointer; background: var(--card); position: relative;
  transition: border-color .15s ease, color .15s ease;
}
.kebab::after { content: ''; position: absolute; inset: -8px; }
.kebab:hover { border-color: var(--faint); color: var(--ink); }

/* switches */
.sw {
  display: inline-block; width: 30px; height: 17px; border-radius: 10px; position: relative;
  cursor: pointer; vertical-align: -3.5px; margin-right: 7px;
  transition: background-color .2s ease, transform .1s ease;
}
.sw::before { content: ''; position: absolute; inset: -12px; } /* hit area */
.sw::after {
  content: ''; position: absolute; width: 13px; height: 13px; border-radius: 50%;
  top: 2px; left: 2px; background: #fff;
  box-shadow: 0 1px 2px rgba(23,28,38,.3);
  transition: transform .2s cubic-bezier(.34,1.4,.64,1);
}
.sw:active { transform: scale(.96); }
.sw.on { background: var(--good); }
.sw.on::after { transform: translateX(13px); }
.sw.off { background: #c9c5bb; }
.sw.pend { background: var(--warn); animation: swpulse 1s ease-in-out infinite; }
.sw.pend::after { transform: translateX(6.5px); }
@keyframes swpulse { 50% { opacity: .55; } }
.stx { font-size: 8.5px; font-weight: 700; letter-spacing: .05em; font-family: var(--font-body); }
.on-t { color: var(--good-ink); } .off-t { color: var(--faint); }

/* editable cells — gold-hinted per the welcome promise */
.edit {
  border-bottom: 1.5px dashed rgba(219,140,0,.65); cursor: pointer; padding-bottom: 1px;
  transition: color .15s ease, border-color .15s ease;
}
.edit:hover { color: var(--gold-ink); border-bottom-color: var(--gold-dark); }

/* chips */
.chips { display: flex; gap: 6px; margin: 2px 0 12px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--hair); background: var(--card); border-radius: 15px;
  padding: 4px 13px; font-size: 11.5px; font-weight: 500; color: var(--ink2); cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .1s ease;
}
.chip:hover { border-color: var(--faint); color: var(--ink); }
.chip:active { transform: scale(.96); }
.chip.on { border-color: rgba(219,140,0,.55); color: var(--gold-ink); background: var(--gold-wash); font-weight: 600; }
.chip.danger { border-color: rgba(216,67,63,.4); color: var(--bad-ink); }
.chip.danger.on { background: var(--bad-wash); border-color: var(--bad); color: var(--bad-ink); }
.viewsw {
  display: inline-flex; border: 1px solid var(--hair); border-radius: 9px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-soft);
}
.viewsw .vopt {
  padding: 5px 13px; font-size: 11.5px; color: var(--mut); cursor: pointer;
  border-right: 1px solid var(--hair2);
  transition: background-color .15s ease, color .15s ease;
}
.viewsw .vopt:last-child { border-right: none; }
.viewsw .vopt:hover { color: var(--ink); }
.viewsw .vopt.on { background: var(--gold-wash); color: var(--gold-ink); font-weight: 600; }

/* attention cards */
.att { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.attc { background: var(--card); border: 1px solid var(--hair); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-soft); }
.attc h4 { margin: 0 0 7px; font-size: 12px; font-weight: 700; }
.attc h4 .sub { font-weight: 400; color: var(--faint); font-size: 10.5px; font-family: var(--font-body); }
.ai {
  display: flex; justify-content: space-between; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--hair2); font-size: 11.5px; cursor: pointer; align-items: baseline;
}
.ai:last-child { border-bottom: none; padding-bottom: 0; }
.ai span:first-child { color: var(--blue-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ai:hover span:first-child { text-decoration: underline; text-underline-offset: 2px; }
.ai .mono { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* activity feed */
.feed { background: var(--card); border: 1px solid var(--hair); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-soft); font-size: 11.5px; color: var(--ink2); }
.feed b { color: var(--ink); }
.feed .fr { display: flex; gap: 10px; padding: 3px 0; }
.feed .ft { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); flex-shrink: 0; }
.freshfoot { font-size: 10px; color: var(--faint); margin-top: 10px; font-family: var(--font-mono); }

/* ============ charts ============ */
.chartcard { background: var(--card); border: 1px solid var(--hair); border-radius: 12px; padding: 14px 16px 10px; box-shadow: var(--shadow-soft); position: relative; }
.chartcard .pl { margin-top: 0; }
.pl { font-size: 9.5px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .08em; margin: 14px 0 6px; }
.leg { display: flex; gap: 16px; font-size: 11px; color: var(--ink2); margin-top: 8px; flex-wrap: wrap; align-items: center; }
.leg .k { display: inline-flex; align-items: center; gap: 6px; }
.leg .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.leg .lkey { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.leg .mutnote { color: var(--faint); font-size: 10.5px; }
.ctip {
  position: absolute; pointer-events: none; z-index: 30; display: none;
  background: var(--card); border: 1px solid var(--hair); border-radius: 10px;
  box-shadow: var(--shadow-pop); padding: 8px 11px; font-size: 11px; min-width: 130px;
}
.ctip .d { font-weight: 600; font-size: 10.5px; color: var(--mut); margin-bottom: 4px; font-family: var(--font-mono); }
.ctip .r { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; }
.ctip .r i { width: 12px; height: 2.5px; border-radius: 2px; flex-shrink: 0; }
.ctip .r .v { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 12px; }
.ctip .r .n { color: var(--mut); }
svg.chart { display: block; width: 100%; }
svg.chart text { font-family: var(--font-mono); font-size: 10px; fill: var(--faint); }
svg.lines { width: 100%; display: block; }

.chartwrap { position: relative; padding-top: 12px; }
.pin {
  position: absolute; top: 0; width: 20px; height: 20px; border-radius: 50%;
  font-size: 9px; text-align: center; line-height: 18px; border: 1.5px solid;
  background: var(--card); cursor: pointer; z-index: 5; margin-left: -10px;
  box-shadow: var(--shadow-soft);
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .15s ease;
}
.pin::after { content: ''; position: absolute; inset: -10px; }
.pinstem { position: absolute; width: 1px; margin-left: -.5px; background: #d3cfc4; z-index: 4; pointer-events: none; }
.pin:hover { transform: scale(1.25); box-shadow: var(--shadow-raise); }
.pin.b { border-color: var(--blue); color: var(--blue-ink); }
.pin.r { border-color: var(--violet); color: var(--violet-ink); }

.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.trio > div { border: 1px solid var(--hair); border-radius: 10px; padding: 9px 12px 7px; background: var(--card); font-size: 11px; box-shadow: var(--shadow-soft); }
.trio .tl { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.trio .tl b { font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.trio .tl span { font-size: 10px; font-weight: 600; }
.trio svg { width: 100%; height: 22px; display: block; }

.diag {
  border: 1px solid rgba(219,140,0,.35); background: linear-gradient(120deg, var(--gold-wash), #fefaf0);
  border-radius: 10px; padding: 11px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink2);
}
.diag b.t { color: var(--gold-ink); }
.diag b { color: var(--ink); }

/* funnel */
.fun { padding: 4px 0; }
.fun .fr { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.fun .fl { width: 150px; font-size: 11.5px; color: var(--ink2); text-align: right; flex-shrink: 0; }
.fun .fbwrap { flex: 1; min-width: 60px; display: flex; align-items: center; gap: 8px; }
.fun .fb {
  height: 18px; background: linear-gradient(90deg, var(--s-blue) 0%, #4b9cf0 100%);
  border-radius: 0 5px 5px 0; min-width: 3px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.fun .fv { font-size: 10.5px; color: var(--ink2); font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fun .fv .ok { color: var(--good-ink); font-weight: 600; }
.fun .fv .warn { color: var(--bad-ink); font-weight: 600; font-family: var(--font-body); }

/* creatives */
.cards { display: flex; gap: 10px; flex-wrap: wrap; }
.ccard {
  width: 182px; background: var(--card); border: 1px solid var(--hair); border-radius: 12px;
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-soft);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ccard:hover { border-color: rgba(219,140,0,.5); box-shadow: var(--shadow-raise); transform: translateY(-2px); }
.ccard:active { transform: scale(.98); }
.cth {
  height: 74px; background: linear-gradient(120deg, #2b3350, #55416e 60%, #7a4a63);
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
}
.cth .play {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; font-size: 10px; color: #1d2334;
  padding-left: 2px; /* optical center of ▶ */
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.life { position: absolute; left: 6px; top: 6px; font-size: 8px; font-weight: 800; letter-spacing: .05em; border-radius: 5px; padding: 1.5px 6px; }
.lf-s { background: #d9f2e2; color: var(--good-ink); }
.lf-f { background: #fdeecb; color: var(--warn-ink); }
.lf-d { background: #fbdcda; color: var(--bad-ink); }
.cb { padding: 8px 11px 10px; font-size: 10.5px; color: var(--ink2); line-height: 1.5; }
.cb b { display: block; color: var(--ink); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-display); font-weight: 600; }

/* timeline */
.tl { border-left: 2px solid var(--hair); margin: 6px 0 0 9px; padding-left: 18px; }
.tle { position: relative; padding: 8px 0; color: var(--ink2); font-size: 12.5px; }
.tle::before {
  content: ''; position: absolute; left: -23.5px; top: 14px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--s-blue); box-shadow: 0 0 0 2.5px var(--card);
}
.tle.m::before { background: var(--gold); }
.tle.r::before { background: var(--s-purple); }
.tle b { color: var(--ink); }
.tle .when { color: var(--faint); font-size: 11px; font-family: var(--font-mono); }
.tle .why { color: var(--mut); font-size: 11.5px; }
.chg { background: var(--panel2); border: 1px solid var(--hair2); border-radius: 5px; padding: 0 6px; font-size: 11px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.impact {
  display: inline-flex; gap: 10px; border: 1px solid var(--hair); background: var(--panel2);
  border-radius: 8px; padding: 4px 10px; margin-top: 5px; font-size: 10.5px; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}

/* rules */
.rulebox { background: var(--card); border: 1px solid var(--hair); border-radius: 12px; padding: 12px 15px; margin-bottom: 10px; font-size: 12.5px; box-shadow: var(--shadow-soft); }
.rulebox > b { font-family: var(--font-display); font-size: 13px; }
.rulebox .desc { color: var(--ink2); margin-top: 4px; }
.rulebox .prox { font-size: 10.5px; color: var(--mut); margin-top: 6px; font-family: var(--font-mono); }
.badge {
  display: inline-block; border: 1px solid var(--hair); background: var(--panel2); border-radius: 10px;
  padding: 1.5px 9px; font-size: 10px; font-weight: 500; color: var(--ink2); vertical-align: 1px;
}
.meter { height: 6px; border-radius: 3px; background: #f3e9d4; position: relative; margin-top: 6px; overflow: hidden; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, var(--gold-dark), var(--warn)); }

/* attribution */
.split { display: flex; gap: 16px; flex-wrap: wrap; }
.split > div { flex: 1; min-width: 290px; }
.mature { position: relative; background: var(--card); border: 1px solid var(--hair); border-radius: 10px; padding: 10px 10px 6px; box-shadow: var(--shadow-soft); }
.note { font-size: 10.5px; color: var(--mut); margin-top: 8px; line-height: 1.5; }

/* ============ campaign header/tabs ============ */
.cphdr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.cphdr h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.tabbar {
  display: flex; gap: 2px; border-bottom: 1px solid var(--hair); margin: 16px 0 16px; flex-wrap: wrap;
  position: relative;
}
.tabb {
  padding: 7px 14px 9px; font-size: 12px; font-weight: 500; color: var(--mut); cursor: pointer;
  border-radius: 8px 8px 0 0; position: relative; background: none; border: none;
  transition: color .15s ease, background-color .15s ease;
}
.tabb:hover { color: var(--ink); background: var(--gold-wash2); }
.tabb.on { color: var(--gold-ink); font-weight: 600; }
.tabb.on::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px;
  background: var(--gold-dark); border-radius: 2px 2px 0 0;
}
.pane { display: none; }
.pane.on { display: block; animation: paneIn .3s cubic-bezier(.4,0,.2,1) both; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============ inspector (fixed panel) ============ */
#insp {
  position: fixed; top: 14px; right: 14px; max-height: calc(100vh - 28px); width: 314px; z-index: 40;
  background: var(--card); border: 1px solid var(--hair); border-radius: 14px;
  box-shadow: var(--shadow-pop), inset 0 2.5px 0 var(--gold);
  padding: 14px 16px 12px; font-size: 11.5px; overflow-y: auto;
  transform: translateX(calc(100% + 20px)); opacity: 0; visibility: hidden;
  transition: transform .34s cubic-bezier(.3,1.25,.45,1), opacity .22s ease, visibility 0s linear .34s;
}
#insp.open { transform: translateX(0); opacity: 1; visibility: visible; transition: transform .34s cubic-bezier(.3,1.25,.45,1), opacity .22s ease; }
#insp .lvl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--mut); display: flex; align-items: center; }
#insp .lvl .openpg { margin-left: auto; margin-right: 26px; color: var(--blue-ink); cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 10.5px; font-weight: 600; }
#insp .lvl .openpg:hover { text-decoration: underline; }
#insp .xbtn {
  position: absolute; top: 9px; right: 10px; width: 26px; height: 26px; border-radius: 8px;
  border: none; background: none; color: var(--mut); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .15s ease, color .15s ease;
}
#insp .xbtn:hover { background: var(--panel2); color: var(--ink); }
#insp h4 { margin: 5px 24px 3px 0; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#insp .badges { margin: 5px 0 9px; display: flex; gap: 4px; flex-wrap: wrap; }
#insp .kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 9px; }
#insp .kpi { border: 1px solid var(--hair); border-radius: 8px; padding: 5px 8px; background: var(--bg); }
#insp .kpi .l { font-size: 8px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; }
#insp .kpi .v { font-family: var(--font-mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
#insp .blk { border-top: 1px solid var(--hair2); padding: 8px 0; }
#insp .blk h5 { margin: 0 0 4px; font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
#insp .r { display: flex; justify-content: space-between; padding: 2px 0; gap: 10px; }
#insp .r span:first-child { color: var(--mut); white-space: nowrap; }
#insp .r span:last-child { text-align: right; }
#insp .mini {
  border: 1px solid var(--hair2); background: var(--bg); border-radius: 7px; padding: 4px 8px;
  margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px;
}
#insp .mini span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue-ink); }
#insp .mini .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
#insp .foot { display: flex; gap: 5px; flex-wrap: wrap; border-top: 1px solid var(--hair); padding-top: 10px; margin-top: 4px; }
#insp .thumb {
  height: 78px; background: linear-gradient(120deg, #2b3350, #55416e 60%, #7a4a63); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff;
  margin: 8px 0; cursor: pointer; gap: 7px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1);
  transition: filter .15s ease;
}
#insp .thumb:hover { filter: brightness(1.12); }
#insp .vbar { display: flex; gap: 2px; align-items: flex-end; height: 26px; margin: 5px 0; }
#insp .vbar i { flex: 1; background: var(--s-blue-soft); border-radius: 3px 3px 0 0; }

.abtn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--hair); border-radius: 8px; padding: 4px 11px; font-size: 11px; font-weight: 500;
  cursor: pointer; color: var(--ink2); background: var(--card); box-shadow: var(--shadow-soft);
  transition: border-color .15s ease, color .15s ease, transform .1s ease;
}
.abtn:hover { border-color: rgba(219,140,0,.55); color: var(--gold-ink); }
.abtn:active { transform: scale(.96); }

/* ============ modal / toast / popover / welcome ============ */
#ovl {
  position: fixed; inset: 0; background: rgba(23,28,38,.35); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s;
}
#ovl.open { opacity: 1; visibility: visible; transition: opacity .2s ease; }
#modal {
  width: 430px; max-width: 92vw; background: var(--card); border: 1px solid var(--hair);
  border-radius: 16px; padding: 20px 22px 18px; box-shadow: var(--shadow-pop);
  transform: scale(.94) translateY(8px);
  transition: transform .22s cubic-bezier(.3,1.3,.5,1);
}
#ovl.open #modal { transform: scale(1) translateY(0); }
#modal h4 { margin: 0 0 12px; font-size: 15px; }
#modal .r { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; gap: 14px; border-bottom: 1px dashed var(--hair2); }
#modal .r:last-of-type { border-bottom: none; }
#modal .r span:first-child { color: var(--mut); white-space: nowrap; }
#modal .r span:last-child { text-align: right; }
#modal .warnrow {
  background: var(--warn-wash); border: 1px solid rgba(192,124,0,.3); border-radius: 8px;
  padding: 7px 11px; margin: 7px 0; font-size: 12px; color: var(--warn-ink); display: flex; gap: 7px;
}
#modal .btns { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.btn {
  border: 1px solid var(--hair); border-radius: 9px; padding: 7px 16px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; color: var(--ink2); background: var(--card); box-shadow: var(--shadow-soft);
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--faint); color: var(--ink); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--gold); color: #3a2a04; border-color: var(--gold-dark); }
.btn.primary:hover { background: #f0a800; box-shadow: 0 2px 10px rgba(219,140,0,.35); color: #3a2a04; }
.btn.danger { border-color: rgba(216,67,63,.5); color: var(--bad-ink); background: var(--card); }
.btn.danger:hover { background: var(--bad-wash); border-color: var(--bad); color: var(--bad-ink); }

#toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 70;
  background: var(--card); border: 1px solid var(--hair); border-left: 4px solid var(--good);
  color: var(--ink); border-radius: 11px; padding: 10px 18px; font-size: 12.5px; max-width: min(520px, 90vw);
  box-shadow: var(--shadow-pop);
  transform: translate(-50%, 16px); opacity: 0; visibility: hidden;
  transition: transform .3s cubic-bezier(.3,1.3,.5,1), opacity .2s ease, visibility 0s linear .3s;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .3s cubic-bezier(.3,1.3,.5,1), opacity .2s ease; }
#toast.info { border-left-color: var(--gold-dark); }

.editpop {
  position: absolute; z-index: 50; background: var(--card); border: 1px solid rgba(219,140,0,.45);
  border-radius: 12px; padding: 12px 14px; font-size: 11.5px; box-shadow: var(--shadow-pop);
  animation: popIn .18s cubic-bezier(.3,1.3,.5,1) both; width: 272px;
}
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(-4px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.editpop b { font-family: var(--font-display); font-size: 12px; }
.editpop input {
  background: var(--bg); border: 1px solid var(--hair); border-radius: 7px; width: 68px;
  padding: 5px 8px; color: var(--ink); font-family: var(--font-mono); font-size: 12.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.editpop input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,121,245,.15); }
.editpop .unote { font-size: 10px; color: var(--mut); margin-top: 6px; font-family: var(--font-mono); }
.editpop .prow { margin-top: 9px; display: flex; align-items: center; gap: 8px; }
.editpop .esc { font-size: 10px; color: var(--faint); }
.chipb {
  border: 1px solid var(--hair); background: var(--card); border-radius: 11px; padding: 2px 9px;
  font-size: 10px; font-family: var(--font-mono); cursor: pointer; margin-left: 4px; color: var(--ink2);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.chipb:hover { border-color: var(--gold-dark); color: var(--gold-ink); background: var(--gold-wash); }

/* welcome overlay */
#welcome {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(240,244,249,.72); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
#welcome.open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.wcard {
  width: 420px; max-width: 90vw; background: var(--card); border: 1px solid var(--hair);
  border-radius: 18px; padding: 26px 28px 22px; box-shadow: var(--shadow-pop); text-align: center;
  transform: scale(.94) translateY(10px); transition: transform .3s cubic-bezier(.3,1.3,.5,1);
}
#welcome.open .wcard { transform: scale(1) translateY(0); }
.wmark {
  width: 44px; height: 44px; border-radius: 13px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #3a2a04;
  box-shadow: 0 6px 18px rgba(219,140,0,.35);
}
.wcard h3 { margin: 0 0 8px; font-size: 17px; }
.wcard p { margin: 0 0 16px; color: var(--ink2); font-size: 13px; line-height: 1.6; }
.wlegend {
  display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap;
  font-size: 11px; color: var(--mut); border-top: 1px solid var(--hair2);
  padding-top: 13px; margin-bottom: 17px;
}
.aboutlink {
  display: block; margin: 12px 8px 0; padding: 0; background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--mut); text-decoration: underline dashed; text-underline-offset: 3px;
  transition: color .15s ease;
}
.aboutlink:hover { color: var(--blue-ink); }

/* pulse hints on first interactive elements (box-shadow — never fights ::after knobs) */
.pulse { animation: hintpulse 2.2s ease-out infinite; }
.ai.pulse { border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.sw.pend.pulse { animation: swpulse 1s ease-in-out infinite; } /* pending wins */
@keyframes hintpulse {
  0% { box-shadow: 0 0 0 0 rgba(219,140,0,.5); }
  70% { box-shadow: 0 0 0 9px rgba(219,140,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(219,140,0,0); }
}

/* screen enter stagger */
.screen[hidden] { display: none; }
.screen.enter > * { animation: fadeUp .45s cubic-bezier(.25,.6,.3,1) backwards; }
.screen.enter > *:nth-child(1) { animation-delay: 0ms; }
.screen.enter > *:nth-child(2) { animation-delay: 50ms; }
.screen.enter > *:nth-child(3) { animation-delay: 100ms; }
.screen.enter > *:nth-child(4) { animation-delay: 150ms; }
.screen.enter > *:nth-child(5) { animation-delay: 200ms; }
.screen.enter > *:nth-child(6) { animation-delay: 250ms; }
.screen.enter > *:nth-child(7) { animation-delay: 300ms; }
.screen.enter > *:nth-child(8) { animation-delay: 350ms; }
.screen.enter > *:nth-child(n+9) { animation-delay: 400ms; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============ responsive ============ */
@media (max-width: 1240px) {
  #insp { width: 300px; }
}
@media (max-width: 980px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .att { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  #app { flex-direction: column; }
  aside {
    position: sticky; top: 0; z-index: 45; height: auto; width: 100%;
    display: flex; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden;
    padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--sidebar-hair);
    box-shadow: var(--shadow-soft);
  }
  .logo { margin: 0 12px 0 0; white-space: nowrap; }
  .navl { display: none; }
  .navi { margin-bottom: 0; white-space: nowrap; min-height: 0; padding: 6px 12px; flex-shrink: 0; }
  .navi.dis { display: none; }
  .wavebox { display: none; }
  .aboutlink { margin: 0 0 0 auto; white-space: nowrap; flex-shrink: 0; }
  main { padding: 16px 14px 64px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .fresh { display: none; }
  #insp {
    top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 72vh;
    transform: translateY(calc(100% + 20px));
    box-shadow: 0 -8px 40px rgba(23,28,38,.25), inset 0 2.5px 0 var(--gold);
  }
  #insp.open { transform: translateY(0); }
  .trio { grid-template-columns: 1fr; }
  .fun .fl { width: 96px; font-size: 10.5px; }
  .cphdr h2 { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .ccard { width: calc(50% - 5px); }
}
@media (max-width: 560px) {
  /* collapse the About button to its icon so the top bar never overflows */
  .abouttxt { display: none; }
  .aboutlink { font-size: 15px; text-decoration: none; padding: 4px 10px; }
}
@media (max-width: 480px) {
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .tile .v { font-size: 19px; }
}
