:root { color-scheme: dark; }
/* n-seo dashboard — neutral palette, light + dark, flat cards with hairline borders. */
:root {
  --ground: #f6f7f9;
  --panel: #fbfbfd;
  --card: #ffffff;
  --ink: #16181d;
  --muted: #5f6672;
  --line: #e3e6eb;
  --accent: #3757d6;
  --accent-bright: #3757d6;
  --accent-soft: rgba(55, 87, 214, 0.12);
  --good: #1a7f4b;
  --good-soft: rgba(26, 127, 75, 0.12);
  --bad: #c2334d;
  --bad-soft: rgba(194, 51, 77, 0.10);
  --warn: #b4620a;
  --warn-soft: rgba(180, 98, 10, 0.12);
  --purple: #6c41f0;
  --code-bg: #eef0f4;
  --topbar: #151821;
  --topbar-ink: rgba(255, 255, 255, 0.78);
  --heat: 55, 87, 214;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Traffic-source groups. Okabe-Ito derived: vermillion / indigo / green /
     pink stay separable under deuteranopia and protanopia, and no pair of
     adjacent bands is red-against-green. AI is the vivid one on purpose —
     it is the series people open this chart to read. */
  --grp-ai: #d55e00;
  --grp-search: #3757d6;
  --grp-direct: #7a8194;
  --grp-referral: #009e73;
  --grp-social: #cc79a7;
  --grp-other: #b6bcc8;
}
@media all {
  :root {
    --ground: #0f1115;
    --panel: #151821;
    --card: #1a1e29;
    --ink: #e8eaf0;
    --muted: #9aa3b5;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #8da2ff;
    --accent-bright: #8da2ff;
    --accent-soft: rgba(141, 162, 255, 0.16);
    --good: #4cc48a;
    --good-soft: rgba(76, 196, 138, 0.16);
    --bad: #ff7b93;
    --bad-soft: rgba(255, 123, 147, 0.18);
    --warn: #f0a04b;
    --warn-soft: rgba(240, 160, 75, 0.18);
    --purple: #b9a3ff;
    --code-bg: rgba(255, 255, 255, 0.08);
    --heat: 141, 162, 255;
    --grp-ai: #ff9d5c;
    --grp-search: #8da2ff;
    --grp-direct: #8a93a6;
    --grp-referral: #4cc48a;
    --grp-social: #e79fc8;
    --grp-other: #5b6272;
  }
}

