/* TrendPDF — "Signal desk" console.
   Monospace-forward, phosphor-amber on slate. A dense operator's instrument,
   not a marketing dashboard. Deliberately avoids the AI-default looks. */

:root {
  --ink: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --line: #2a333f;
  --line-soft: #212a34;
  --text: #e6edf3;
  --muted: #8b98a9;
  --faint: #5b6673;

  --signal: #f2a63b;         /* the one signature accent */
  --signal-dim: #7a5a24;
  --ok: #3fb950;
  --fail: #f85149;
  --info: #58a6ff;

  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --rail-w: 208px;
  --radius: 4px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand .mark {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.brand .mark b { color: var(--signal); }
.brand .tag {
  font-size: 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.01em;
}
.nav a .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--faint);
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav a.active .dot { background: var(--signal); box-shadow: 0 0 8px var(--signal); }
.nav a.disabled { opacity: 0.4; pointer-events: none; }
.nav a.disabled::after {
  content: "soon"; margin-left: auto; font-size: 9px;
  color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em;
}

.rail-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--faint);
  display: flex; align-items: center; justify-content: space-between;
}
.rail-foot form { margin: 0; }

/* --------------------------------------------------------------------- main */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 46px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: linear-gradient(180deg, #12171e, #0e1116);
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumb { font-size: 12px; color: var(--muted); }
.topbar .crumb b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }

.content { padding: 22px; max-width: 1180px; width: 100%; }

/* eyebrow / section labels encode structure, not decoration */
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--faint);
  margin: 0 0 10px;
}
h1.page { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); font-size: 12px; margin: 0 0 22px; }

/* --------------------------------------------------------------------- panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel > .panel-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted);
}
.panel > .panel-body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.split { grid-template-columns: 1.4fr 1fr; }

/* --------------------------------------------------------------------- stats */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .n { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stat .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--faint);
}
.stat .n .unit { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }

/* --------------------------------------------------------------------- tables */
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:hover td { background: var(--panel-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank { color: var(--faint); width: 34px; }
.qtext { color: var(--text); }

/* demand spectrum — the signature data mark */
.spectrum { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.spectrum .bar {
  height: 8px; border-radius: 2px;
  background: linear-gradient(90deg, var(--signal-dim), var(--signal));
  box-shadow: 0 0 6px rgba(242, 166, 59, 0.35);
  min-width: 2px;
}
.spectrum .val { font-variant-numeric: tabular-nums; color: var(--muted); width: 28px; }

/* --------------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(63,185,80,0.4); }
.badge.ok .dot { background: var(--ok); }
.badge.fail { color: var(--fail); border-color: rgba(248,81,73,0.4); }
.badge.fail .dot { background: var(--fail); }
.badge.run { color: var(--signal); border-color: rgba(242,166,59,0.4); }
.badge.run .dot { background: var(--signal); animation: pulse 1.1s ease-in-out infinite; }
.badge.pending { color: var(--info); border-color: rgba(88,166,255,0.35); }
.badge.pending .dot { background: var(--info); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* --------------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--faint); font-family: var(--sans); }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); outline: none; }

/* segmented radio choices for geo / depth */
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 120px;
  text-transform: none; letter-spacing: 0;
  color: var(--muted);
  transition: border-color 0.1s, background 0.1s;
}
.segmented label .opt { font-size: 12px; color: var(--text); }
.segmented label .meta { font-size: 10px; color: var(--faint); font-family: var(--sans); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) {
  border-color: var(--signal);
  background: rgba(242, 166, 59, 0.08);
}
.segmented label:has(input:checked) .opt { color: var(--signal); }

.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
}
.btn:hover { border-color: var(--muted); }
.btn.primary {
  background: var(--signal);
  border-color: var(--signal);
  color: #1a1204;
  font-weight: 700;
}
.btn.primary:hover { background: #ffb84d; text-decoration: none; }
.btn.ghost { background: transparent; }
.btn-link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--mono); font-size: 11px; padding: 0;
}
.btn-link:hover { color: var(--signal); }

