/* ============================================================================
   Market Intelligence Engine — "the calm analyst's instrument panel"
   Teal = conviction/trust · Amber = caution/distrust · numbers are mono readouts
   ========================================================================== */

:root {
  --ink:        #15171E;
  --ink-soft:   #232634;
  --paper:      #F7F8FA;
  --surface:    #FFFFFF;
  --line:       #E6E8EC;
  --line-soft:  #EFF1F4;
  --mute:       #6B7280;
  --mute-2:     #9AA1AC;
  --teal:       #0F766E;
  --teal-bright:#14B8A6;
  --teal-wash:  rgba(15,118,110,.10);
  --amber:      #B7791F;
  --amber-wash: rgba(183,121,31,.12);
  --gold:       #FFED00;   /* JB Hi-Fi client accent — used sparingly */

  --r-card: 14px;
  --r-pill: 999px;
  --shadow:      0 1px 2px rgba(20,23,30,.05), 0 10px 28px rgba(20,23,30,.06);
  --shadow-lift: 0 2px 6px rgba(20,23,30,.06), 0 18px 42px rgba(20,23,30,.11);
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* ---- global craft: selection · motion · focus · scrollbars ------------- */
::selection { background: rgba(20,184,166,.22); color: var(--ink); }
html { scroll-behavior: smooth; }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; border-radius: 5px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(20,23,30,.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,23,30,.30); }

/* Signature kicker: a short teal rule leads every eyebrow label */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--mute);
}
.eyebrow::before {
  content: ""; width: 14px; height: 2px; border-radius: 2px;
  background: var(--teal); flex-shrink: 0;
}
.rail .eyebrow::before { background: var(--teal-bright); }

