/* Product Radar: navigation-instrument identity.
   Abyss sidebar, chart-paper ground, one bold colour: signal brass. */
:root {
  --abyss: #0C1B2A;          /* sidebar, headings */
  --abyss-2: #132A40;        /* sidebar hover / raised */
  --abyss-line: #22394F;
  --brass: #E0A526;          /* identity: signal, primary action, active */
  --brass-ink: #3A2A05;      /* text on brass */
  --brass-soft: rgba(224, 165, 38, .16);
  --ground: #EDF0F3;         /* chart paper */
  --surface: #FFFFFF;
  --raised: #F6F8FA;
  --ink: #0C1B2A;
  --muted: #56677A;
  --faint: #8A98A8;
  --line: #D8DEE5;
  --link: #1D4E89;
  --photo: #FFFFFF;
  --emerging: #3F7FCC; --rising: #1F8F5F; --peaking: #D9731F; --saturated: #C23A33; --steady: #6A7888; --catalogue: #9AA6B2;
  --good: #1F8F5F; --warn: #D9731F; --bad: #C23A33;
  --lift: 0 1px 2px rgba(12, 27, 42, .06), 0 12px 32px rgba(12, 27, 42, .08);
  --font: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --side-w: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #0A1520; --surface: #0F1E2D; --raised: #13263A; --ink: #E4EAF0; --muted: #93A3B4; --faint: #64768A;
    --line: #1E3247; --link: #8EB8F0; --photo: #EEF2F5; --brass-soft: rgba(224, 165, 38, .18);
    --emerging: #6FA3E8; --rising: #48B886; --peaking: #EE9449; --saturated: #E76A62; --steady: #93A3B4; --catalogue: #5E7185;
    --good: #48B886; --warn: #EE9449; --bad: #E76A62;
    --lift: 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--ink); font: 400 14px/1.5 var(--font); }
/* tabular figures only where numbers line up; this face widens punctuation under tnum */
.fig, .rank, .count, .headline-num, .statline b, table.t td.n, .kv dd, .tile .stats, .rk { font-variant-numeric: tabular-nums; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button { font: inherit; color: inherit; }
input, select, textarea {
  font: 500 13px/1.25 var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brass); outline: none; box-shadow: 0 0 0 3px var(--brass-soft); }