.actions { display: flex; gap: 10px; align-items: center; }

/* --------------------------------------------------------------------- progress */
.progress-track {
  height: 10px; background: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--signal-dim), var(--signal));
  box-shadow: 0 0 10px rgba(242, 166, 59, 0.5);
  transition: width 0.4s ease;
}
.progress-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--muted); }

/* live harvest log — the ticker feed */
.ticker {
  background: #0a0d12;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  height: 340px;
  overflow-y: auto;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.ticker .line { color: var(--muted); }
.ticker .line .ts { color: var(--faint); }
.cursor::after {
  content: "▌";
  color: var(--signal);
  animation: blink 1s steps(2) infinite;
  margin-left: 2px;
}
@keyframes blink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }

/* source health */
.sources { display: flex; flex-direction: column; gap: 10px; }
.source-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--panel-2);
}
.source-row .meta { font-size: 11px; color: var(--faint); font-family: var(--sans); }
.source-row .errs { color: var(--fail); font-size: 10px; margin-top: 4px; }

/* --------------------------------------------------------------------- misc */
.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.empty .big { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.empty .cta { margin-top: 16px; }

.callout {
  border-left: 2px solid var(--signal);
  background: rgba(242, 166, 59, 0.06);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--sans); font-size: 12px; color: var(--muted);
}
.callout.warn { border-left-color: var(--fail); background: rgba(248, 81, 73, 0.06); }