/* ---- App shell: dark rail + paper main --------------------------------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--ink);
  color: #E7E9EE;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: baseline; gap: 9px; }
.brand__mark { color: var(--teal-bright); font-size: 22px; line-height: 1; }
.brand__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .02em;
}
.brand__sub {
  margin-top: 5px;
  padding-left: 32px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-2);
}

.rail .eyebrow { color: #7E8696; }

/* ---- rail navigation --------------------------------------------------- */
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font-family: var(--body); font-size: 14px; font-weight: 500;
  color: #AAB1BE; padding: 10px 12px; border-radius: 9px;
  transition: background .15s, color .15s;
}
.nav__item:hover { color: #fff; background: var(--ink-soft); }
.nav__item.is-active { color: #fff; background: var(--ink-soft); box-shadow: inset 3px 0 0 var(--teal-bright); }
.nav__ico { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #7E8696; transition: color .15s; }
.nav__ico svg { width: 18px; height: 18px; }
.nav__item:hover .nav__ico { color: #CDD3DE; }
.nav__item.is-active .nav__ico { color: var(--teal-bright); }

/* ---- week stepper (light; lives in the Plan view) --------------------- */
.week { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.week__ctl { display: flex; align-items: center; gap: 10px; }
.week__val {
  font-family: var(--display); font-weight: 600; font-size: 26px;
  min-width: 44px; text-align: center; color: var(--ink); font-variant-numeric: tabular-nums;
}
.week__val--date { font-size: 18px; white-space: nowrap; }   /* real date range, not "08" */
.step {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--mute);
  font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.step:hover { border-color: var(--teal); color: var(--teal); }
.step:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; }

/* ---- feedback-loop gauges (light; lives in the Learning view) --------- */
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.gauge {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); font-size: 12px; color: var(--mute);
}
.gauge b { font-family: var(--mono); font-weight: 600; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.reset {
  background: var(--surface); border: 1px solid var(--line); color: var(--mute);
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  padding: 11px; border-radius: 9px; cursor: pointer; width: 100%;
  transition: color .15s, border-color .15s;
}
.reset:hover { color: var(--amber); border-color: var(--amber); }

/* ---- Main column ------------------------------------------------------- */
.main { padding: 46px 52px 64px; max-width: 1080px; min-width: 0; }

.head { margin-bottom: 30px; }
.headline {
  font-family: var(--display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.04;
  letter-spacing: -.015em;
  margin: 10px 0 12px;
}
.lede {
  font-size: 16px;
  line-height: 1.55;
  color: var(--mute);
  max-width: 64ch;
  margin: 0 0 22px;
}

/* ---- top bar + view routing ------------------------------------------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.topbar__title { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.015em; margin: 6px 0 0; }
.topbar__right { padding-top: 4px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.greeting { text-align: right; line-height: 1.3; }
.greeting__hi { display: block; font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink); }
.greeting__dt { display: block; font-family: var(--mono); font-size: 11px; color: var(--mute); }
.view { display: none; }
.view--active { display: block; animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.linkbtn { background: none; border: none; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--teal); padding: 4px 0; }
.linkbtn:hover { text-decoration: underline; }

/* ---- KPI cards (Dashboard) -------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 17px 18px; box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: #DADEE4; }
.kpi__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi__ico { width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--teal-wash); color: var(--teal); flex-shrink: 0; }
.kpi__ico svg { width: 17px; height: 17px; }
.kpi--amber .kpi__ico { background: var(--amber-wash); color: var(--amber); }
.kpi--ink .kpi__ico { background: var(--line-soft); color: var(--ink); }
.kpi__label { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); line-height: 1.25; }
.kpi__big {
  font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.12;
  letter-spacing: -.015em; margin: 0 0 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kpi--teal .kpi__big { color: var(--teal); }
.kpi--amber .kpi__big { color: var(--amber); }
.kpi__sub { font-size: 12px; color: var(--mute); line-height: 1.4; }

/* ---- hero (Dashboard headline) ---------------------------------------- */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: center;
  background: linear-gradient(135deg, #0F766E 0%, #114B45 100%);
  border: none; border-radius: 16px;
  padding: 26px 30px; margin-bottom: 22px;
  position: relative; overflow: hidden;
  box-shadow: 0 14px 36px rgba(15,118,110,.24);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -90px;
  width: 280px; height: 280px; pointer-events: none;
  background: radial-gradient(circle, rgba(93,202,165,.30), transparent 68%);
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: #9FE1CB; }
.hero .eyebrow::before { background: #5DCAA5; }
.hero__stat { font-family: var(--display); font-weight: 700; font-size: 48px; color: #fff; line-height: 1; margin: 11px 0 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero__cap { font-size: 13.5px; color: rgba(233,247,242,.84); line-height: 1.55; margin: 0; max-width: 54ch; }
.hero__cap b { color: #fff; font-weight: 600; }
.hero__side { display: flex; gap: 26px; padding-left: 26px; border-left: 1px solid rgba(255,255,255,.16); }
.herometric { text-align: center; }
.herometric b { display: block; font-family: var(--display); font-weight: 700; font-size: 22px; color: #fff; font-variant-numeric: tabular-nums; }
.herometric span { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9FE1CB; }

/* ---- plan preview (Dashboard) ----------------------------------------- */
.dashplan { display: flex; flex-direction: column; gap: 8px; }
.dpitem {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 14px;
  width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; cursor: pointer; font-family: var(--body);
  transition: border-color .15s, background .15s;
}
.dpitem:hover { border-color: rgba(15,118,110,.4); background: var(--surface); }
.dpitem__rank { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--mute-2); }
.dpitem__topic { font-family: var(--display); font-weight: 600; font-size: 15px; margin-bottom: 5px; }
.dpitem__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.dpitem__roi { font-family: var(--mono); font-weight: 600; font-size: 18px; color: var(--teal); text-align: right; }
.dpitem__roi span { display: block; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 400; }

/* ---- plan bar (Plan view) --------------------------------------------- */
.planbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.planbar .lede { margin-bottom: 0; }

/* ---- client config (Settings view) ------------------------------------ */
.cfg { display: flex; flex-direction: column; }
.cfgrow { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; color: var(--mute); }
.cfgrow:first-child { border-top: none; }
.cfgrow b { color: var(--ink); font-weight: 600; text-align: right; }
.cfg__note { font-size: 12.5px; color: var(--mute); margin: 14px 0 0; line-height: 1.6; }
.cfg__note code { font-family: var(--mono); font-size: 11.5px; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; color: var(--ink-soft); }

/* ---- Opportunity cards ------------------------------------------------- */
.cards { display: flex; flex-direction: column; gap: 14px; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 22px 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 44px 1fr 188px;
  gap: 4px 20px;
  align-items: start;
  animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: rgba(15,118,110,.28); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card__rank {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  color: var(--mute-2);
  font-variant-numeric: tabular-nums;
  grid-row: 1 / 3;
  padding-top: 2px;
}
.card__main { grid-column: 2; }
.card__topic {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -.01em;
  margin: 0 0 7px;
  line-height: 1.25;
}
.card__cat { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--mute); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 2px 8px; vertical-align: middle; white-space: nowrap; }
.card__why { font-size: 13.5px; color: var(--mute); line-height: 1.45; margin: 0 0 8px; }
.card__why b { color: var(--ink-soft); }
.card__news { font-size: 12.5px; color: #3C4250; line-height: 1.4; margin: 0 0 10px; }
.card__meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 12px; }

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .03em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  color: var(--mute);
  background: var(--paper);
}
.tag--action { color: var(--teal); border-color: rgba(15,118,110,.28); background: var(--teal-wash); }
.tag--effort-low  { color: #1F7A4D; border-color: rgba(31,122,77,.25); background: rgba(31,122,77,.08); }
.tag--effort-med  { color: #8A6A12; border-color: rgba(138,106,18,.22); background: rgba(138,106,18,.07); }
.tag--effort-high { color: #9A3B2A; border-color: rgba(154,59,42,.22); background: rgba(154,59,42,.07); }
.tag--test { color: var(--amber); border-color: rgba(183,121,31,.32); background: var(--amber-wash); font-weight: 600; }

.probe {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-wash);
  border: 1px solid rgba(183,121,31,.3);
  padding: 3px 9px;
  border-radius: var(--r-pill);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  color: #3C4250;
  background: var(--line-soft);
  border-radius: 7px;
  padding: 4px 9px;
}
.chip--warn { color: var(--amber); background: var(--amber-wash); }

/* conviction column (the signature element) */
.card__conv { grid-column: 3; grid-row: 1 / 3; padding-top: 2px; }
.conv__row { display: flex; align-items: baseline; justify-content: space-between; }
.conv__label { font-family: var(--mono); font-size: 11px; color: var(--mute); letter-spacing: .04em; }
.conv__roi {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 22px;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
/* plain-language priority + confidence badges (shared across views) */
.conv__roi.prio, .dpitem__roi.prio, .sigrow__roi.prio { font-size: 15px; }
.prio.is-high, .conv__readout b.is-high { color: var(--teal); }
.prio.is-med,  .conv__readout b.is-med  { color: var(--amber); }
.prio.is-low,  .conv__readout b.is-low  { color: var(--mute); }
.cv { width: 100%; height: 26px; margin: 7px 0 4px; display: block; }
.cv__track { stroke: var(--line); stroke-width: 2; }
.cv__grid  { stroke: var(--line-soft); stroke-width: 1.5; }
/* the band + dot glide when the engine revises its belief after a recorded result */
.cv__band  { fill: var(--teal-wash); transition: x .55s cubic-bezier(.2,.7,.2,1), width .55s cubic-bezier(.2,.7,.2,1); }
.cv__pt    { fill: var(--teal); transition: cx .55s cubic-bezier(.2,.7,.2,1); }
.conv__readout {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.conv__readout b { color: var(--ink); font-weight: 600; }

/* result control */
.result {
  grid-column: 2 / 4;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.result__label { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--mute); text-transform: uppercase; }
.result__hint { flex-basis: 100%; font-size: 11px; color: var(--mute-2); margin-top: 2px; line-height: 1.4; }
.result__hint em { font-style: italic; color: var(--mute); }

/* 5-point agree/disagree verdict (replaces the old 0-100 performance slider) */
.likert { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 220px; }
.lk {
  font-family: var(--body); font-size: 11.5px; font-weight: 500;
  color: var(--mute); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 12px; cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.lk:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.lk:disabled { cursor: default; opacity: .5; }
.lk.is-picked { color: #fff; border-color: transparent; opacity: 1; }
.lk--sd.is-picked, .lk--d.is-picked { background: var(--amber); }
.lk--n.is-picked { background: var(--mute); }
.lk--a.is-picked, .lk--sa.is-picked { background: var(--teal); }
.result input[type=range] { flex: 1; min-width: 140px; accent-color: var(--teal); }
.result input[type=range]:disabled { accent-color: var(--mute-2); opacity: .7; }
.result__pct {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.btn {
  font-family: var(--body);
  font-weight: 500;
  font-size: 13px;
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--teal); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; }
.card.is-logged { border-color: rgba(15,118,110,.4); }
.card.is-logged .result__label { color: var(--teal); }
/* a brief pulse on the ROI when the engine revises this card after a result */
.card.is-learning .conv__roi { animation: roipulse .8s ease; }
@keyframes roipulse { 0%, 40% { color: var(--teal-bright); } 100% { color: var(--teal); } }

/* ---- AI Strategist action plan ----------------------------------------- */
.planbtn {
  font-family: var(--body); font-size: 12px; font-weight: 500;
  color: var(--teal); background: var(--teal-wash);
  border: 1px solid rgba(15,118,110,.28); border-radius: var(--r-pill);
  padding: 4px 11px; cursor: pointer; transition: background .15s, color .15s;
}
.planbtn:hover { background: var(--teal); color: #fff; }
.planbtn:disabled { opacity: .7; cursor: default; }
.plan {
  margin-top: 12px; padding: 14px 16px;
  background: linear-gradient(120deg, rgba(15,118,110,.06), rgba(20,184,166,.03));
  border: 1px solid rgba(15,118,110,.20); border-radius: 12px;
  animation: rise .4s cubic-bezier(.2,.7,.2,1) both;
}
.plan[hidden] { display: none; }
.plan__head {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute);
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.plan__tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  color: var(--teal); background: var(--surface);
  border: 1px solid rgba(15,118,110,.3); border-radius: var(--r-pill); padding: 2px 7px;
}
.plan__tag--tpl { color: var(--mute); border-color: var(--line); }
.plan__title {
  font-family: var(--display); font-weight: 600; font-size: 16px;
  letter-spacing: -.01em; margin-bottom: 10px; line-height: 1.25;
}
.plan__row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; margin-bottom: 7px; }
.plan__row > span {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--mute); padding-top: 2px;
}
.plan__row p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.plan__row ul { margin: 0; padding-left: 16px; }
.plan__row li { font-size: 13px; color: var(--ink-soft); line-height: 1.45; margin-bottom: 3px; }
.plan__loading { font-size: 13px; color: var(--mute); font-style: italic; }

/* ---- Analysis panels --------------------------------------------------- */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 40px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 22px 24px 20px;
  box-shadow: var(--shadow);
}
.panel__head { margin-bottom: 18px; }
.panel__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  margin: 7px 0 0;
}
.panel__note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--mute);
  margin: 16px 0 0;
}
.panel__note b { color: var(--ink); }

/* learned-weights diverging bars */
.weights { display: flex; flex-direction: column; gap: 9px; }
.wrow { display: grid; grid-template-columns: 158px 1fr 92px; align-items: center; gap: 12px; }
.wrow__label { font-family: var(--body); font-size: 12.5px; color: #3C4250; }
.wrow.is-distrust .wrow__label { color: var(--amber); font-weight: 600; }
.wbar { position: relative; height: 16px; background: var(--line-soft); border-radius: 5px; }
.wbar__zero { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--mute-2); }
.wbar__fill { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.wbar__fill.pos { left: 50%; background: var(--teal); }
.wbar__fill.neg { right: 50%; background: var(--amber); }
.wrow__val { font-family: var(--body); font-size: 11.5px; text-align: right; color: var(--mute); }
.wrow.is-distrust .wrow__val { color: var(--amber); font-weight: 600; }

/* robustness callout — the credible, multi-market headline */
.robust {
  background: var(--teal-wash);
  border: 1px solid rgba(15,118,110,.22);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.robust:empty { display: none; }
.robust__big {
  font-family: var(--display);
  font-weight: 700;
  font-size: 27px;
  color: var(--teal);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.robust__big span {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
}
.robust__cap { font-size: 12.5px; color: var(--ink-soft); margin-top: 7px; line-height: 1.45; }
.robust__cap b { color: var(--ink); }

/* proof chart */
.proof svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 18px; margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--loop { background: var(--teal); }
.dot--static { background: var(--mute-2); }

/* ablation: what each upgrade adds (grey = open-loop, teal = learning) */
.ablation-panel { margin-top: 20px; }
.abl { display: flex; flex-direction: column; gap: 10px; }
.ablrow { display: grid; grid-template-columns: 188px 1fr 104px; align-items: center; gap: 14px; }
.ablrow__label { font-family: var(--mono); font-size: 12.5px; color: #3C4250; }
.ablrow.closed .ablrow__label { color: var(--teal); font-weight: 600; }
.ablbar { position: relative; height: 18px; background: var(--line-soft); border-radius: 5px; }
.ablbar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--mute-2); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.ablrow.closed .ablbar__fill { background: var(--teal); }
.ablrow__val { font-family: var(--mono); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.ablrow__val span { color: var(--mute); font-size: 11px; }
.ablrow__val span.up { color: var(--teal); }
@media (max-width: 900px) { .ablrow { grid-template-columns: 130px 1fr 92px; gap: 10px; } }

/* toast */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast b { color: var(--teal-bright); }

/* loading / empty */
.skeleton {
  height: 96px;
  border-radius: var(--r-card);
  background: linear-gradient(90deg, #F1F2F5 25%, #E9EBEF 37%, #F1F2F5 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1040px) { .kpis { grid-template-columns: 1fr 1fr; } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; gap: 14px; padding: 16px 20px; }
  .brand__sub { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 0; }
  .nav__item { width: auto; padding: 8px 12px; }
  .nav__item.is-active { box-shadow: inset 0 -2px 0 var(--teal-bright); }
  .main { padding: 24px 18px 56px; }
  .topbar { flex-direction: column; gap: 10px; }
  .topbar__right { width: 100%; min-width: 0; }
  .topbar__title { font-size: 25px; }
  .hero { grid-template-columns: 1fr; gap: 16px; }
  .hero__side { padding-left: 0; border-left: none; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.16); }
  .planbar { flex-direction: column; align-items: flex-start; }
  .week { align-items: flex-start; }
  .card { grid-template-columns: 32px 1fr; }
  .card__conv { grid-column: 1 / 3; grid-row: auto; margin-top: 12px; }
  .result { grid-column: 1 / 3; }
  .panels { grid-template-columns: 1fr; }
}

@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Signals view ------------------------------------------------------ */
.siglist { display: flex; flex-direction: column; gap: 12px; }
.sigrow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; box-shadow: var(--shadow); }
.sigrow__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sigrow__name { font-family: var(--display); font-weight: 600; font-size: 16px; }
.sigrow__vol { font-family: var(--mono); font-size: 11.5px; color: var(--teal); margin-top: 3px; }
.sigrow__roi { font-family: var(--mono); font-weight: 600; font-size: 18px; color: var(--teal); text-align: right; }
.sigrow__roi span { display: block; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); font-weight: 400; }
.sigrow__bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sig { display: flex; align-items: center; gap: 8px; }
.sig__lbl { font-family: var(--body); font-size: 11px; color: var(--mute); width: 96px; flex-shrink: 0; }
.sig__track { flex: 1; height: 7px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.sig__fill { height: 100%; background: var(--teal); border-radius: 4px; }
.sig__val { font-family: var(--mono); font-size: 12px; width: 30px; text-align: right; color: var(--ink); }
.sig__news { font-size: 12px; color: var(--mute); margin-top: 8px; line-height: 1.4; }
/* demand history sparkline + seasonality (real Ahrefs volume history) */
.sig__demand { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.spark--wrap { display: inline-flex; width: 118px; height: 26px; color: var(--mute-2); flex-shrink: 0; }
.spark--wrap.up { color: var(--teal); }
.spark--wrap.down { color: var(--amber); }
.spark { width: 100%; height: 100%; }
.sig__trend { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.sig__trend.up { color: var(--teal); }
.sig__trend.down { color: var(--amber); }
.sig__trend b { color: var(--ink); }
.sig__trend-sub { color: var(--mute); }

/* ---- Competitors view -------------------------------------------------- */
.refreshbtn {
  font-family: var(--body); font-size: 13px; font-weight: 500;
  color: #fff; background: var(--ink); border: none; border-radius: 9px;
  padding: 9px 16px; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.refreshbtn:hover { background: var(--teal); }
.refreshbtn:disabled { opacity: .6; cursor: default; }
.complist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.comp {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.comp--blocked { opacity: .82; }
.comp__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.comp__name { font-family: var(--display); font-weight: 600; font-size: 16px; }
.comp__badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; color: var(--mute);
  background: var(--line-soft); border-radius: var(--r-pill); padding: 3px 9px; white-space: nowrap;
}
.comp__badge--new { color: #fff; background: var(--teal); }
.comp__badge--blk { color: var(--amber); background: var(--amber-wash); border: 1px solid rgba(183,121,31,.3); }
.comp__meta { font-family: var(--mono); font-size: 11px; color: var(--mute); margin-bottom: 10px; }
.comp__src { color: var(--teal); }
.comp__pages { margin: 0; padding-left: 18px; }
.comp__pages li { font-size: 13px; line-height: 1.5; margin-bottom: 3px; }
.comp__pages a { color: var(--teal); text-decoration: none; }
.comp__pages a:hover { text-decoration: underline; }
.comp__note { font-size: 12.5px; color: var(--mute); line-height: 1.45; margin: 0; }
@media (max-width: 900px) { .complist { grid-template-columns: 1fr; } }

/* ---- AI Visibility view ------------------------------------------------ */
.aivwrap { display: flex; flex-direction: column; gap: 18px; max-width: 1000px; }
.aiv__you { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--teal); border-radius: var(--r-pill); padding: 2px 7px; }

/* hero: SoV gauge + headline */
.aivhero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; box-shadow: var(--shadow); }
.sovg { width: 150px; height: 150px; flex-shrink: 0; }
.sovg__bg { fill: none; stroke: var(--line-soft); stroke-width: 13; }
.sovg__arc { fill: none; stroke: var(--teal); stroke-width: 13; stroke-linecap: round; transition: stroke-dasharray .8s cubic-bezier(.2,.7,.2,1); }
.sovg__pct { font-family: var(--display); font-weight: 700; font-size: 33px; fill: var(--ink); text-anchor: middle; }
.sovg__lbl { font-family: var(--mono); font-size: 8px; letter-spacing: .12em; text-transform: uppercase; fill: var(--mute); text-anchor: middle; }
.aivhero__rankbadge { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); background: var(--teal-wash); border: 1px solid rgba(15,118,110,.25); padding: 4px 11px; border-radius: var(--r-pill); }
.aivhero__title { font-family: var(--display); font-weight: 700; font-size: 23px; letter-spacing: -.015em; margin: 11px 0 7px; line-height: 1.2; }
.aivhero__title b { color: var(--teal); }
.aivhero__sub { font-size: 13.5px; color: var(--mute); line-height: 1.5; margin: 0; max-width: 62ch; }
.aivhero__chips { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.aivchip { font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 10px; }

/* insight cards */
.aivcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.aivcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 15px 16px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.aivcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.aivcard__lbl { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.aivcard__lbl::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.aivcard--amber .aivcard__lbl::before { background: var(--amber); }
.aivcard__big { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; margin: 9px 0 3px; color: var(--teal); font-variant-numeric: tabular-nums; }
.aivcard--amber .aivcard__big { color: var(--amber); }
.aivcard__sub { font-size: 12px; color: var(--mute); line-height: 1.4; }

/* competitive leaderboard */
.lbpanel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; box-shadow: var(--shadow); }
.lb { display: grid; grid-template-columns: 32px 1fr 56px; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.lb:first-of-type { border-top: none; padding-top: 2px; }
.lb__rank { font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--mute-2); font-variant-numeric: tabular-nums; }
.lb--me .lb__rank { color: var(--teal); }
.lb__main { min-width: 0; }
.lb__top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.lb__name { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--ink); }
.lb__gap { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--amber); background: var(--amber-wash); border-radius: var(--r-pill); padding: 2px 8px; }
.lb__bar { height: 12px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.lb__fill { height: 100%; border-radius: var(--r-pill); background: var(--mute-2); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.lb--me .lb__fill { background: linear-gradient(90deg, var(--teal-bright), var(--teal)); }
.lb--threat .lb__fill { background: var(--amber); }
.lb__val { font-family: var(--mono); font-weight: 700; font-size: 16px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }

.aivmethod { font-size: 12px; color: var(--mute); line-height: 1.55; background: var(--paper); border: 1px solid var(--line-soft); border-radius: 12px; padding: 13px 16px; }
.aivmethod b { color: var(--ink-soft); }

@media (max-width: 720px) {
  .aivhero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .aivhero__chips { justify-content: center; }
  .aivcards { grid-template-columns: 1fr 1fr; }
}

/* ---- Content Gaps ------------------------------------------------------ */
.gapwrap { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.gapchips { display: flex; flex-wrap: wrap; gap: 8px; }
.gapchip { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s; }
.gapchip b { color: var(--mute-2); font-weight: 600; margin-left: 2px; }
.gapchip:hover { border-color: var(--teal); }
.gapchip.is-on { background: var(--teal); border-color: var(--teal); color: #fff; }
.gapchip.is-on b { color: #CFEDE4; }

.gaplist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.gap { display: grid; grid-template-columns: 128px 1fr auto; align-items: center; gap: 16px;
  padding: 13px 20px; border-top: 1px solid var(--line-soft); }
.gap:first-child { border-top: none; }
.gap:hover { background: var(--paper); }
.gaptype { font-family: var(--mono); font-size: 10px; letter-spacing: .03em; text-align: center;
  padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); color: var(--mute);
  background: var(--paper); white-space: nowrap; }
.gaptype--guide { color: var(--teal); border-color: rgba(15,118,110,.28); background: var(--teal-wash); }
.gaptype--cmp { color: #fff; background: var(--teal); border-color: var(--teal); }
.gaptype--info { color: var(--amber); border-color: rgba(183,121,31,.28); background: var(--amber-wash); }
.gap__kw { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink); }
.gap__meta { font-size: 12px; color: var(--mute); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gap__vol { font-family: var(--mono); font-weight: 600; color: var(--ink-soft); }
.gap__sep { color: var(--mute-2); }
.gap__comp { color: var(--amber); }
.gap__cat { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mute); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 9px; white-space: nowrap; }

@media (max-width: 720px) {
  .gap { grid-template-columns: 1fr; gap: 8px; }
  .gaptype { justify-self: start; }
  .gap__cat { justify-self: start; }
}

/* ---- Marketing Ideas (topics -> ranked ideas) -------------------------- */
.ideawrap { display: flex; flex-direction: column; gap: 16px; max-width: 1000px; }
.topic { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.topic__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 15px 20px; background: linear-gradient(120deg, var(--teal-wash), rgba(20,184,166,.03));
  border-bottom: 1px solid var(--line-soft); }
.topic__title { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topic__cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--teal); background: var(--surface); border: 1px solid rgba(15,118,110,.25);
  border-radius: var(--r-pill); padding: 3px 9px; }
.topic__ev { font-size: 12.5px; color: var(--mute); margin-top: 5px; }
.topic__count { font-family: var(--mono); font-size: 11px; color: var(--mute); white-space: nowrap; padding-top: 3px; }
.topic__ideas { display: flex; flex-direction: column; }
.idea { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: start;
  padding: 13px 20px; border-top: 1px solid var(--line-soft); transition: background .15s; }
.idea:first-child { border-top: none; }
.idea:hover { background: var(--paper); }
.idea__lane { font-family: var(--mono); font-size: 9.5px; letter-spacing: .05em; text-transform: uppercase;
  text-align: center; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--mute); background: var(--paper); white-space: nowrap; }
.idea__lane--seo, .idea__lane--com { color: var(--teal); border-color: rgba(15,118,110,.28); background: var(--teal-wash); }
.idea__lane--soc, .idea__lane--ai { color: var(--amber); border-color: rgba(183,121,31,.28); background: var(--amber-wash); }
.idea__what { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.3; }
.idea__why { font-size: 12.5px; color: var(--mute); line-height: 1.45; margin: 4px 0 7px; }
.idea__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.idea__type { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); background: var(--line-soft);
  border-radius: 5px; padding: 2px 7px; }
.ipill { font-size: 11px; color: var(--mute); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 8px; }
.idea__whynow { font-size: 11.5px; color: var(--mute-2); font-style: italic; }
.idea__score { font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--teal);
  font-variant-numeric: tabular-nums; padding-top: 2px; }

@media (max-width: 720px) {
  .idea { grid-template-columns: 1fr; gap: 8px; }
  .idea__lane { justify-self: start; }
  .idea__score { display: none; }
}

/* ---- Learned principles (What It's Learned) ---------------------------- */
.principles { display: flex; flex-direction: column; gap: 14px; }
.prin__top { display: flex; align-items: baseline; gap: 10px; }
.prin__type { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); }
.prin__basis { font-family: var(--mono); font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--mute); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 2px 8px; }
.prin__basis.is-learned { color: var(--teal); border-color: rgba(15,118,110,.3); background: var(--teal-wash); }
.prin__score { margin-left: auto; font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--teal); font-variant-numeric: tabular-nums; }
.prin__track { height: 8px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; margin: 6px 0 5px; }
.prin__fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--teal-bright), var(--teal));
  transition: width .7s cubic-bezier(.2,.7,.2,1); }
.prin__why { font-size: 12px; color: var(--mute); line-height: 1.4; }

/* ---- Market Signals: clickable rows + category detail ------------------ */
.sigrow--click { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.sigrow--click:hover { border-color: rgba(15,118,110,.35); box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.sigrow__more { font-family: var(--mono); font-size: 11px; color: var(--teal); margin-top: 10px; opacity: .5; transition: opacity .15s; }
.sigrow--click:hover .sigrow__more { opacity: 1; }

.catdetail { display: flex; flex-direction: column; gap: 18px; max-width: 900px; }
.cdback { align-self: flex-start; background: none; border: none; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--teal); padding: 0; }
.cdback:hover { text-decoration: underline; }
.cdsig__row { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.cdsig__row:first-of-type { border-top: none; }
.cdsig__head { display: flex; justify-content: space-between; align-items: baseline; }
.cdsig__label { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); }
.cdsig__score { font-family: var(--mono); font-weight: 700; font-size: 15px; color: var(--teal); font-variant-numeric: tabular-nums; }
.cdbar { height: 8px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; margin: 7px 0 6px; }
.cdbar__fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--teal-bright), var(--teal)); }
.cdsig__real { font-size: 12.5px; color: var(--ink-soft); }
.cdsig__src { font-family: var(--mono); font-size: 11px; color: var(--mute-2); }
.cdtrend { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.cdtrend .spark--wrap { width: 280px; height: 64px; flex-shrink: 0; }
.cdtrend__pct { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--ink); }
.cdtrend__pct.up { color: var(--teal); }
.cdtrend__pct.down { color: var(--amber); }
.cdtrend__sub { font-size: 12.5px; color: var(--mute); margin-top: 3px; }
.cdgap { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.cdgap:first-of-type { border-top: none; }
.cdgap__kw { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--ink); }
.cdgap__meta { font-size: 12px; color: var(--mute); margin-top: 2px; }

/* ---- plan recommendation detail (SEO evidence + brief) ----------------- */
.evbtn { font-family: var(--mono); font-size: 11px; color: var(--teal); background: none; border: none;
  cursor: pointer; padding: 4px 2px; margin-left: auto; }
.evbtn:hover { text-decoration: underline; }
.rd__tbl { width: 100%; border-collapse: collapse; }
.rd__tbl td { padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13px; vertical-align: top; }
.rd__tbl tr:first-child td { border-top: none; }
.rd__k { color: var(--mute); width: 220px; }
.rd__v { color: var(--ink); font-weight: 500; }
.rd__why { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); margin: 16px 0 0; }
.rd__why b { color: var(--ink); }
.rdsig { margin-bottom: 13px; }
.rdsig__top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.rdsig__top span { font-weight: 600; color: var(--ink); }
.rdsig__top b { font-family: var(--mono); color: var(--teal); font-variant-numeric: tabular-nums; }
.rdsig__sub { font-size: 11.5px; color: var(--mute); margin-top: 4px; }

@media (max-width: 720px) { .rd__k { width: 45%; } }

/* ---- Integrations (Connect Google) + Recommendation performance -------- */
.integrations { display: flex; flex-direction: column; gap: 12px; }
.intg { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.intg__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.intg__name { font-family: var(--display); font-weight: 600; font-size: 15px; }
.intg__ok { font-family: var(--mono); font-size: 11px; color: var(--teal); }
.intg__warn { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.intg__off { font-family: var(--mono); font-size: 11px; color: var(--mute); }
.intg__sel { margin-top: 10px; width: 100%; font-family: var(--body); font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.intg__note { font-size: 13.5px; color: var(--mute); line-height: 1.5; margin: 0 0 12px; }
.markdone { font-family: var(--body); font-size: 12px; font-weight: 500; color: var(--mute);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 11px; cursor: pointer; transition: color .12s, border-color .12s; }
.markdone:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.markdone:disabled { color: var(--teal); border-color: rgba(15,118,110,.3); cursor: default; }
.perf__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 12px; }
.perf__stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.perf__stat b { display: block; font-family: var(--display); font-weight: 600; font-size: 26px; color: var(--ink); }
.perf__stat span { font-family: var(--mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--mute); }
.perf__empty { font-size: 13.5px; color: var(--mute); line-height: 1.5; margin: 0; }
@media (max-width: 560px) { .perf__grid { grid-template-columns: 1fr 1fr; } }

/* ---- virtual assistant ------------------------------------------------- */
.asst-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  background: var(--ink); color: #fff; border: none; cursor: pointer;
  font-family: var(--body); font-size: 13.5px; font-weight: 500;
  padding: 12px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.asst-fab svg { width: 15px; height: 15px; }
.asst-fab:hover { background: var(--teal); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.asst {
  position: fixed; right: 22px; bottom: 22px; z-index: 61;
  width: 360px; max-width: calc(100vw - 32px); height: 480px; max-height: calc(100vh - 60px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 48px rgba(20,23,30,.22); display: flex; flex-direction: column; overflow: hidden;
}
.asst[hidden] { display: none; }   /* class rule would otherwise override [hidden] */
.asst__head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; }
.asst__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--teal-bright); margin-right: 7px; }
.asst__x { background: none; border: none; color: #9AA1AC; cursor: pointer; font-size: 14px; }
.asst__x:hover { color: #fff; }
.asst__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.asstmsg { max-width: 86%; font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; }
.asstmsg--bot { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); color: var(--ink); }
.asstmsg--user { align-self: flex-end; background: var(--teal); color: #fff; }
.asst__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.asst__form input { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; font-family: var(--body); font-size: 13.5px; outline: none; }
.asst__form input:focus { border-color: var(--teal); }
.asst__form button { background: var(--ink); color: #fff; border: none; border-radius: 9px; padding: 0 14px; font-size: 16px; cursor: pointer; }
.asst__form button:hover { background: var(--teal); }

/* ---- Data page (Ahrefs upload) ----------------------------------------- */
.revertbtn { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; font-family: var(--body); font-size: 13px; cursor: pointer; white-space: nowrap; transition: border-color .15s, color .15s; flex-shrink: 0; }
.revertbtn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.revertbtn:disabled { opacity: .6; cursor: default; }
.revertbtn[hidden] { display: none; }
.datastatus { }
.dgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dstat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.dstat span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin-bottom: 6px; }
.dstat b { font-size: 20px; color: var(--ink); font-family: var(--display); }
.dstat.is-live { border-color: rgba(15,118,110,.4); background: var(--teal-wash); }
.dstat.is-live b { color: var(--teal); }
.dstat.is-none b { color: var(--amber); }
.dsub { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); margin: 20px 0 10px; }
.dchips { display: flex; flex-wrap: wrap; gap: 7px; }
.dchip { font-size: 12px; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px 11px; }
.dchip b { color: var(--teal); margin-left: 3px; }
.dmuted { color: var(--mute); font-size: 13px; }
.dsites { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.dsite { display: flex; align-items: center; justify-content: space-between; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; font-size: 13px; }
.dsite b { color: var(--ink); }

.upl { margin-top: 2px; }
.uplrows { display: flex; flex-direction: column; gap: 10px; }
.uplrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.uplrow:hover { border-color: var(--mute-2); }
.uplrow.is-set { border-color: rgba(15,118,110,.45); background: var(--teal-wash); }
.uplrow__l { display: flex; flex-direction: column; gap: 2px; }
.uplrow__l b { font-size: 14px; color: var(--ink); }
.uplrow__l span { font-size: 12px; color: var(--mute); }
.uplrow__file { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.uplrow__name { font-family: var(--mono); font-size: 12px; color: var(--teal); background: var(--surface); border: 1px dashed var(--mute-2); border-radius: 8px; padding: 7px 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uplrow.is-set .uplrow__name { border-style: solid; border-color: var(--teal); }
.upl__actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.upl__go { background: var(--ink); color: #fff; border: none; border-radius: 10px; padding: 11px 20px; font-family: var(--body); font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.upl__go:hover:not(:disabled) { background: var(--teal); }
.upl__go:disabled { opacity: .6; cursor: default; }
.upl__msg { font-size: 13px; color: var(--mute); }
.upl__msg--err { color: var(--amber); font-weight: 500; }
.uplres { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.uplres__ok { font-size: 13.5px; color: var(--ink); background: var(--teal-wash); border: 1px solid rgba(15,118,110,.3); border-radius: 10px; padding: 11px 14px; }
.uplres__warn { font-size: 13.5px; color: var(--ink); background: var(--amber-wash, #fff7ed); border: 1px solid rgba(217,119,6,.35); border-radius: 10px; padding: 11px 14px; }

@media (max-width: 720px) { .dgrid { grid-template-columns: repeat(2, 1fr); } .uplrow { flex-direction: column; align-items: flex-start; gap: 10px; } .uplrow__name { max-width: 100%; } }
@media (max-width: 560px) {
  .sigrow__bars { grid-template-columns: 1fr; gap: 8px; }
  .wrow { grid-template-columns: 116px 1fr 76px; gap: 8px; }
  .asst { right: 8px; bottom: 8px; }
}
