/* Printable Trend Radar — dense tool styling.
   Brand fonts only (PRODUCT-GENERATOR-AGENT.md 3.8): Poppins headings,
   Montserrat body. Arial and every system default are banned.
   Colour: one sequential hue for magnitude, reserved status colours for
   verdicts. Verdicts always carry a word, never colour alone. */

@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }

:root {
  --bg:        #f7f6f3;
  --surface:   #ffffff;
  --surface-2: #f1efea;
  --line:      #ded9d0;
  --ink:       #17150f;
  --ink-2:     #4a463d;
  --ink-mute:  #7a7468;

  /* sequential hue — magnitude only */
  --mag-100: #e8dcc8;
  --mag-300: #d0aa62;
  --mag-500: #a97a1e;
  --mag-700: #6d4c07;

  /* reserved status — never reused as a series colour */
  --ok-bg:   #e2efe4; --ok-ink:   #1d5a2c;
  --warn-bg: #fbeeda; --warn-ink: #7a4f06;
  --crit-bg: #fae2e0; --crit-ink: #8a221b;
  --mute-bg: #ecebe7; --mute-ink: #5b564c;

  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14130f;
    --surface:   #1d1b16;
    --surface-2: #262319;
    --line:      #3a352b;
    --ink:       #f4f1e9;
    --ink-2:     #cdc6b6;
    --ink-mute:  #948d7d;
    --mag-100: #3a3120; --mag-300: #7a5c1d; --mag-500: #c39533; --mag-700: #e8c477;
    --ok-bg:   #1c3524; --ok-ink:   #8fd6a3;
    --warn-bg: #3a2c12; --warn-ink: #e5bb6a;
    --crit-bg: #3d1e1a; --crit-ink: #f0a49a;
    --mute-bg: #2a2721; --mute-ink: #a9a294;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Montserrat", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .brand, th {
  font-family: "Poppins", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

a { color: inherit; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------------------------------------------------------------- header */
header.top {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.top-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 16px;
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: baseline;
}
.brand { font-weight: 800; font-size: 17px; text-decoration: none; }
.tagline { color: var(--ink-mute); font-size: 12px; }
.stamp { margin-left: auto; font-size: 11px; color: var(--ink-mute); text-align: right; }
.stamp b { font-weight: 600; color: var(--ink-2); }

nav.niches {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
}
nav.niches ul {
  max-width: 1180px; margin: 0 auto; padding: 6px 16px;
  display: flex; gap: 6px; list-style: none; white-space: nowrap;
}
nav.niches a {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; text-decoration: none; color: var(--ink-2);
  border: 1px solid transparent;
}
nav.niches a:hover { background: var(--surface); border-color: var(--line); }
nav.niches a.here { background: var(--ink); color: var(--bg); font-weight: 600; }

/* ---------------------------------------------------------------- banners */
.unverified {
  margin: 14px 0 0; padding: 8px 12px; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: 12px; border: 1px solid rgba(0,0,0,.06);
}
.stale {
  margin: 12px 0 0; padding: 8px 12px; border-radius: var(--radius);
  background: var(--crit-bg); color: var(--crit-ink); font-size: 12px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; gap: 10px; margin: 16px 0 6px;
         grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.tile .n { font-family: "Poppins", sans-serif; font-weight: 800;
           font-size: 26px; line-height: 1.1; }
.tile .k { font-size: 11px; color: var(--ink-mute); text-transform: uppercase;
           letter-spacing: .06em; margin-top: 2px; }

/* ---------------------------------------------------------------- sections */
section { margin-top: 26px; }
h1 { font-size: 22px; margin: 18px 0 2px; font-weight: 800; }
h2 { font-size: 15px; margin: 0 0 4px; font-weight: 700; }
.sub { color: var(--ink-mute); font-size: 12px; margin: 0 0 10px; }

/* ---------------------------------------------------------------- table */
.scroll { overflow-x: auto; border: 1px solid var(--line);
          border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-mute);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: sticky; top: 0;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-2); }
td.term { font-weight: 500; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.small, th.small { font-size: 11px; color: var(--ink-mute); white-space: nowrap; }

/* magnitude bar — sequential single hue, 4px rounded end, on the baseline */
.mag { display: flex; align-items: center; gap: 7px; min-width: 150px; }
.mag .track { flex: 1; height: 8px; background: var(--mag-100);
              border-radius: 4px; overflow: hidden; }
.mag .fill { height: 100%; background: var(--mag-500); border-radius: 4px; }
.mag .val { font-variant-numeric: tabular-nums; font-weight: 600;
            font-size: 12px; min-width: 62px; text-align: right; }

/* status pills — always carry a word */
.pill {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pill.ok   { background: var(--ok-bg);   color: var(--ok-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.crit { background: var(--crit-bg); color: var(--crit-ink); }
.pill.mute { background: var(--mute-bg); color: var(--mute-ink); }

.reason { font-size: 11px; color: var(--ink-mute); }

/* ---------------------------------------------------------------- details */
details {
  margin-top: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
details > summary {
  cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13px;
  font-family: "Poppins", sans-serif; list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--ink-mute); }
details[open] > summary::before { content: "▾ "; }
details > summary .count { color: var(--ink-mute); font-weight: 500; }
details .body { padding: 0 12px 12px; }
details .scroll { border-radius: 4px; }

.empty { padding: 14px; color: var(--ink-mute); font-size: 13px;
         background: var(--surface); border: 1px dashed var(--line);
         border-radius: var(--radius); }

footer {
  margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line);
  color: var(--ink-mute); font-size: 11px;
}
footer a { color: var(--ink-2); }

@media (max-width: 640px) {
  .stamp { margin-left: 0; text-align: left; width: 100%; }
  .tile .n { font-size: 22px; }
  h1 { font-size: 19px; }
}

/* ============================ 10x UX upgrade ============================ */

/* logo + brand */
.brand { display: flex; align-items: center; gap: 8px; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--mag-500), var(--mag-300));
  border-radius: 8px; font-size: 17px; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.brand-txt { font-weight: 600; }
.brand-txt b { font-weight: 800; }
.dot { display:inline-block; width:7px; height:7px; border-radius:50%;
       background:#28a745; box-shadow:0 0 0 3px rgba(40,167,69,.2);
       vertical-align: middle; margin-right: 3px; }

/* how-to strip */
.howto {
  margin: 14px 0 4px; padding: 10px 14px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line); font-size: 13px; line-height: 1.6;
}
.howto .uv { color: var(--ink-mute); }
.howto b { color: var(--ink); }

/* opportunity badge */
.opp { display: inline-flex; align-items: baseline; gap: 4px;
       padding: 2px 7px; border-radius: 999px; font-size: 11px;
       font-weight: 600; white-space: nowrap; }
.opp b { font-family: "Poppins", sans-serif; font-size: 13px; font-weight: 800; }
.opp-lbl { font-size: 10px; }
.opp-ok   { background: var(--ok-bg);   color: var(--ok-ink); }
.opp-warn { background: var(--warn-bg); color: var(--warn-ink); }
.opp-mute { background: var(--mute-bg); color: var(--mute-ink); }

.tile.hot { border-color: var(--ok-ink); }
.tile.hot .n { color: var(--ok-ink); }

/* keyword link */
.kw { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--ink-mute); }
.kw:hover { color: var(--mag-700); border-bottom-color: var(--mag-500); }

/* marketplace buttons */
.links { display: flex; gap: 4px; }
.btn { display: inline-block; padding: 2px 8px; border-radius: 6px;
       font-size: 11px; font-weight: 600; text-decoration: none;
       white-space: nowrap; border: 1px solid var(--line); }
.btn-etsy { background: #f1641e; color: #fff; border-color: #f1641e; }
.btn-etsy:hover { background: #d4530f; }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); }

/* top-opportunity cards */
.cards { display: grid; gap: 10px;
         grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card { display: block; padding: 12px; border-radius: 10px; text-decoration: none;
        background: var(--surface); border: 1px solid var(--line);
        color: var(--ink); transition: transform .08s, box-shadow .08s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.card-ok   { border-left: 4px solid var(--ok-ink); }
.card-warn { border-left: 4px solid var(--warn-ink); }
.card-mute { border-left: 4px solid var(--line); }
.card-top { display: flex; justify-content: space-between; align-items: center;
            gap: 8px; margin-bottom: 6px; }
.card-niche { font-size: 11px; color: var(--ink-mute); }
.card-kw { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15px;
           line-height: 1.25; margin-bottom: 8px; }
.card-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
             font-size: 11px; color: var(--ink-mute); }
.card-cta { margin-left: auto; color: #f1641e; font-weight: 700; }

/* niche grid */
.niche-grid { display: grid; gap: 8px;
              grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.ncard { display: flex; gap: 10px; align-items: center; padding: 10px 12px;
         background: var(--surface); border: 1px solid var(--line);
         border-radius: 10px; text-decoration: none; color: var(--ink); }
.ncard:hover { border-color: var(--mag-500); background: var(--surface-2); }
.ncard-emoji { font-size: 24px; width: 34px; text-align: center; }
.ncard-name { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 14px; }
.ncard-stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
               font-size: 11px; color: var(--ink-mute); margin-top: 2px; }
.tag-new { background: var(--ok-bg); color: var(--ok-ink);
           padding: 0 6px; border-radius: 999px; font-weight: 600; }

h1 { display: flex; align-items: center; gap: 8px; }

/* time-window tabs */
[hidden] { display: none !important; }
.tabbar { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 10px; }
.tab {
  font-family: "Poppins", sans-serif; font-size: 12px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.tab:hover { background: var(--surface-2); }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.win-badge, .tab.on { }
.win-badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px;
  border-radius: 999px; background: var(--mag-500); color: #fff;
  vertical-align: middle;
}

/* window presence badges (momentum row) */
.wins { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.wb { font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
      font-variant-numeric: tabular-nums; }
.wb.on  { background: var(--ok-bg); color: var(--ok-ink); }
.wb.off { background: var(--surface-2); color: var(--ink-mute); opacity: .5; }

/* ==========================================================================
   CHARTS — inline SVG, no library, no JS.
   Never preserveAspectRatio="none": it stretches strokes and type, which is
   what turned the first version into black slabs.
   ========================================================================== */
.chart {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 6px;
  margin: 6px 0 10px;
  overflow-x: auto;
}
svg.lc { display: block; width: 100%; height: auto; min-width: 440px; }

svg.lc .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; opacity: .8; }
svg.lc text { font-family: inherit; font-variant-numeric: tabular-nums; }
svg.lc .ylab { font-size: 10.5px; fill: var(--ink-mute); text-anchor: end; letter-spacing: .02em; }
svg.lc .xlab { font-size: 11.5px; fill: var(--ink-mute); font-weight: 600; }
svg.lc .xlab.on  { fill: var(--ink-2); }
svg.lc .xlab.off { opacity: .4; font-weight: 500; }
svg.lc .plab { font-size: 11.5px; font-weight: 700; fill: var(--mag-700); }

svg.lc .line {
  fill: none; stroke: var(--mag-500); stroke-width: 2.25;
  stroke-linecap: round; stroke-linejoin: round;
}
svg.lc .area { stroke: none; }
svg.lc .g0 { stop-color: var(--mag-500); stop-opacity: .20; }
svg.lc .g1 { stop-color: var(--mag-500); stop-opacity: 0; }

svg.lc .dot { fill: var(--surface); stroke: var(--mag-500); stroke-width: 2.25; }
svg.lc .pt.on .dot { fill: var(--mag-500); }
svg.lc .pt.peak .dot { stroke: var(--mag-700); fill: var(--mag-700); }
svg.lc .pt.off .dot { r: 3; opacity: .45; }
svg.lc .hit { fill: transparent; }
svg.lc .pt:hover .hit { fill: var(--ink); opacity: .04; }
svg.lc .pt:hover .dot { stroke-width: 3.5; }

/* row sparkline — same curve as the full chart, at row size */
svg.spark { width: 76px; height: 22px; vertical-align: middle; margin-right: 8px; flex: none; }
svg.spark path { fill: none; stroke: var(--mag-500); stroke-width: 1.75;
                 stroke-linecap: round; stroke-linejoin: round; opacity: .95; }

/* ==========================================================================
   FILTER BAR — narrow 1,200 keywords to a shortlist without a page reload.
   ========================================================================== */
.fbar {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); margin: 0 0 12px;
  display: flex; flex-direction: column;
}
.fbar.active { border-color: var(--mag-500); box-shadow: 0 0 0 1px var(--mag-500) inset; }

.fbar-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.fhead-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.fsearch {
  display: flex; align-items: center; gap: 8px; flex: 1 1 300px; min-width: 220px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); padding: 7px 12px;
}
.fsearch:focus-within { border-color: var(--mag-500); background: var(--surface); }
.fsearch .fico { font-size: 13px; opacity: .7; }
.fsearch input {
  flex: 1; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 13.5px; outline: none;
}
.fsearch input::placeholder { color: var(--ink-mute); }

.fsel { display: inline-flex; align-items: center; gap: 6px;
        font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
        color: var(--ink-mute); font-weight: 600; }
.fsel select {
  font: inherit; font-size: 12.5px; text-transform: none; letter-spacing: 0;
  font-weight: 500; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px;
}
.fsel select:hover { border-color: var(--mag-500); }

.fbtn {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--ink-2); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 14px;
}
.fbtn:hover { border-color: var(--mag-500); color: var(--ink); }
.fcount { font-size: 12.5px; color: var(--ink-mute); font-variant-numeric: tabular-nums;
          white-space: nowrap; }
.fcount.filtered { color: var(--mag-700); font-weight: 700; }

.fgroup { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.flab {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-mute); font-weight: 700;
}
.fgroup-presets { padding: 12px 14px; border-bottom: 1px solid var(--line);
                  background: var(--surface-2); }

.fgrid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px; padding: 14px;
}
.fgroup-wide { grid-column: 1 / -1; }

.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchips button {
  font: inherit; font-size: 12.5px; cursor: pointer; padding: 5px 11px;
  border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); line-height: 1.3;
}
.fchips button:hover { border-color: var(--mag-500); color: var(--ink); }
.fchips button.on {
  background: var(--mag-500); border-color: var(--mag-500);
  color: #17150f; font-weight: 700;
}
.fwin button { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.fpresets button { border-style: dashed; font-weight: 600; }
.fpresets button.on { border-style: solid; }

.fseg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px;
        overflow: hidden; }