.prose { font-family: var(--sans); color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.spacer-lg { height: 22px; }

/* --------------------------------------------------------------------- login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(242,166,59,0.10), transparent 60%),
    var(--ink);
}
.login-card {
  width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 28px;
}
.login-card .brand { border: none; padding: 0 0 18px; }
.login-card .err {
  color: var(--fail); font-size: 12px; margin: -6px 0 12px;
}

/* --------------------------------------------------------------------- responsive */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { border-top: none; }
  .grid.cols-3, .grid.cols-4, .grid.split { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) and (min-width: 821px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------- phase 2 */

/* momentum badges */
.badge.mom-rising { color: var(--ok); border-color: rgba(63,185,80,0.4); }
.badge.mom-rising .dot { background: var(--ok); }
.badge.mom-declining { color: var(--fail); border-color: rgba(248,81,73,0.4); }
.badge.mom-declining .dot { background: var(--fail); }
.badge.mom-flat { color: var(--muted); }
.badge.mom-flat .dot { background: var(--muted); }
.badge.mom-unknown { color: var(--faint); }
.badge.mom-unknown .dot { background: var(--faint); }

/* score value + stacked component bar */
.scorewrap { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.scoreval { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.scorebar { display: flex; height: 7px; border-radius: 3px; overflow: hidden; background: var(--ink); width: 120px; }
.scorebar .seg { height: 100%; }
.seg-demand { background: #f2a63b; }
.seg-momentum { background: #58a6ff; }
.seg-specificity { background: #4cc9b0; }
.seg-monetisability { background: #b57edc; }
.seg-openness { background: #d0d7de; }
.seg-chip { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* breakdown table */
table.data.breakdown td, table.data.breakdown th { font-variant-numeric: tabular-nums; }

/* source grid on run page */
.source-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 820px) { .source-grid { grid-template-columns: 1fr; } }

/* key/value rows */
.kv { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv > span:first-child { color: var(--muted); font-size: 12px; }
.ok-text { color: var(--ok); }

/* reddit evidence */
.reddit-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.reddit-post { display: block; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel-2); }
.reddit-post:hover { border-color: var(--muted); text-decoration: none; }
.rp-title { color: var(--text); font-family: var(--sans); font-size: 12.5px; margin-bottom: 3px; }

/* details/summary panels */
details.panel > summary { outline: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel[open] > summary { border-bottom: 1px solid var(--line-soft); }

/* manual */
.manual-grid { grid-template-columns: 210px 1fr; align-items: start; }
@media (max-width: 820px) { .manual-grid { grid-template-columns: 1fr; } }
.manual-toc { position: sticky; top: 62px; }
.manual-nav { display: flex; flex-direction: column; padding: 8px; }
.manual-nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--muted); font-size: 12px; }
.manual-nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.manual-nav a.active { background: var(--panel-2); color: var(--signal); }

.manual-body { font-family: var(--sans); color: var(--text); line-height: 1.65; max-width: 760px; }
.manual-body h1, .manual-body h2, .manual-body h3 { font-family: var(--mono); letter-spacing: -0.01em; margin: 1.6em 0 0.5em; }
.manual-body h1 { font-size: 22px; margin-top: 0; }
.manual-body h2 { font-size: 17px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.manual-body h3 { font-size: 14px; color: var(--signal); }
.manual-body p, .manual-body li { color: var(--text); }
.manual-body a { color: var(--signal); }
.manual-body code { font-family: var(--mono); background: var(--ink); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
.manual-body pre { background: #0a0d12; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow-x: auto; }
.manual-body pre code { border: none; background: none; padding: 0; }
.manual-body table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 13px; }
.manual-body th, .manual-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.manual-body th { background: var(--panel-2); color: var(--muted); }
.manual-body blockquote { border-left: 2px solid var(--signal); margin: 1em 0; padding: 6px 14px; background: rgba(242,166,59,0.06); color: var(--muted); }
.manual-body ul, .manual-body ol { padding-left: 22px; }

/* --------------------------------------------------------------------- phase 3 */

/* theme picker swatches */
.theme-pick label { padding-top: 8px; }
.swatch { display: block; width: 100%; height: 26px; border-radius: 3px; margin-bottom: 6px; border: 1px solid var(--line); }
.sw-editorial { background: linear-gradient(105deg, #111114 60%, #d81e2c 60%); }
.sw-fieldmanual { background: linear-gradient(#14181c 8px, #f7f5f0 8px); position: relative; }
.sw-fieldmanual::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 6px; height: 3px; background: #e4761b; }
.sw-workbook { background: #fbf8f2; position: relative; }
.sw-workbook::after { content: ""; position: absolute; left: 8px; top: 8px; width: 40%; height: 10px; border-radius: 3px; background: #0e8f7e; }

/* cover thumbnail */
.cover-thumb { width: 150px; border: 1px solid var(--line); border-radius: 3px; box-shadow: 0 4px 18px rgba(0,0,0,0.4); }

/* products grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.product-card { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.product-card:hover { border-color: var(--muted); text-decoration: none; }
.pc-cover { aspect-ratio: 1/1.414; background: #0a0d12; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pc-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.pc-placeholder { color: var(--faint); font-size: 11px; }
.pc-body { padding: 12px; }
.pc-title { color: var(--text); font-size: 12.5px; margin-bottom: 8px; line-height: 1.35; }
.pc-meta { display: flex; align-items: center; justify-content: space-between; }

/* listing pack + copy blocks */
.listing { display: flex; flex-direction: column; gap: 16px; }
.copyblock { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.cb-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--panel-2); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.copybtn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 3px; font-family: var(--mono); font-size: 10px; padding: 2px 8px; cursor: pointer; text-transform: uppercase; }
.copybtn:hover { border-color: var(--signal); color: var(--signal); }
.copyblock > div:not(.cb-head), .copyblock > p, .copyblock > ul { padding: 12px; margin: 0; }
.copyblock .ci { padding: 4px 0; color: var(--text); font-family: var(--sans); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 11px; color: var(--muted); }

/* searchable model picker */
.model-picker { position: relative; }
.model-picker .mp-search { width: 100%; }
.mp-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 320px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--signal); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.mp-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft);
}
.mp-opt:hover { background: var(--panel-2); }
.mp-opt .mp-id { color: var(--text); font-size: 12px; word-break: break-all; }
.mp-opt .mp-price { color: var(--faint); font-size: 10.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mp-empty { padding: 12px; color: var(--faint); font-size: 12px; }

/* real monthly volume figure */
.vol { color: var(--ok); font-weight: 600; font-variant-numeric: tabular-nums; }

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