.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100%; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--abyss); color: #C9D5E1; display: flex; flex-direction: column; gap: 18px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
}
.mark { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em; padding: 4px 8px; }
.mark svg { flex: none; }
.navgroup { display: grid; gap: 2px; }
.navgroup h4 { margin: 0 8px 4px; font-size: 12px; font-weight: 500; color: #6F8499; }
.side a.nav {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #C9D5E1;
  font-weight: 500; position: relative; text-decoration: none;
}
.side a.nav svg { flex: none; opacity: .75; }
.side a.nav:hover { background: var(--abyss-2); color: #fff; }
.side a.nav[aria-current="page"] { background: var(--abyss-2); color: #fff; }
.side a.nav[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.side a.nav[aria-current="page"] svg { opacity: 1; color: var(--brass); }
.side .badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--brass); }
.saved { display: grid; gap: 2px; }
.saved a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; color: #C9D5E1; font-size: 13px; }
.saved a:hover { background: var(--abyss-2); text-decoration: none; }
.saved button { background: none; border: 0; color: #6F8499; cursor: pointer; font-size: 12px; padding: 0 2px; }
.saved .hint { font-size: 12px; color: #6F8499; padding: 0 10px; margin: 0; }
.sidefoot { margin-top: auto; display: grid; gap: 8px; padding: 10px; border-top: 1px solid var(--abyss-line); font-size: 12px; color: #8FA3B7; }
.sidefoot .run { display: flex; gap: 8px; align-items: center; }
.sidefoot button { background: none; border: 0; color: #8FA3B7; cursor: pointer; padding: 0; text-align: left; font-size: 12px; }
.sidefoot button:hover { color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); flex: none; }
.dot.ok { background: #48B886; } .dot.bad { background: #E76A62; }

.main { min-width: 0; padding: 0 20px 48px; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--ground); display: flex; align-items: center; gap: 12px;
          padding: calc(14px + env(safe-area-inset-top, 0px)) 0 12px; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .grow { flex: 1; }
.search { position: relative; width: min(420px, 45vw); }
.search input { width: 100%; padding-left: 34px; padding-right: 44px; background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
kbd { font: 600 11px var(--font); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--muted); background: var(--surface); }
.menubtn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink); }

/* ------------------------------------------------------------------ controls */
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 12px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; padding: 6px 10px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button[aria-pressed="true"] { background: var(--abyss); color: #fff; }
.chip { font: 500 13px/1 var(--font); padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line);
        background: var(--surface); color: var(--muted); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.chip .d { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.controls .spacer { flex: 1; }
.count { color: var(--muted); font-size: 13px; }
.linkish { background: none; border: 0; color: var(--link); cursor: pointer; font-size: 13px; padding: 4px; }

/* ------------------------------------------------------------------ results */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1180px) { .workspace.with-drawer { grid-template-columns: minmax(0, 1fr) minmax(420px, 44%); } }

.table { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.thead, .trow { display: grid; grid-template-columns: 44px 56px minmax(0, 2.4fr) 110px 96px 86px 90px 88px; gap: 12px; align-items: center; padding: 8px 14px; }
.thead { font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); background: var(--raised); }
.thead button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; text-align: left; }
.thead button[aria-sort] { color: var(--ink); font-weight: 600; }
.thead .r, .trow .r { text-align: right; justify-self: end; }
.trow { border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--raised); }
.trow[aria-selected="true"] { background: var(--brass-soft); box-shadow: inset 3px 0 0 var(--brass); }
.rank { display: grid; justify-items: center; gap: 3px; font-weight: 600; font-size: 12px; color: var(--muted); }
.thumb { width: 56px; height: 56px; border-radius: 9px; object-fit: cover; background: var(--photo); border: 1px solid var(--line); display: block; }
.pname { min-width: 0; display: grid; gap: 4px; }
.pname b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.fig { font-size: 13px; }
.fig small { display: block; font-size: 11px; color: var(--muted); }
.up { color: var(--good); font-weight: 600; }
.mobile-only { display: none; }

/* signal meter: score as reception bars */
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.signal i { width: 3px; border-radius: 1px; background: var(--line); }
.signal i:nth-child(1) { height: 4px; } .signal i:nth-child(2) { height: 7px; } .signal i:nth-child(3) { height: 10px; }
.signal i:nth-child(4) { height: 12px; } .signal i:nth-child(5) { height: 14px; }
.signal i.on { background: var(--brass); }

.pill { font: 600 11px/1 var(--font); padding: 4px 8px; border-radius: 999px; color: var(--c);
        background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.tag { font: 500 11px/1 var(--font); padding: 4px 7px; border-radius: 6px; background: var(--raised); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 8%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.tag.brass { color: var(--brass-ink); background: var(--brass); border-color: var(--brass); }

/* grid view */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: grid; }
.tile:hover { border-color: var(--faint); }
.tile[aria-selected="true"] { border-color: var(--brass); box-shadow: 0 0 0 2px var(--brass); }
.tile .ph { aspect-ratio: 1 / 1; max-width: 100%; background: var(--photo); position: relative; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .ph .rk { position: absolute; left: 8px; top: 8px; background: var(--abyss); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 7px; border-radius: 6px; display: flex; gap: 6px; align-items: center; }
.tile .body { padding: 10px 12px 12px; display: grid; gap: 6px; }
.tile .body b { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.tile .stats { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.tile .stats b { color: var(--ink); font-weight: 600; min-height: 0; display: inline; }
.more { display: flex; justify-content: center; padding: 14px; }

/* ------------------------------------------------------------------ drawer / detail */
.drawer { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); min-width: 0; }
@media (min-width: 1180px) { .workspace .drawer { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; } }
.detail { padding: 20px; display: grid; gap: 20px; }
.dhead { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 18px; align-items: start; }
.dhead img { width: 132px; height: 132px; border-radius: 12px; object-fit: contain; background: var(--photo); border: 1px solid var(--line); }
.dhead h2 { margin: 2px 0 6px; font-size: 22px; line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }
.crumb { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.close { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; float: right; }
.decide { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.decide .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.decide button.opt { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 11px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.decide button.opt[aria-pressed="true"] { background: var(--abyss); border-color: var(--abyss); color: #fff; }
.decide button.opt kbd { font-size: 10px; padding: 0 4px; }
.decide textarea { width: 100%; min-height: 40px; resize: vertical; }
.decide .saved-note { font-size: 12px; color: var(--muted); min-height: 1em; }

.section { display: grid; gap: 10px; }
.section > h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section > h3 small { font-weight: 400; font-size: 12px; color: var(--muted); }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.headline-num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.headline-num small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; display: block; margin-top: 4px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.kv .total { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 700; color: var(--ink); }
.note { font-size: 12px; color: var(--muted); margin: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 10px var(--font); fill: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.divider { height: 1px; background: var(--line); }
ul.plain { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.angles { display: grid; gap: 10px; }
.angle { display: grid; gap: 4px; }
.meter { height: 5px; border-radius: 3px; background: var(--raised); border: 1px solid var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brass); }
.hook { font-size: 13px; color: var(--muted); }
.ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ad { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; background: var(--raised); }
.ad .h { font-weight: 600; }
.ad .b { font-size: 12px; color: var(--muted); white-space: pre-line; max-height: 5.4em; overflow: hidden; }
.ad .m { font-size: 12px; color: var(--faint); display: flex; gap: 10px; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th, table.t td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 500; }
table.t td.n, table.t th.n { text-align: right; }
table.t td.wrap { white-space: normal; }

/* ------------------------------------------------------------------ pages */
.page { display: grid; gap: 16px; max-width: 1180px; }
.lede { color: var(--muted); max-width: 70ch; margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.panel h3 { margin: 0; font-size: 15px; }
.statline { display: flex; gap: 22px; flex-wrap: wrap; }
.statline div { display: grid; }
.statline b { font-size: 18px; font-weight: 700; }
.statline span { font-size: 12px; color: var(--muted); }
.btn { font: 600 13px/1 var(--font); padding: 10px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.verdict { font: 600 13px/1.3 var(--font); padding: 8px 11px; border-radius: 8px; }
.verdict.kill { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.verdict.scale { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.verdict.wait { background: var(--raised); color: var(--muted); }
.test { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.fields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.fields input { width: 100%; }
.opgrid { display: grid; gap: 12px; }
.prodstrip { display: flex; gap: 12px; flex-wrap: wrap; }
.prodstrip a { display: flex; gap: 8px; align-items: center; max-width: 260px; color: var(--ink); }
.prodstrip img { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); background: var(--photo); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 36px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 17px; margin: 0 0 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--abyss); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--lift); z-index: 50; }
.keys { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) and (min-width: 821px) {
  :root { --side-w: 68px; }
  .mark span, .side a.nav span, .navgroup h4, .saved, .side .badge, .sidefoot .label { display: none; }
  .side a.nav { justify-content: center; }
  .thead, .trow { grid-template-columns: 40px 52px minmax(0, 2fr) 100px 90px 84px 84px; }
  .thead > :last-child, .trow > :last-child { display: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; }
  body.menu-open .side { transform: none; box-shadow: var(--lift); }
  .menubtn { display: inline-flex; }
  .main { padding: 0 16px 40px; }
  .search { width: auto; flex: 1; }
  .topbar h1 { font-size: 18px; }
  .topbar .sub { display: none; }
  .thead { display: none; }
  .trow { grid-template-columns: 30px 48px minmax(0, 1fr); }
  .trow .thumb { width: 48px; height: 48px; }
  .trow > .c4, .trow > .c5, .trow > .c6, .trow > .c7, .trow > .c8 { display: none; }
  .mobile-only { display: inline !important; }
  .dhead { grid-template-columns: 92px minmax(0, 1fr); }
  .dhead img { width: 92px; height: 92px; }
  .test { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

.headline-num small { font-variant-numeric: normal; }