/* Montserrat, self-hosted: one variable file, latin subset, from this origin.
   Headings and the brand mark only — the tables, chips and numbers stay on the
   system UI font, which is what a dense data view is designed around. The
   fallback stack is what renders if the file is missing, so nothing breaks. */
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-var.woff2") format("woff2-variations"),
       url("/fonts/montserrat-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
}
main { max-width: 1480px; margin: 0 auto; padding: 28px 24px 80px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.8rem; font-weight: 800; margin: 0.5em 0; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 2em 0 0.6em; text-transform: uppercase; letter-spacing: 0.06em; }
h2 small { font-weight: 500; color: var(--muted); font-size: 0.75rem; text-transform: none; letter-spacing: 0; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 11px 24px; background: var(--topbar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 800; color: #fff; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { flex-shrink: 0; display: block; }   /* the mark carries its own brand colors */
.brand-name { max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { color: var(--topbar-ink); font-weight: 500; font-size: 0.8rem; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .nav-menu summary {
  font-family: var(--display);
  color: var(--topbar-ink); text-decoration: none; font-size: 0.82rem; font-weight: 600;
  padding: 4px 10px; border-radius: 99px;
}
.topbar nav a.on, .topbar nav a:hover, .nav-menu summary.on, .nav-menu summary:hover { color: #fff; background: rgba(141, 162, 255, 0.28); }
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; cursor: pointer; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  background: var(--topbar); border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px; padding: 6px; min-width: 220px;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.nav-panel a { display: block; font-family: var(--mono); font-size: 0.78rem; }
.nav-empty { color: var(--topbar-ink); font-size: 0.78rem; padding: 4px 10px; }
.notice-bar {
  background: var(--warn-soft); color: var(--warn); font-size: 0.82rem; font-weight: 600;
  padding: 7px 24px; border-bottom: 1px solid var(--line);
}
.notice-bar a { color: inherit; }
.notice-bar code { background: rgba(0, 0, 0, 0.06); }

/* ---- generic pieces ---- */
.domain { font-family: var(--mono); font-size: 0.9rem; font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.ok { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.none { background: var(--line); }
.stat-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.stat b { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; display: block; letter-spacing: -0.02em; }
.stat small { color: var(--muted); font-size: 0.7rem; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  background: var(--code-bg); color: var(--muted); font-variant-numeric: tabular-nums;
  max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: none;
}
.chip.mono { font-family: var(--mono); max-width: 60ch; }
.chip.ai, .chip.src { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.impact { background: var(--good-soft); color: var(--good); }
.chip.effort.e-S { background: var(--code-bg); color: var(--muted); }
.chip.effort.e-M { background: var(--warn-soft); color: var(--warn); }
.chip.effort.e-L { background: var(--bad-soft); color: var(--bad); }
.chip.tag { background: var(--code-bg); color: var(--muted); }
.chip.commented { background: var(--good-soft); color: var(--good); }

.delta { font-variant-numeric: tabular-nums; font-weight: 700; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

.statline { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.statline b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ai-badge { color: var(--accent); }

.probe-line { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.pill { font-size: 0.7rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--code-bg); color: var(--muted); }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
table.slim { max-width: 480px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.bare { border: 0; max-width: none; }
table.bare td { padding: 4px 0; font-size: 0.8rem; }
table.bare td.mono { padding-left: 12px; color: var(--muted); }
th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); text-align: left; }
th, td { padding: 7px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td { font-variant-numeric: tabular-nums; }
td.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bad-text { color: var(--bad); font-weight: 700; }
.empty, .sub { color: var(--muted); font-size: 0.85rem; }
.flash { background: var(--good-soft); color: var(--good); font-weight: 600; font-size: 0.85rem; padding: 8px 14px; border-radius: 8px; }

footer { max-width: 1480px; margin: 0 auto; padding: 16px 24px 40px; color: var(--muted); font-size: 0.75rem; border-top: 1px solid var(--line); }
footer .foot-ver { font-weight: 600; color: var(--ink); }
footer .foot-upd { background: var(--warn-soft); color: var(--warn); border-radius: 5px; padding: 1px 7px; font-weight: 600; }
footer .foot-upd code { background: rgba(0,0,0,0.06); color: inherit; }
footer .foot-upd a { color: inherit; text-decoration: underline; }

/* ---- buttons + inline forms ---- */
.btn {
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 8px; padding: 7px 14px;
}
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-quiet:hover { color: var(--bad); border-color: var(--bad); filter: none; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"] {
  font: inherit; font-size: 0.82rem; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; flex: 1; min-width: 200px;
}
.modal-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.modal-note { margin-top: 16px !important; color: var(--muted); font-size: 0.8rem !important; }

/* ---- insights ---- */
.insights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; margin: 18px 0 8px; }
.insight { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; min-width: 0; }
.insight-why { margin-top: 8px; }
.insight-why > summary { cursor: pointer; list-style: none; font-size: 0.75rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em; }
.insight-why > summary::-webkit-details-marker { display: none; }
.insight-why > summary::after { content: " ▸"; }
.insight-why[open] > summary::after { content: " ▾"; }
.insight-why p { margin: 8px 0 0; }
.tile-body { padding: 12px 16px 16px; }
.insight.v-deprioritize { opacity: 0.85; }
.insight-verdict { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.insight.v-warning .insight-verdict { color: var(--warn); }
.insight.v-momentum .insight-verdict { color: var(--good); }
.insight.v-deprioritize .insight-verdict { color: var(--muted); }
.insight h3 { margin: 4px 0 8px; font-size: 1.05rem; font-weight: 700; }
.insight p { margin: 0 0 8px; font-size: 0.88rem; max-width: 90ch; color: var(--muted); }
.insight-move { color: var(--ink) !important; font-weight: 600; }

/* ---- strips / rows ---- */
.strip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.strip-head h2 { margin: 0.4em 0; }
.action-strip { border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.wb .action-strip { background: transparent; }
.strip-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.strip-row:last-child { border-bottom: 0; }
.strip-row:hover { background: var(--accent-soft); }
.strip-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; min-width: 0; flex-shrink: 1; }

/* ---- action queue: grid of clickable cards + detail modals ---- */
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.action {
  appearance: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; width: 100%;
  display: flex; flex-direction: column; gap: 7px;
  transition: border-color 0.15s;
}
.action:hover { border-color: var(--accent); }
.action-head { display: flex; align-items: center; gap: 6px; }
.rank {
  font-family: var(--mono); font-size: 0.72rem; color: #fff;
  background: var(--accent); border-radius: 99px; padding: 1px 8px; font-weight: 700;
}
@media all { .rank { color: #0f1115; } }
.action-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; letter-spacing: -0.01em; }
.action-kind { color: var(--accent); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.action-why { color: var(--muted); font-size: 0.8rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.action-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.action-host { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.spacer { flex: 1; }
.details-link { color: var(--accent); font-size: 0.75rem; font-weight: 700; }
.action-watching { color: var(--muted); font-size: 0.8rem; font-style: italic; }
.proposal { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.proposal .action { flex: 1; }
.proposal-accept { display: flex; justify-content: flex-end; }

.action-modal {
  max-width: 640px; width: calc(100vw - 40px); max-height: 88vh; overflow-y: auto;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px;
}
.action-modal::backdrop { background: rgba(15, 17, 21, 0.6); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h3 { margin: 2px 0 0; font-size: 1.15rem; font-weight: 800; }
.close { appearance: none; border: 0; background: var(--code-bg); color: var(--muted); border-radius: 99px; width: 28px; height: 28px; cursor: pointer; font-size: 0.85rem; }
.close:hover { background: var(--accent); color: #fff; }
.modal-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.action-modal h4 { margin: 16px 0 4px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--accent); }
.action-modal p { margin: 0; font-size: 0.88rem; }
.spec { margin: 4px 0 0; padding-left: 18px; }
.spec li { font-size: 0.85rem; margin-bottom: 6px; }

/* ---- digest briefings ---- */
.hn-item { border-bottom: 1px solid var(--line); }
.hn-item:last-child { border-bottom: 0; }
.hn-item summary { list-style: none; cursor: pointer; }
.hn-item summary::-webkit-details-marker { display: none; }
.hn-item[open] > summary { background: var(--accent-soft); }
.hn-brief { padding: 4px 16px 12px 34px; }
.hn-brief p { margin: 0 0 7px; font-size: 0.84rem; color: var(--muted); max-width: 85ch; }
.brief-label { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); margin-right: 6px; }
.brief-note { font-style: italic; font-size: 0.75rem !important; }
.why { font-size: 0.76rem; color: var(--muted); }

/* ---- actions: search + watching rows ---- */
.search-box {
  font: inherit; font-size: 0.85rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; min-width: 280px;
}
.search-box:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.watch-list { margin-top: 4px; }
.watch-row {
  appearance: none; font: inherit; text-align: left; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; color: var(--muted); background: transparent; border: 0;
  border-bottom: 1px solid var(--line); font-size: 0.85rem;
}
.watch-row:last-child { border-bottom: 0; }
.watch-row:hover { background: var(--accent-soft); }
.watch-row .strip-title { color: var(--ink); font-weight: 600; }
.watch-note { font-style: italic; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }

/* ---- logs ---- */
.log-day { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin-bottom: 12px; }
.log-day h2 { margin: 4px 0 8px; text-transform: none; letter-spacing: 0; font-size: 0.95rem; }
.log-lines { margin: 0; padding-left: 18px; }
.log-lines li { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.log-lines li.log-alert { color: var(--bad); font-weight: 700; }
.ops-log { margin: 0; padding: 14px 16px; font-family: var(--mono); font-size: 0.75rem; line-height: 1.5; white-space: pre-wrap; color: var(--muted); }

/* ---- trends: unified grid (charts + heatmap share geometry) ---- */
.range-picker { display: flex; gap: 4px; }
.range-picker a { font-size: 0.8rem; font-weight: 700; text-decoration: none; color: var(--muted); padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); }
.range-picker a.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
/* The portfolio summary sits above the per-site tiles and is never collapsed. */
.trend-portfolio { margin-bottom: 18px; }
.trend-portfolio > .tg-label .chart-title { font-size: 0.8rem; color: var(--ink); }

.trend-tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.trend-tile > summary { display: flex; align-items: center; gap: 14px; padding: 13px 18px; cursor: pointer; list-style: none; }
.trend-tile > summary::-webkit-details-marker { display: none; }
.trend-tile > summary:hover { background: var(--accent-soft); }
.trend-tile[open] > summary { border-bottom: 1px solid var(--line); }
.trend-tile[open] > summary .details-link::after { content: " ▾"; }
.trend-tile:not([open]) > summary .details-link::after { content: " ▸"; }
.trend-spark { width: 120px; height: 28px; flex-shrink: 0; }
.trend-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.trend-tile .trend-grid { border: 0; border-radius: 0; }
.trend-grid {
  display: grid; grid-template-columns: 230px 1fr; gap: 2px 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  overflow-x: auto;
}
.tg-label { min-width: 0; }
.chart-title { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.chart-stats { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-stats b { color: var(--ink); }
.tg-plot svg { width: 100%; height: 96px; display: block; }
.tg-plot .grid, .tg-plot .axis { stroke: var(--line); stroke-width: 1; }
.tg-plot .area-fill { fill: rgba(var(--heat), 0.14); }
.tg-plot .area-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.tg-plot .hover-col { fill: transparent; }
.tg-plot .hover-col:hover, .tg-plot .hover-col.day-hi { fill: rgba(var(--heat), 0.16); }
.chart-note { font-size: 0.7rem; color: var(--muted); font-style: italic; }

/* stacked source bands + legend */
.stack-band { stroke: none; }
.stack-band.grp-ai-assistants { fill: var(--grp-ai); }
.stack-band.grp-search { fill: var(--grp-search); }
.stack-band.grp-direct { fill: var(--grp-direct); }
.stack-band.grp-referral { fill: var(--grp-referral); }
.stack-band.grp-social { fill: var(--grp-social); }
.stack-band.grp-other { fill: var(--grp-other); }
.src-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
.src-key { font-size: 0.7rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.src-key b { color: var(--ink); font-variant-numeric: tabular-nums; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.swatch.grp-ai-assistants { background: var(--grp-ai); }
.swatch.grp-search { background: var(--grp-search); }
.swatch.grp-direct { background: var(--grp-direct); }
.swatch.grp-referral { background: var(--grp-referral); }
.swatch.grp-social { background: var(--grp-social); }
.swatch.grp-other { background: var(--grp-other); }
/* the AI line runs on its own axis, in the AI group's colour */
.tg-plot.tone-ai .area-line { stroke: var(--grp-ai); }
.tg-plot.tone-ai .area-fill { fill: var(--grp-ai); opacity: 0.16; }

.tg-months { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.tg-months span { font-size: 9px; color: var(--muted); font-family: var(--mono); overflow: visible; white-space: nowrap; }
.tg-cells { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; }
.hm-label { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.hm-cell { height: 12px; border-radius: 2px; position: relative; min-width: 3px; }
.hm-cell:hover, .hm-cell.day-hi { outline: 2px solid var(--accent); outline-offset: 0; z-index: 5; }
.hm-tip {
  display: none; position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--topbar); color: #fff; font-size: 0.72rem;
  padding: 5px 9px; border-radius: 6px; z-index: 20; border: 1px solid rgba(255, 255, 255, 0.18);
  width: max-content; max-width: 260px; white-space: normal; text-align: left;
}
.hm-cell:hover .hm-tip { display: block; }
.hm-cell:nth-child(-n+10) .hm-tip { left: 0; right: auto; transform: none; }
.hm-cell:nth-last-child(-n+10) .hm-tip { left: auto; right: 0; transform: none; }
.trend-empty { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--muted); flex-wrap: wrap; }
.trend-empty-note { font-size: 0.8rem; }

/* ---- site page: wide tables beside narrow lists ----
   The query tables need room for five numeric columns; AI sources are a name
   and a number. Giving both the full width wasted most of the screen. */
.site-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 0 28px; align-items: start; }
.site-cols > * { min-width: 0; }
.site-col-side .mini-list { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mini-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 0.83rem; }
.mini-row:last-child { border-bottom: 0; }
.mini-row b { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.mini-row .trunc { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .site-cols { grid-template-columns: 1fr; gap: 0; } }

/* ---- in-app markdown docs ---- */
.doc-body h3 { font-size: 1rem; margin: 1.4em 0 0.4em; text-transform: none; letter-spacing: 0; }
.doc-body h4 { font-size: 0.9rem; margin: 1.1em 0 0.3em; color: var(--accent); }
.doc-body p, .doc-body li { font-size: 0.86rem; color: var(--muted); max-width: 95ch; }
.doc-body .md-list { margin: 0.3em 0; padding-left: 20px; }

/* ---- campaign presentation ---- */
.or-h { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 1.6em 0 0.6em; }
.or-h small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.or-plan { cursor: default; }
.or-note { font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34%; }
.or-plan:hover .or-note { white-space: normal; max-width: 40%; }
.email-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.email-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.email-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 16px; }
.email-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.email-meta span { opacity: 0.7; }
.email-subject { font-weight: 700; font-size: 0.9rem; margin-top: 6px; }
.email-body { margin: 0; padding: 14px 16px; font-family: inherit; font-size: 0.84rem; line-height: 1.6; color: var(--ink); white-space: pre-wrap; }
.or-table td { font-size: 0.8rem; vertical-align: top; }
.or-cell { max-width: 260px; }

/* ---- content workbench: numbered pipeline sections ---- */
.wb-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 14px 0 6px; }
.wb-nav a {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; text-decoration: none; color: var(--ink); font-size: 0.85rem; font-weight: 700;
}
.wb-nav a:hover { border-color: var(--accent); }
.wb-nav a small { color: var(--muted); font-weight: 500; font-size: 0.72rem; }
.wb-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff; font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
}
@media all { .wb-num { color: #0f1115; } }
.wb { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px 22px; margin-top: 20px; }
.wb-head { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 4px; }
.wb-head .wb-num { margin-top: 4px; width: 26px; height: 26px; font-size: 0.85rem; }
.wb-head h2 { margin: 0; font-size: 1.15rem; text-transform: none; letter-spacing: -0.01em; }
.wb-head .sub { margin: 6px 0 0; max-width: 95ch; }
.wb-sub { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink); margin: 1.8em 0 0.4em; }
.wb-sub small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.wb-fold { border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-top: 14px; }
.wb-fold > summary { cursor: pointer; list-style: none; padding: 11px 16px; font-weight: 700; font-size: 0.88rem; }
.wb-fold > summary::-webkit-details-marker { display: none; }
.wb-fold > summary::before { content: "▸ "; color: var(--accent); }
.wb-fold[open] > summary::before { content: "▾ "; }
.wb-fold > summary small { font-weight: 500; color: var(--muted); }
.wb-fold > *:not(summary) { margin: 0 16px 14px; }
.wb-fold .email-grid { margin-top: 4px; }

/* ---- drafts ---- */
.copy-btn { font: inherit; font-size: 0.72rem; font-weight: 700; cursor: pointer; background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 99px; padding: 3px 12px; }
.copy-btn:hover { background: var(--accent); color: #fff; }
.draft-body { max-height: 480px; overflow-y: auto; }
.draft-row { align-items: center; gap: 12px; padding: 12px 14px; }
.draft-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex-shrink: 1; max-width: 58%; }
.draft-row-title { font-weight: 700; }
.draft-row-action { font-size: 0.78rem; color: var(--muted); }
.chip.ch-devto { background: rgba(108, 65, 240, 0.14); color: var(--purple); }
.chip.ch-github { background: var(--code-bg); color: var(--ink); }
.chip.ch-linkedin { background: rgba(10, 102, 194, 0.14); color: #0a66c2; }
.chip.ch-reddit { background: rgba(255, 69, 0, 0.14); color: #c63d00; }
.chip.ch-hackernews, .chip.ch-hn { background: var(--warn-soft); color: var(--warn); }
@media all {
  .chip.ch-linkedin { color: #7ab8ff; background: rgba(10, 102, 194, 0.3); }
  .chip.ch-reddit { color: #ff8a5e; background: rgba(255, 69, 0, 0.25); }
}
.crumb { margin: 4px 0 10px; font-size: 0.85rem; }
.crumb a { text-decoration: none; font-weight: 600; }
.draft-title { max-width: 34ch; line-height: 1.25; }
.draft-todo { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 14px 0 18px; max-width: 860px; }
.draft-todo h2 { margin: 0 0 6px; }
.draft-todo-action { margin: 0 0 6px; font-weight: 600; }
.draft-page-body { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-width: 860px; }
.draft-body-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 0.85rem; }
.draft-body-head small { color: var(--muted); font-weight: 500; }
.draft-page-body .draft-body { max-height: none; }

/* ---- reddit hunt chips + campaign summary ---- */
.hunt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hunt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 14px; text-decoration: none; color: var(--accent); font-size: 0.83rem; font-weight: 700;
}
.hunt-chip:hover { border-color: var(--accent); }
.hunt-go { font-weight: 700; }
.campaign-sum { max-width: 760px; flex-direction: row; align-items: center; justify-content: space-between; margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-top: 0; }
.campaign-sum:last-child { border-bottom: 0; }

/* ---- scan panel + conversions ---- */
.scan-panel { border: 1px dashed var(--accent); border-radius: 12px; padding: 12px 18px 16px; margin-bottom: 20px; }
.scan-panel h2 { margin-top: 4px; }
.funnel-panel { margin-top: 22px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.funnel-panel h2 { margin: 0; }
.funnel-panel .stat-row { margin-top: 8px; }
.funnel-line { color: var(--muted); font-size: 0.85rem; margin: 18px 0 0; }
.funnel-line b { color: var(--ink); }

/* ---- overview: hero + Today board ---- */
.ov-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ov-hero h1 { margin-bottom: 0.2em; }
.ov-hero .sub { margin: 0 0 6px; }
.ov-status { align-items: center; padding-bottom: 10px; }
.ov-status .chip { padding: 5px 12px; }
.today-grid { columns: 250px; column-gap: 18px; margin-top: 10px; }
.today-col { min-width: 0; break-inside: avoid; margin-bottom: 22px; }
.today-verb { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.today-count { font-family: var(--mono); font-size: 0.68rem; font-weight: 700; background: var(--code-bg); color: var(--muted); border-radius: 99px; padding: 0 7px; }
.v-fix .today-verb { color: var(--bad); }
.v-approve .today-verb { color: var(--warn); }
.v-publish .today-verb { color: var(--accent); }
.v-comment .today-verb { color: var(--purple); }
.v-ship .today-verb { color: var(--good); }
.today-blurb { margin: 0 0 8px; font-size: 0.74rem; color: var(--muted); }
.today-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; margin-bottom: 8px; text-decoration: none; color: var(--ink);
  transition: border-color 0.15s;
}
.today-item:hover { border-color: var(--accent); }
.today-title { font-size: 0.83rem; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.today-item .chip { flex-shrink: 0; }
.today-more { font-size: 0.78rem; font-weight: 700; text-decoration: none; }

/* ---- compact portfolio strip ---- */
.p-row {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: minmax(170px, 1.3fr) 14px 1fr 0.8fr 1.2fr 0.6fr 0.7fr 24px;
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 0.85rem;
}
.p-row:last-child { border-bottom: 0; }
.p-row:hover { background: var(--accent-soft); }
.p-row.p-head { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; background: transparent; }
.p-num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---- indexing ---- */
.idx-host { margin: 26px 0 0; }
.idx-host h2 { margin: 0 0 8px; font-size: 1rem; }
.idx-host h2 small { font-weight: 400; color: var(--muted); margin-left: 8px; }
.idx-group td { background: var(--panel); padding-top: 14px; }
.idx-help { color: var(--muted); font-size: 0.82rem; margin-left: 8px; }
.idx-stale { color: var(--muted); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.idx-sitemap { margin: -4px 0 8px; font-size: 0.78rem; color: var(--muted); }
.idx-fix { margin: 6px 0 2px 8px; font-size: 0.8rem; color: var(--muted); line-height: 1.55; max-width: 96ch; }
.idx-ri { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 4px; padding: 1px 6px; margin-right: 4px; white-space: nowrap; }
.idx-ri.yes { background: var(--good-soft); color: var(--good); }
.idx-ri.no { background: var(--bad-soft); color: var(--bad); }

/* ---- settings ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.s-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.s-card.s-on { border-color: var(--accent); }
.s-card .sub { margin: 0; }
.s-wide { margin-top: 4px; }
.s-title { font-weight: 700; font-size: 0.92rem; }
.s-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.s-toggle input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.s-needs { margin: 0; font-size: 0.75rem; color: var(--warn); font-weight: 600; }
.s-help { margin: 0; font-size: 0.75rem; color: var(--muted); }
.s-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-top: 4px; flex: 1; }
.s-field small { font-weight: 500; }
.s-field input[type="text"], .prio-notes { list-style: none; margin: 8px 0 0; padding: 8px 12px; background: var(--warn-soft); border-radius: 8px; }
.prio-notes li { font-size: 0.78rem; color: var(--warn); line-height: 1.5; }

.prof-princ { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--muted); }
.prof-princ .chip { font-size: 0.62rem; }
.princ { margin: 14px 0 0; }
.princ-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 12px 16px 16px; }
.princ-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.princ-item.hard { border-color: var(--bad-soft); }
.princ-h { display: flex; align-items: baseline; gap: 7px; font-size: 0.86rem; margin-bottom: 5px; }
/* .chip ellipsizes at 34ch, and as a flex item it shrinks below that —
   which turned "hard" into "h…". It is a two-word label; never shrink it. */
.princ-h .chip { flex: none; }
.princ-item p { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.55; }

.prof-diff { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.prof-diff li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 0.76rem; }
.prof-diff .mono { flex: 1 1 100%; color: var(--muted); }
.prof-was { font-family: var(--mono); color: var(--muted); text-decoration: line-through; }
.prof-now { font-family: var(--mono); font-weight: 700; color: var(--accent); }

.s-field textarea {
  font: inherit; font-size: 0.84rem; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; width: 100%; font-weight: 400;
}
.s-field textarea { font-family: var(--mono); font-size: 0.78rem; resize: vertical; min-height: 64px; }
.s-field input:focus, .s-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.s-row { display: flex; gap: 14px; flex-wrap: wrap; }
.s-save { display: flex; align-items: center; gap: 14px; margin: 22px 0 8px; position: sticky; bottom: 0; background: var(--ground); padding: 12px 0; border-top: 1px solid var(--line); }

/* ---- responsive: phones and small tablets ---- */
@media (max-width: 720px) {
  main { padding: 18px 14px 56px; }
  footer { padding: 14px 14px 32px; }
  h1 { font-size: 1.45rem; }
  h2 { margin: 1.6em 0 0.5em; }
  .topbar { gap: 10px; padding: 10px 14px; position: relative; }
  .topbar nav { gap: 2px; }
  .topbar nav a, .nav-menu summary { padding: 7px 11px; }
  .brand-sub { display: none; }
  .nav-menu { position: static; }
  .nav-panel { position: absolute; top: 100%; left: 12px; right: 12px; width: auto; min-width: 0; max-width: none; margin-top: 6px; }
  .strip-head { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .search-box { min-width: 0; width: 100%; padding: 9px 12px; }
  .actions, .email-grid, .settings-grid { grid-template-columns: 1fr; }
  .actions > * { min-width: 0; }
  .action-title, .action-why, .action-watching { overflow-wrap: anywhere; }
  .action-foot, .action-head { flex-wrap: wrap; }
  .tg-cells { gap: 1px; }
  .hm-cell { min-width: 2px; }
  /* the summary row squeezed its chips down to "~2…" at phone widths */
  .trend-tile > summary { flex-wrap: wrap; gap: 6px 10px; padding: 11px 12px; }
  .trend-tile > summary .domain { width: 100%; }
  .trend-tile > summary .spacer { display: none; }
  .trend-spark { width: 96px; }
  .src-legend { gap: 2px 8px; }
  .trend-grid { grid-template-columns: 1fr; gap: 0; padding: 12px 12px; }
  .trend-grid > .tg-label:empty { display: none; }
  .trend-grid > .tg-label { padding: 10px 0 4px; }
  .hm-label { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; padding-right: 0; }
  .tg-plot svg { height: 82px; }
  .hm-tip { max-width: min(240px, calc(100vw - 48px)); }
  .strip-row, .watch-row { padding: 11px 12px; }
  .strip-title { max-width: none; }
  .watch-row { flex-wrap: wrap; }
  .watch-note { max-width: 100%; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .p-row { grid-template-columns: minmax(120px, 1.4fr) 10px 1fr 0.9fr 18px; }
  .p-row > :nth-child(5), .p-row > :nth-child(6), .p-row > :nth-child(7) { display: none; }
  table.slim { max-width: 100%; }
  td.trunc { max-width: 200px; }
  th, td { padding: 7px 10px; }
  .action-modal { width: calc(100vw - 24px); padding: 18px 16px; }
  .close { width: 34px; height: 34px; }
  .hn-brief { padding: 4px 14px 12px 16px; }
  .log-day { padding: 12px 14px; }
  .stat-row { gap: 16px; }
  .insight { padding: 14px 15px; }
  .campaign-sum { flex-direction: column; align-items: flex-start; }
}

/* Sign-out link injected into the static export when the mirror sits behind
   an auth proxy (modules.staticExport.signOutUrl). Absent on the live
   dashboard, so it only ever renders in the topbar of an exported page. */
.signout {
  margin-left: auto; color: var(--topbar-ink); text-decoration: none;
  font-size: 0.8rem; font-weight: 600; padding: 5px 11px; border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.18); white-space: nowrap;
}
.signout:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

/* Checkbox rows in Settings (publish: delete / dry run). */
.s-check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); margin-top: 8px; }
.s-check input { margin: 0; }