.fseg button {
  font: inherit; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; cursor: pointer; padding: 2px 8px; border: 0;
  background: var(--surface-2); color: var(--ink-mute);
}
.fseg button.on { background: var(--ink-2); color: var(--surface); }

.franges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 18px; }
.frange {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 2px 8px; font-size: 11.5px; color: var(--ink-mute);
}
.frange span { grid-column: 1 / -1; }
.frange input[type="range"] { width: 100%; accent-color: var(--mag-500); }
.frange b { color: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums;
            min-width: 22px; text-align: right; }

.fextras { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fcheck { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
          color: var(--ink-2); cursor: pointer; }
.fcheck input { accent-color: var(--mag-500); }

.fhint {
  margin: 0; padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-mute); background: var(--surface-2);
  border-radius: 0 0 10px 10px;
}

@media (max-width: 820px) {
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .franges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fhead-right { margin-left: 0; width: 100%; }
}

/* a breakout is not a number — mark it instead of printing a fake magnitude */
.mag .val.is-breakout { color: var(--mag-700); }

/* niche nav wraps instead of running off the right edge on a wide screen */
@media (min-width: 900px) {
  nav.niches { overflow-x: visible; }
  nav.niches ul { flex-wrap: wrap; white-space: normal; row-gap: 4px; }
}

/* the 7 window badges must sit on ONE line next to the sparkline — wrapping
   made "30d" drop below and broke the row rhythm */
.wins { flex-wrap: nowrap; gap: 2px; }
.wb { font-size: 9.5px; padding: 1px 4px; }

/* Breakout band: Google gives no real percentage for a Breakout, so those
   points sit on their own line above the readable range instead of stretching
   the axis to a meaningless 247.1K. */
svg.lc .boband { stroke: var(--mag-700); stroke-width: 1; stroke-dasharray: 5 4; opacity: .65; }
svg.lc .ylab.bo { fill: var(--mag-700); font-weight: 700; }
svg.lc .pt.bo .dot { fill: var(--mag-700); stroke: var(--mag-700); }
