:root {
    --bg: #f3f5fa;
    --bg-soft: #e8ecf4;
    --bg-card: #ffffff;
    --border: #d5dbe8;
    --text: #12182a;
    --text-dim: #5b657a;
    --accent: #2b7fff;
    --accent-ink: #ffffff;
    --accent-2: #1a5fd4;
    --growth: #12a150;
    --growth-wash: rgba(18, 161, 80, 0.10);
    --warn: #d97706;
    --danger: #dc4a4a;
    --danger-wash: rgba(220, 74, 74, 0.10);
    --burst: #e26d14;
    --spark: #0a9bd8;
    --radius: 14px;
    --hero-from: #060d26;
    --hero-to: #0b1a3e;
    --hero-grid: rgba(120, 170, 255, 0.09);
    --shadow: 0 12px 40px rgba(15, 28, 63, 0.08);
    --font: "Vazirmatn", "Tahoma", sans-serif;
    --font-display: "Outfit", "Vazirmatn", sans-serif;
    /* Space below the sticky site header so the trends chrome can stick under it. */
    --topbar-offset: 64px;

    /* Surfaces the charts draw on.  Plotly and vis-network are handed colours
       as values rather than reading the stylesheet, so every colour they need
       is a token here and `report.js` re-reads these when the theme flips. */
    --card-tint: #eef4ff;
    --chart-bg: #ffffff;
    --chart-grid: #d5dbe8;
    --map-land: #eef2f7;
    --map-line: #94a3b8;
    --map-0: #e8eef8;
    --map-1: #9ec2ff;
    --map-2: #2b7fff;
    --map-3: #1347b0;
    --graph-edge: #9aa8c2;
    /* Labels on the knowledge graph are drawn over nodes and edges, so they
       carry a halo in the page colour rather than a fixed white one. */
    --graph-halo: #ffffff;
    /* Translucent sticky surfaces.  They blur what scrolls under them, so
       they cannot be `--bg-card`: they need their own alpha. */
    --surface-bar: rgba(255, 255, 255, 0.92);
    --surface-chrome: rgba(243, 245, 250, 0.94);
}

/* ---- Dark ---------------------------------------------------------------
   Light is the default and stays in `:root`; dark is an override chosen by
   the reader and remembered, never guessed from the system.  Only the tokens
   change — no rule is duplicated — so anything built on them follows for
   free, and anything still holding a literal is exactly what breaks, which
   is the point.

   The accent lightens because #2b7fff on a dark panel is too close to it to
   read; `--accent-ink` darkens to match, so a filled chip stays legible
   instead of becoming white-on-light-blue. */
:root[data-theme="dark"] {
    --bg: #0b1020;
    --bg-soft: #121a30;
    --bg-card: #161f38;
    --border: #273352;
    --text: #e8ecf6;
    --text-dim: #9aa6c0;
    --accent: #5b9cff;
    --accent-ink: #07122e;
    --accent-2: #8ab6ff;
    --growth: #35c57f;
    --growth-wash: rgba(53, 197, 127, 0.14);
    --warn: #f0a23a;
    --danger: #ef6b6b;
    --danger-wash: rgba(239, 107, 107, 0.14);
    --burst: #f09d5c;
    --spark: #38bdf8;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --hero-grid: rgba(120, 170, 255, 0.14);

    --card-tint: #1b2746;
    --chart-bg: #161f38;
    --chart-grid: #2b3a5c;
    --map-land: #1b2746;
    --map-line: #46567c;
    --map-0: #1b2746;
    --map-1: #2f5fa8;
    --map-2: #5b9cff;
    --map-3: #b9d4ff;
    --graph-edge: #5a6b90;
    --graph-halo: #0b1020;
    --surface-bar: rgba(11, 16, 32, 0.92);
    --surface-chrome: rgba(11, 16, 32, 0.94);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.9;
}

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

/* UA stylesheets give buttons their own face; keep them on the site stack. */
button {
    font-family: inherit;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 24px;
    background: var(--surface-bar);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    cursor: pointer;
}
.brand:hover { text-decoration: none; }
.brand img,
.brand-mark {
    height: 38px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    display: block;
    /* White wordmark → black on the light topbar. */
    filter: brightness(0);
}
.nav-primary {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-inline-end: auto;
}
.nav-primary a {
    color: var(--text-dim);
    font-weight: 600;
    font-size: .92rem;
    padding: 6px 12px;
    border-radius: 999px;
}
.nav-primary a:hover {
    color: var(--text);
    background: var(--bg-soft);
    text-decoration: none;
}
.nav-primary a.nav-cta {
    background: rgba(43, 127, 255, 0.1);
    color: var(--accent-2);
}
.nav-primary a.nav-cta:hover {
    background: rgba(43, 127, 255, 0.16);
    color: var(--accent-2);
}

.nav-tools {
    position: relative;
    margin-inline-end: 4px;
}
.nav-tools > summary {
    list-style: none;
    cursor: pointer;
    color: var(--text-dim);
    font-size: .88rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.nav-tools > summary::-webkit-details-marker { display: none; }
.nav-tools > summary:hover,
.nav-tools[open] > summary {
    color: var(--text);
    background: var(--bg-soft);
    border-color: var(--border);
}
.nav-tools-menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    min-width: 200px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 28, 63, 0.14);
    display: grid;
    gap: 2px;
    z-index: 60;
}
.nav-tools-menu a {
    color: var(--text);
    font-size: .9rem;
    padding: 9px 12px;
    border-radius: 10px;
}
.nav-tools-menu a:hover {
    background: var(--bg-soft);
    color: var(--accent-2);
    text-decoration: none;
}

main { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }
body.landing main { max-width: none; padding: 0; }
footer {
    text-align: center;
    color: var(--text-dim);
    padding: 28px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

h1, h2, h3, h4 { line-height: 1.45; font-weight: 800; }
h1 { font-size: 1.75rem; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; color: var(--text); margin: 0 0 12px; }
h3 { font-size: 1.05rem; color: var(--text); margin: 18px 0 6px; }
h4 { font-size: 1rem; color: var(--text); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

/* Guest teaser: keep shape of the content, veil the valuable bits. */
.member-locked {
    position: relative;
    overflow: hidden;
    min-height: 220px;
}
.member-locked > *:not(.member-lock-cta):not(.card-hint) {
    filter: blur(7px);
    opacity: .72;
    user-select: none;
    pointer-events: none;
}
.member-lock-cta {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px 20px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(243, 245, 250, 0.82) 40%, rgba(243, 245, 250, 0.94));
}
.member-lock-kicker {
    margin: 0;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--accent-2);
}
.member-lock-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    max-width: 22rem;
}
.member-lock-hint {
    margin: 0 0 6px;
    max-width: 26rem;
    color: var(--text-dim);
    font-size: .92rem;
}
.member-lock-cta .btn { margin-top: 4px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; } }
.hero p.lead { color: var(--text-dim); margin-top: 0; }

label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: .92rem; }
.input, input[type="text"], input[type="number"], input[type="search"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}
.input::placeholder,
input::placeholder,
textarea::placeholder {
    font-family: inherit;
    color: var(--text-dim);
    opacity: .85;
}
.input:focus, select:focus, input:focus, textarea:focus {
    outline: 2px solid rgba(43, 127, 255, 0.35);
    outline-offset: 1px;
    border-color: var(--accent);
}
.field { margin-bottom: 14px; }
.field-inline { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.field-inline label { margin: 0; color: var(--text); }
.errorlist { color: var(--danger); margin: 4px 0 0; padding-inline-start: 18px; font-size: .9rem; }

.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover {
    filter: brightness(1.06);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(43, 127, 255, 0.28);
}
.btn.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
    box-shadow: none;
}
.btn.ghost:hover { border-color: #b7c0d4; box-shadow: none; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: .88rem; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; }
th { background: var(--bg-soft); color: var(--text-dim); font-weight: 600; }
td.up { color: var(--accent); }
td.down { color: var(--danger); }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .82rem;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.badge.ok { color: var(--growth); border-color: var(--growth); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.bad { color: var(--danger); border-color: var(--danger); }
/* Nothing went wrong and nothing was tried: not a warning, not a pass. */
.badge.muted { color: var(--text-dim); border-color: var(--border); }

/* «Now», beside the window's own verdict.  Filled rather than outlined, so
   the pair reads as two different kinds of statement at a glance. */
.pill.now-up {
    background: var(--growth-wash);
    border-color: var(--growth);
    color: var(--growth);
}
.tf-now {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: .9rem;
    border: 1px solid transparent;
}
.tf-now small { opacity: .8; font-size: .8rem; }
.tf-now.now-up { background: var(--growth-wash); border-color: var(--growth); color: var(--growth); }
.tf-now.now-down { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }
.tf-now.year-up { border-color: var(--growth); color: var(--growth); }
.tf-now.year-down { border-color: var(--danger); color: var(--danger); }
/* «Against last year» is a quieter claim than «now», and reads as one. */
.pill.year-up { border-color: var(--growth); color: var(--growth); }
.pill.year-down { border-color: var(--danger); color: var(--danger); }
.pill.now-down {
    background: var(--danger-wash);
    border-color: var(--danger);
    color: var(--danger);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.chips li {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .9rem;
}
.chips li small { color: var(--text-dim); }
.chips li.phrase { border-color: var(--accent); color: var(--text); }
details summary { cursor: pointer; }
.engine-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 8px; }
.engine-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.engine-card h4 { margin: 0 0 6px; color: var(--accent-2); }
.engine-card h4 small { font-weight: 400; font-size: .8rem; }
details summary:hover { color: var(--text); }

.tree { list-style: none; padding: 0; margin: 0; }
.tree > li { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.tree > li:last-child { border-bottom: none; }
.tree .term { font-weight: 700; color: var(--accent-2); }

.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.result-list li:last-child { border-bottom: none; }
.result-list .title { font-weight: 600; }
.result-list .snippet { color: var(--text-dim); font-size: .92rem; }
.result-list .src { color: var(--text-dim); font-size: .8rem; direction: ltr; display: inline-block; }

.prose h3 { color: var(--accent-2); }
.prose ul { padding-inline-start: 22px; }
.prose code { background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; }

.progress-wrap { background: var(--bg-soft); border-radius: 999px; height: 10px; overflow: hidden; margin: 12px 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width .4s ease; }

.log { font-size: .85rem; color: var(--text-dim); max-height: 190px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.log li { padding: 2px 0; border-bottom: 1px dashed var(--border); }
.log li:last-child { border-bottom: none; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat .value { font-size: 1.5rem; font-weight: 700; display: block; }
.stat .label { color: var(--text-dim); font-size: .85rem; }

#trend-chart,
#season-chart {
    width: 100%;
    font-family: var(--font);
}
#trend-chart { height: 340px; }
#season-chart { height: 260px; }
#trend-chart text,
#season-chart text,
#trend-chart .hoverlayer text,
#season-chart .hoverlayer text {
    font-family: "Vazirmatn", "Tahoma", sans-serif !important;
}
#graph {
    width: 100%;
    height: 620px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.warnings { border-inline-start: 3px solid var(--warn); padding-inline-start: 12px; color: var(--warn); }
.muted { color: var(--text-dim); }
.messages { max-width: 1180px; margin: 12px auto 0; padding: 0 18px; }
.message { padding: 10px 14px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 8px; }
.message.warning { border-color: var(--warn); color: var(--warn); }
.message.success { border-color: var(--accent); color: var(--accent); }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.report-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-head form { display: inline; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.section-head h2 { margin: 0; flex: 1; }
.section-head-grow { flex: 1; }
.text-edit {
    flex: 0 0 auto;
    margin: 0;
    max-width: 100%;
}
/* Open editor spans the full card width instead of the button column. */
.text-edit[open] {
    flex: 1 1 100%;
    width: 100%;
    order: 3;
}
.text-edit > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
}
.text-edit > summary::-webkit-details-marker { display: none; }
.text-edit-form {
    box-sizing: border-box;
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft, #f5f7fb);
}
.text-edit-form label {
    display: block;
    font-size: .82rem;
    margin-bottom: 6px;
}
.text-edit-form textarea {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 280px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    line-height: 1.75;
    resize: vertical;
    background: var(--bg-card);
}
.text-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ---- the trend's own name, and sharing it --------------------------- */
/* The rename sits under the heading rather than beside it: the pills to the
   heading's left already compete for that line, and a fourth control there
   pushed the title onto two lines on a phone. */
.title-edit { margin: 6px 0 0; }
.title-edit > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
}
.title-edit > summary::-webkit-details-marker { display: none; }
.title-edit-form {
    box-sizing: border-box;
    max-width: 480px;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft, #f5f7fb);
}
.title-edit-form label {
    display: block;
    font-size: .82rem;
    margin-bottom: 6px;
}
.title-edit-form input[type="text"] {
    box-sizing: border-box;
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: var(--bg-card);
}
.title-edit-note { margin: 8px 0 0; font-size: .8rem; line-height: 1.7; }
.title-edit-actions { display: flex; gap: 8px; margin-top: 10px; }

.share { display: inline-flex; flex-direction: column; align-items: stretch; }
/* Confirmation is the button itself turning green for a moment, so nothing
   on the page moves and nothing has to be dismissed. */
.share.is-done .share-button {
    color: var(--ok-text, #0a7d4b);
    border-color: var(--ok-text, #0a7d4b);
}
.share-link {
    box-sizing: border-box;
    width: 100%;
    min-width: 220px;
    margin-top: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .82rem;
    direction: ltr;
    text-align: left;
    background: var(--bg-card);
}

/* ---- momentum table ------------------------------------------------- */
.headline {
    font-size: 1.05rem;
    line-height: 2;
    background: var(--bg-soft);
    border-inline-start: 3px solid var(--accent);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 16px;
}
table.momentum td { vertical-align: middle; }
table.momentum tr.overall { background: var(--bg-soft); font-weight: 700; }
table.momentum small { font-weight: 400; }
.verdict {
    display: inline-block;
    white-space: nowrap;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .85rem;
    border: 1px solid currentColor;
}
.trend-up_strong { color: #4CAF50; }
.trend-up { color: #8BC34A; }
.trend-flat { color: #90A4AE; }
.trend-down { color: #FFB74D; }
.trend-down_strong { color: #E57373; }
.spark-cell { padding: 2px 6px; }
.sparkline { display: block; margin: 0 auto; }

/* ---- timeframe switcher --------------------------------------------- */
.tf-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tf-badge {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 5px 14px;
    font-family: inherit;
    font-size: .9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tf-badge:hover { color: var(--text); }

/* A window whose data cannot carry a direction: no arrow, and the reason
   spelled out underneath rather than left to a tooltip. */
.tf-badge .verdict.trend-unjudged { color: var(--text-dim); font-weight: 700; }
.tf-unjudged {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: .88rem;
    line-height: 1.9;
}
.tf-unjudged b { color: var(--text); font-weight: 500; }

/* What the three windows say together, under the chart. */
.tf-compare {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: .9rem;
    line-height: 1.9;
}
.tf-badge.active { border-color: var(--accent); color: var(--accent-2); background: rgba(43, 127, 255, 0.1); }
.tf-badge .verdict { border: none; padding: 0; font-size: .8rem; }
/* While the forecast is up, the chart is the whole history by month and no
   window is on screen — so none of them is left looking chosen. */
.tf-badge.dimmed { opacity: .45; }
.tf-badge.dimmed.active { border-color: var(--border); color: var(--text-dim); background: var(--bg-soft); }

/* ---- the hover card on the trend chart -------------------------------
 *
 * Plotly's own label is a wide box with a colour swatch and the series name
 * in it, pinned beside the cursor.  On a chart with one line that is width
 * spent restating what the reader knows, over the curve they are pointing
 * at.  This one says when and how much, sits above the point, and never
 * takes the pointer — so it can never come between the cursor and the line.
 */
#trend-chart { position: relative; }

.chart-tip {
    position: absolute;
    z-index: 3;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 7px 12px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(16, 24, 40, .13);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease;
}
.chart-tip.on { opacity: 1; visibility: visible; }
.chart-tip.below { transform: translate(-50%, 0); }

/* The pointer, which flips with the card. */
.chart-tip::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(50% - 5px);
    width: 10px;
    height: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-inline-start: none;
    transform: rotate(45deg);
    bottom: -6px;
}
.chart-tip.below::after {
    bottom: auto;
    top: -6px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-inline-end: none;
}

/* The dot that rides the curve under the cursor.  An element, not a Plotly
   marker: moving a marker means `restyle`, and restyling from inside a hover
   handler re-renders the plot underneath the hover Plotly is still working
   through, which threw on every mouse move. */
.chart-dot {
    position: absolute;
    z-index: 2;
    width: 11px;
    height: 11px;
    margin: -5.5px 0 0 -5.5px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2.5px var(--bg-card);
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s ease;
}
.chart-dot.on { opacity: 1; }

.chart-tip-when { font-size: .74rem; color: var(--text-dim); line-height: 1.3; }
.chart-tip-value { font-size: 1.05rem; font-weight: 700; color: var(--accent-2); line-height: 1.25; }
.chart-tip-note { font-size: .7rem; color: var(--text-dim); line-height: 1.3; }
.chart-tip-note[hidden] { display: none; }

/* ---- the forecast switch --------------------------------------------
 *
 * At the far end of the window strip, away from the badges: those choose
 * which measurement to look at, and this one adds something that is not a
 * measurement at all.  Sitting among them it would read as a fourth window.
 *
 * It carries a switch rather than only going dark, because a pressed button
 * and an unpressed one differ by a shade, and the difference here is
 * between a chart of what happened and a chart that is partly a guess.
 */
.fc-toggle {
    margin-inline-start: auto;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 5px 12px;
    font-family: inherit;
    font-size: .9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.fc-toggle:hover:not(:disabled) { color: var(--text); }
.fc-toggle .fc-icon { width: 16px; height: 16px; }
.fc-toggle .fc-switch {
    width: 30px;
    height: 17px;
    border-radius: 999px;
    background: var(--border);
    position: relative;
    flex: none;
    transition: background .15s ease;
}
.fc-toggle .fc-knob {
    position: absolute;
    inset-inline-start: 2px;
    top: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--bg-card);
    transition: inset-inline-start .15s ease;
}
.fc-toggle.on {
    border-color: var(--accent);
    color: var(--accent-2);
    background: rgba(43, 127, 255, 0.1);
}
.fc-toggle.on .fc-switch { background: var(--accent); }
.fc-toggle.on .fc-knob { inset-inline-start: 15px; }

/* Disabled is the common case, not the exception: most keywords here do not
   carry enough signal to forecast.  So it stays legible rather than fading
   to nothing, and `#fc-note` prints the reason underneath. */
.fc-toggle:disabled {
    cursor: not-allowed;
    opacity: .55;
}

#fc-note {
    font-size: .86rem;
    margin-top: 8px;
    line-height: 1.75;
}
#fc-note.fc-why { color: var(--text-dim); font-size: .82rem; }
#fc-note:empty { display: none; }

/* «No measurable demand» is a finding, not a failure to produce one, and
   for a reader deciding whether to stock something it may be the most
   useful sentence on the page.  So it is set like the rest of the report's
   findings rather than like an apology. */
#fc-note.fc-verdict {
    color: var(--text);
    font-size: .88rem;
    border-inline-start: 3px solid var(--border);
    padding-inline-start: 12px;
}
/* A keyword that has just exploded is the one finding worth a colour. */
#fc-note.fc-breakout { border-inline-start-color: var(--accent); }

@media (max-width: 560px) {
    /* The strip wraps; an auto margin would strand the switch on a line of
       its own, pushed to the far edge. */
    .fc-toggle { margin-inline-start: 0; }
}

/* ---- geographic distribution ---------------------------------------- */
#region-map {
    width: 100%;
    height: 360px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}
.region-list { margin-top: 12px; display: grid; gap: 6px; }
.region-row { display: grid; grid-template-columns: 9rem 1fr 3rem; align-items: center; gap: 10px; font-size: .9rem; }
.region-name { color: var(--text); }
.region-bar { background: var(--bg-soft); border-radius: 999px; height: 8px; overflow: hidden; }
.region-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.region-value { color: var(--text-dim); text-align: left; }
@media (max-width: 700px) { .region-row { grid-template-columns: 7rem 1fr 2.5rem; } }

/* ---- queue ----------------------------------------------------------- */
table.queue-table td { vertical-align: middle; }
table.queue-table .progress-wrap { margin: 0; height: 8px; }
#terms { scroll-margin-top: 72px; }

.report-create {
    max-width: 640px;
    margin: 28px auto;
}
.report-create h1 { margin-top: 0; }
.report-create .btn { margin-top: 18px; }
.report-create { max-width: 760px; }
.report-create h1 { margin-bottom: 4px; }
.report-create > .muted { margin-top: 0; }
.report-create .field label { color: var(--text); font-weight: 600; }

.create-settings {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    overflow: hidden;
}
.create-settings summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.create-settings summary::-webkit-details-marker { display: none; }
.create-settings summary::before {
    content: "";
    width: 8px;
    height: 8px;
    border-inline-end: 2px solid var(--text-dim);
    border-bottom: 2px solid var(--text-dim);
    transform: rotate(135deg);
    transition: transform .15s ease;
    align-self: center;
}
.create-settings[open] summary::before { transform: rotate(45deg); }
.create-settings summary:hover { background: var(--bg-soft); }
.create-settings-title { font-weight: 700; color: var(--text); }
.create-settings-hint { font-size: .85rem; color: var(--text-dim); }
.create-settings[open] summary { border-bottom: 1px solid var(--border); }

.create-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
    padding: 16px 16px 0;
    background: var(--bg-card);
}
.create-settings-grid label { color: var(--text); font-weight: 600; font-size: .9rem; }
.create-settings-checks {
    display: grid;
    gap: 10px;
    padding: 4px 16px 16px;
    background: var(--bg-card);
}
.create-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text);
    font-size: .95rem;
    cursor: pointer;
}
.create-check:hover { border-color: var(--accent); }
.create-check input { margin-top: 6px; accent-color: var(--accent); flex: none; }
.create-check small {
    display: block;
    margin-top: 2px;
    color: var(--text-dim);
    font-size: .82rem;
    line-height: 1.7;
}
.create-actions { margin-top: 18px; }
@media (max-width: 640px) {
    .create-settings-grid { grid-template-columns: 1fr; }
}

table.queue-table form { display: inline; margin: 0; }
.google-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-inline-start: 6px;
    border-radius: 6px;
    color: var(--muted, #888);
    vertical-align: middle;
    text-decoration: none;
}
.google-search:hover {
    color: #4285f4;
    background: rgba(66, 133, 244, .1);
}
.term-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}
#pause-note { margin-top: 12px; }
#pause-note[hidden] { display: none; }

.queue-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
}
.queue-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.queue-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.queue-buttons form { display: inline; margin: 0; }

/* Raw provider payloads: long, LTR, and meant to be read, not skimmed. */
.raw-json {
    max-height: 420px;
    overflow: auto;
    background: var(--bg-soft, #11151c);
    border: 1px solid var(--border, #2f3542);
    border-radius: 8px;
    padding: 12px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8rem;
    line-height: 1.5;
    white-space: pre;
    color: var(--text, #e6e8ee);
}

.inline-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form input[type="text"] {
    flex: 1 1 260px;
}

/* ===========================================================================
   The card wall
   ---------------------------------------------------------------------------
   A grid of trends, each answering three things at a glance: what it is,
   which way it is going, and how fast.  Nothing in here changes what a
   report contains — only how it looks before you open one.
   ======================================================================== */

.topics-chrome {
    position: sticky;
    top: var(--topbar-offset);
    z-index: 40;
    margin: -8px -6px 22px;
    padding: 8px 6px 14px;
    background: var(--surface-chrome);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topics-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.topics-head h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.topics-lead { margin: 6px 0 0; max-width: 36rem; }
.eyebrow {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.topics-filters { margin-bottom: 0; }

@media (max-width: 900px) {
    :root { --topbar-offset: 104px; }
    .topics-chrome {
        /* Filters take more height on small screens; keep them usable. */
        max-height: calc(100vh - var(--topbar-offset));
        overflow-y: auto;
    }
}

/* On a phone the filters stop being furniture and scroll away with the page.
 *
 * Measured, because the breakpoint is the whole decision.  The chrome holds
 * four chip rows and a search box, and how tall that is depends entirely on
 * how much the chips wrap:
 *
 *     375 x 812   668px   82% of the screen
 *     414 x 896   540px   60%
 *     768 x 1024  380px   37%
 *     900 x 900   349px   39%
 *
 * Pinned at 82%, the filters left 144px for the cards they exist to help you
 * find — so the page was locked on its own controls and the trends had to be
 * read through a letterbox.  The rule above tried to contain that by letting
 * the block scroll inside itself, which keeps the filters usable and does
 * nothing for the problem: a scrollable 668px lid is still a lid.
 *
 * Above 768px it stays stuck, where it costs a third of the screen and earns
 * it — the filters are worth having in reach while you scan a grid several
 * columns wide.
 */
@media (max-width: 767px) {
    .topics-chrome {
        position: static;
        max-height: none;
        overflow: visible;
        /* Nothing scrolls underneath it any more, so the blur is paint for
           no effect. */
        backdrop-filter: none;
    }
    /* Unpinned, the filters still filled the first screen — 668px at 375
       wide — because every chip row wrapped to two or three lines, and a
       visitor saw controls and no trend.  Each row is one line now that
       scrolls sideways; a chip cut at the edge says there is more. */
    .topics-filters .filter-line { flex-wrap: nowrap; gap: 10px; }
    .topics-filters .filter-line .filter-label { min-width: 0; flex-shrink: 0; }
    .topics-filters .filter-line .chips {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        padding-block: 2px;
    }
    .topics-filters .filter-line .chips::-webkit-scrollbar { display: none; }
    .topics-filters .filter-line .chips > * { flex-shrink: 0; }
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-row input[type="search"] {
    flex: 1 1 240px;
    max-width: 380px;
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: inherit;
    font-size: .92rem;
    box-shadow: 0 2px 8px rgba(15, 28, 63, 0.04);
}

.filter-row input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
}
.filters-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid rgba(43, 127, 255, 0.22);
    background: rgba(43, 127, 255, 0.08);
    color: var(--accent-2);
    font-size: .86rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filters-clear:hover {
    background: rgba(43, 127, 255, 0.14);
    border-color: rgba(43, 127, 255, 0.4);
    color: var(--accent-2);
    text-decoration: none;
}
.filters-clear-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    height: 1.1em;
    border-radius: 50%;
    background: rgba(43, 127, 255, 0.16);
    font-size: 1rem;
    line-height: 1;
    font-weight: 700;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* Lists folded on a phone by report.js (`data-fold`).  !important because
   the items carry their own display — a chip is inline-flex, a cluster a
   block — and `hidden` loses to any of them. */
[data-fold] > [hidden] { display: none !important; }
.prose.is-clamped {
    max-height: 520px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
    mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
.fold-more {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--accent-2);
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
}

.filter-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-label {
    color: var(--text-dim);
    font-size: .82rem;
    min-width: 62px;
}

.chip {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: .86rem;
    white-space: nowrap;
}

.chip:hover { color: var(--text); text-decoration: none; border-color: #aeb8cc; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip b { font-weight: 700; opacity: .85; }

.topic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.topic-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
    position: relative;
    overflow: hidden;
    min-width: 0;
    height: 100%;
}
.topic-card::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #6aa8ff);
    opacity: 0;
    transition: opacity .22s ease;
}

.topic-card:hover {
    text-decoration: none;
    transform: translateY(-5px);
    border-color: #b7c8ef;
    box-shadow: 0 22px 50px rgba(15, 28, 63, 0.14);
}
.topic-card:hover::before { opacity: 1; }

.topic-card h2 {
    margin: 0;
    font-size: 1.28rem;
    color: var(--text);
    line-height: 1.45;
    letter-spacing: -0.01em;
    min-height: calc(1.45em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-top {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    align-content: flex-start;
    min-height: 4.5rem;
    flex-shrink: 0;
}
.topic-card.is-watched {
    border-color: rgba(43, 127, 255, 0.35);
}
.watch-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: var(--accent-2);
    background: rgba(43, 127, 255, 0.12);
    border: 1px solid rgba(43, 127, 255, 0.28);
    flex-shrink: 0;
}
.watch-icon {
    display: block;
    flex-shrink: 0;
}

.growth-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .92rem;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}
.growth-badge small { font-size: .7em; font-weight: 600; opacity: .75; }
.growth-badge.up { background: rgba(18, 161, 80, 0.12); color: var(--growth); }
.growth-badge.down { background: rgba(220, 74, 74, 0.12); color: var(--danger); }
.growth-badge.flat { background: rgba(91, 101, 122, 0.1); color: var(--text-dim); }

.pill {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.pill.up { background: rgba(18, 161, 80, .12); color: var(--growth); border-color: rgba(18, 161, 80, .28); }
.pill.down { background: rgba(220, 74, 74, .12); color: var(--danger); border-color: rgba(220, 74, 74, .28); }
.pill.flat { background: rgba(91, 101, 122, .08); color: var(--text-dim); border-color: var(--border); }
.pill.quiet { background: transparent; color: var(--text-dim); border-color: var(--border); font-weight: 500; }

.topic-stats {
    display: flex;
    gap: 22px;
    padding: 2px 0;
    flex-shrink: 0;
    min-height: 3.4rem;
}

.stat-cell { display: flex; flex-direction: column; }

.stat-cell .figure {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
    font-family: var(--font-display);
}

.stat-cell .figure.up { color: var(--growth); }
.stat-cell .figure.down { color: var(--danger); }
.stat-cell .figure.flat { color: var(--text); }

.stat-cell .label {
    font-size: .78rem;
    color: var(--text-dim);
}

.topic-chart {
    height: 72px;
    overflow: hidden;
    margin: 6px -4px;
    padding: 8px 4px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(43, 127, 255, 0.04), transparent 70%);
    flex-shrink: 0;
}

.topic-chart svg { width: 100%; height: 100%; display: block; }

.topic-summary {
    margin: 0;
    color: var(--text-dim);
    font-size: .9rem;
    line-height: 1.85;
    flex: 1 1 auto;
    min-height: calc(1.85em * 3);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: .82rem;
    margin-top: auto;
    flex-shrink: 0;
}

.topic-foot .go { color: var(--accent); font-weight: 700; }
.topic-card:hover .topic-foot .go { color: var(--accent-2); }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
}

.empty { text-align: center; }
.empty .btn { margin-top: 10px; }

/* The technical account of how a report was produced, kept out of the way
   of the thing the report is actually about. */
.run-details {
    margin-top: 26px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}

.run-details > summary {
    cursor: pointer;
    padding: 12px 18px;
    color: var(--text-dim);
    font-size: .88rem;
    list-style: none;
}

.run-details > summary::-webkit-details-marker { display: none; }
.run-details > summary::before { content: "▸ "; }
.run-details[open] > summary::before { content: "▾ "; }
.run-details > summary:hover { color: var(--text); }
.run-details .run-body { padding: 0 18px 16px; }

@media (max-width: 960px) {
    .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .topic-grid { grid-template-columns: 1fr; }
    .topics-head h1 { font-size: 1.4rem; }
}

/* A switch that reads as on or off at a glance, rather than a button whose
   label you have to interpret. */
.btn.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-dim);
}

.btn.toggle .switch {
    width: 30px;
    height: 17px;
    border-radius: 999px;
    background: #3a4152;
    position: relative;
    transition: background .15s ease;
    flex: none;
}

.btn.toggle .switch::after {
    content: "";
    position: absolute;
    top: 2px;
    inset-inline-start: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: inset-inline-start .15s ease, background .15s ease;
}

.btn.toggle.on { color: var(--text); border-color: rgba(43, 127, 255, .45); }
.btn.toggle.on .switch { background: var(--accent); }
.btn.toggle.on .switch::after { inset-inline-start: 15px; background: var(--bg-card); }
.btn.toggle:hover { border-color: #3f4a5e; }

.btn.toggle.watch { gap: 8px; }
.btn.toggle.watch .watch-icon {
    color: var(--text-dim);
}
.btn.toggle.watch.on {
    color: var(--accent-2);
    border-color: rgba(43, 127, 255, .45);
    background: rgba(43, 127, 255, 0.08);
}
.btn.toggle.watch.on .watch-icon {
    color: var(--accent-2);
}

/* The sentence under a checkbox that explains what turning it on costs. */
.field-note {
    margin: -6px 0 14px;
    padding-inline-start: 26px;
    font-size: .82rem;
    line-height: 1.8;
}

/* In the archive table the switch carries no label, so it should not keep
   a label's worth of padding. */
.queue-table .btn.toggle { padding: 4px 8px; gap: 0; }
.queue-table tr[id] { scroll-margin-top: 72px; }

/* The unit beside a figure that is not a percentage, so it is not read as
   one. */
.stat-cell .unit {
    font-size: .62em;
    font-weight: 500;
    color: var(--text-dim);
    margin-inline-start: 3px;
}

/* The pace pill sits beside the direction and qualifies it, so it is
   deliberately quieter than the direction it modifies. */
/* The pace pill is coloured by what it means, not by which word it is.
 * «شتاب گرفته» has no direction of its own — it means faster the way the
 * keyword was already going — so on a falling trend it was being shown in
 * the green reserved for growth, which told the reader the opposite of the
 * truth about the worst state a trend can be in.  The tone comes from
 * `cards.phase_badge`, which pairs the phase with the direction. */
.pill.phase { background: transparent; border-color: var(--border); }
.pill.phase.tone-good { color: var(--growth); border-color: rgba(18, 161, 80, .35); }
.pill.phase.tone-warn { color: var(--warn); border-color: rgba(217, 119, 6, .35); }
.pill.phase.tone-bad { color: var(--danger); border-color: rgba(220, 74, 74, .35); }
.pill.phase.tone-neutral { color: var(--text-dim); }

.pill.season {
    background: rgba(43, 127, 255, .1);
    color: var(--accent-2);
    border-color: rgba(43, 127, 255, .28);
}

/* A keyword that has just exploded.  Filled rather than outlined and the
   only warm colour on the card, because it is not another reading of the
   same line — it says the line stopped being the one the other pills are
   describing.  Six months ago this was a different keyword. */
.pill.breakout {
    background: rgba(226, 109, 20, .12);
    color: #c45c0d;
    border-color: rgba(226, 109, 20, .3);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.pill.breakout .pill-icon { width: 13px; height: 13px; }

/* One month that stood up, which is not yet a direction.  Outlined rather
   than filled and in the same warm family as the breakout pill but a step
   back from it, because the finding is a step back from that one. */
.pill.spark {
    background: transparent;
    color: #b06a1c;
    border-color: rgba(226, 109, 20, .4);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.pill.spark .pill-icon { width: 13px; height: 13px; }
:root[data-theme="dark"] .pill.spark { color: #e2a86a; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pill.spark { color: #e2a86a; }
}
:root[data-theme="dark"] .pill.breakout { color: #f09d5c; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pill.breakout { color: #f09d5c; }
}

/* What kind of thing a keyword is.  Filled rather than outlined, because it
   answers a different question from the direction and pace pills beside it
   and should not read as another reading of the same line. */
.pill.kind { border-style: solid; font-weight: 600; }
.pill.kind.product { background: rgba(18, 161, 80, .1); color: var(--growth); border-color: rgba(18, 161, 80, .3); }
.pill.kind.brand { background: rgba(217, 119, 6, .1); color: var(--warn); border-color: rgba(217, 119, 6, .3); }
.pill.kind.content { background: rgba(124, 58, 237, .08); color: #7c3aed; border-color: rgba(124, 58, 237, .25); }
.pill.kind.person { background: rgba(43, 127, 255, .1); color: var(--accent-2); border-color: rgba(43, 127, 255, .28); }
.pill.kind.topic { background: rgba(91, 101, 122, .08); color: var(--text-dim); border-color: var(--border); }

/* ---- Signing in, and who is signed in ---------------------------------- */

/* The account corner of the top bar: present on every page, and quiet enough
   that it never competes with the navigation beside it. */
.account { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.account a { color: var(--text-dim); }
.account a:hover { color: var(--text); }
/* A button that happens to be a link is still a button.  `.account a` is one
   specificity point above `.btn`, so moving the sign-in link into this corner
   (to sit beside the theme switch) quietly repainted its label dimmed grey on
   the accent fill. */
.account a.btn { color: var(--accent-ink); }
.account a.btn:hover { color: var(--accent-ink); }
.account a.btn.ghost,
.account a.btn.ghost:hover { color: var(--text); }
.account form { margin: 0; }

/* The sign-in page stands alone — no top bar, because every page it would
   link to is behind the form the visitor is looking at.  Split shell: form
   on the right (RTL), dealing trend cards on the left like a hand of cards. */
.signin-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 55% 45% at 18% 42%, rgba(43, 127, 255, 0.1), transparent 62%),
        radial-gradient(ellipse 40% 35% at 88% 18%, rgba(18, 161, 80, 0.06), transparent 58%),
        var(--bg);
}
.signin-shell {
    --signin-panel: 360px;
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 40px 56px;
    width: min(calc(var(--signin-panel) * 2 + 56px), calc(100% - 48px));
    margin: 0 auto;
    padding: 40px 0 24px;
    box-sizing: border-box;
}
.signin-page > .signin,
.signin-shell > .signin {
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 var(--signin-panel);
    width: var(--signin-panel);
    max-width: 100%;
    margin: 0;
    padding: 0;
}
.signin-brand {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    min-height: 96px;
    margin-bottom: 14px;
}
/* A wordmark, 4:1 — sized by width so it stays legible instead of being
   letterboxed into a square. */
.signin-brand a { display: inline-block; line-height: 0; text-decoration: none; }
.signin-brand a:hover { text-decoration: none; opacity: .92; }
.signin-brand img {
    width: 190px; max-width: 70%; height: auto;
    /* Same white wordmark as the top bar, blackened for the light
       page.  The sign-in page used to carry its own black copy of the
       file, which meant a second logo to keep in step and a black mark
       on a black page the moment dark arrived. */
    filter: brightness(0);
}
.signin-brand p { margin: 10px 0 0; font-size: .9rem; }
.signin-card {
    box-sizing: border-box;
    padding: 24px;
    margin: 0;
    width: 100%;
    min-height: 286px;
    /* Cool wash + stronger lift so the form reads as the focus, not another white panel. */
    background:
        linear-gradient(165deg, var(--bg-card) 0%, var(--card-tint) 100%);
    border-color: rgba(43, 127, 255, 0.28);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 20px 48px rgba(15, 28, 63, 0.14),
        0 6px 18px rgba(43, 127, 255, 0.1);
}
.signin-page > .site-footer {
    flex-shrink: 0;
    width: 100%;
    margin-top: auto;
    /* Translucent like the top bar, and themed for the same reason: a fixed
       white strip put dimmed grey text on white the moment dark arrived. */
    background: var(--surface-bar);
}

.signin-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    box-sizing: border-box;
    flex: 0 0 var(--signin-panel);
    width: var(--signin-panel);
    max-width: 100%;
    margin: 0;
    padding: 0;
}
.signin-showcase-glow {
    position: absolute;
    inset: 12% 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(43, 127, 255, 0.18), transparent 68%);
    filter: blur(8px);
    pointer-events: none;
}
.signin-showcase-kicker {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    box-sizing: border-box;
    min-height: 96px;
    margin: 0 0 14px;
    text-align: center;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-dim);
}
.signin-deck {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    /* Match .signin-card so the two panels share one height on desktop. */
    height: 286px;
    /* Room for the dealt card to slide out without clipping. */
    overflow: visible;
}
.signin-trend-card {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 18px 44px rgba(15, 28, 63, 0.12);
    transform-origin: 50% 80%;
    will-change: transform, opacity;
    /* Playing-card deal: slide + fan, not a hinged page turn. */
    animation: signin-deal 12.5s cubic-bezier(.33, .1, .2, 1) infinite;
    animation-delay: calc(var(--i) * -2.5s);
}
.signin-trend-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.signin-trend-card h2 {
    margin: 0;
    font-size: 1.12rem;
    letter-spacing: -0.02em;
    line-height: 1.35;
}
.signin-trend-chart {
    flex: 1;
    min-height: 0;
    display: grid;
    align-items: center;
}
.signin-trend-chart .sparkline,
.signin-trend-card .sparkline {
    width: 100%;
    height: 40px;
    margin: 0;
}
.signin-trend-card.is-solo {
    animation: none;
    opacity: 1;
    z-index: 5;
    transform: none;
}
.signin-trend-foot {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    font-size: .82rem;
    color: var(--text-dim);
}
.signin-trend-foot span:last-child {
    color: var(--accent-2);
    font-weight: 700;
}

/*
  Playing-card shuffle (not a notebook page-turn):
  front card lifts, fans sideways with rotateZ, then drops under the deck.
  Waiting cards sit as a slight fanned stack behind it.
*/
@keyframes signin-deal {
    0%, 12% {
        opacity: 1;
        z-index: 5;
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 22px 48px rgba(15, 28, 63, 0.16);
    }
    /* Toss the top card off like dealing from a hand. */
    16% {
        opacity: 1;
        z-index: 6;
        transform: translate(-18%, -42%) rotate(-14deg) scale(1.02);
        box-shadow: 0 28px 56px rgba(15, 28, 63, 0.22);
    }
    20% {
        opacity: 0;
        z-index: 0;
        transform: translate(-8%, 22%) rotate(6deg) scale(.9);
        box-shadow: 0 8px 18px rgba(15, 28, 63, 0.06);
    }
    /* Rest of the loop: climb back through the fanned stack. */
    20.1%, 76% {
        opacity: .72;
        z-index: 1;
        transform: translate(14px, 18px) rotate(3.5deg) scale(.9);
        box-shadow: 0 8px 18px rgba(15, 28, 63, 0.07);
    }
    84% {
        opacity: .84;
        z-index: 2;
        transform: translate(9px, 12px) rotate(2deg) scale(.94);
        box-shadow: 0 12px 26px rgba(15, 28, 63, 0.09);
    }
    92% {
        opacity: .94;
        z-index: 3;
        transform: translate(4px, 6px) rotate(.8deg) scale(.97);
        box-shadow: 0 16px 34px rgba(15, 28, 63, 0.11);
    }
    100% {
        opacity: 1;
        z-index: 4;
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 22px 48px rgba(15, 28, 63, 0.16);
    }
}

@media (max-width: 860px) {
    .signin-shell {
        --signin-panel: 100%;
        flex-direction: column;
        align-items: stretch;
        width: min(360px, calc(100% - 32px));
        gap: 28px;
        padding-top: 28px;
    }
    .signin-shell > .signin,
    .signin-showcase {
        flex: 0 0 auto;
        width: 100%;
    }
    .signin-brand,
    .signin-showcase-kicker {
        min-height: 0;
    }
    .signin-showcase-kicker {
        margin-bottom: 10px;
    }
    .signin-card { min-height: 0; }
    .signin-deck { height: 286px; }
    /* Stacked under the form, the desktop toss (up and to the left) flew
       a card over the sign-in button.  Here the top card is dealt down
       instead, away from the form, and what swings past the side edge is
       clipped rather than widening the page. */
    .signin-showcase { overflow-x: clip; }
    .signin-trend-card { animation-name: signin-deal-stacked; }
}

@keyframes signin-deal-stacked {
    0%, 12% {
        opacity: 1;
        z-index: 5;
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 22px 48px rgba(15, 28, 63, 0.16);
    }
    16% {
        opacity: .9;
        z-index: 6;
        transform: translate(-6%, 26%) rotate(-6deg) scale(.97);
        box-shadow: 0 28px 56px rgba(15, 28, 63, 0.2);
    }
    20% {
        opacity: 0;
        z-index: 0;
        transform: translate(-2%, 34%) rotate(-3deg) scale(.9);
        box-shadow: 0 8px 18px rgba(15, 28, 63, 0.06);
    }
    20.1%, 76% {
        opacity: .72;
        z-index: 1;
        transform: translate(10px, 14px) rotate(2.5deg) scale(.92);
        box-shadow: 0 8px 18px rgba(15, 28, 63, 0.07);
    }
    84% {
        opacity: .84;
        z-index: 2;
        transform: translate(7px, 10px) rotate(1.5deg) scale(.95);
        box-shadow: 0 12px 26px rgba(15, 28, 63, 0.09);
    }
    92% {
        opacity: .94;
        z-index: 3;
        transform: translate(3px, 5px) rotate(.6deg) scale(.97);
        box-shadow: 0 16px 34px rgba(15, 28, 63, 0.11);
    }
    100% {
        opacity: 1;
        z-index: 4;
        transform: translate(0, 0) rotate(0deg) scale(1);
        box-shadow: 0 22px 48px rgba(15, 28, 63, 0.16);
    }
}
@media (prefers-reduced-motion: reduce) {
    .signin-trend-card {
        animation: none;
        opacity: 0;
        pointer-events: none;
    }
    .signin-trend-card[style="--i:0"] {
        opacity: 1;
        z-index: 5;
        transform: none;
        pointer-events: auto;
    }
}
.btn.block { width: 100%; justify-content: center; margin-top: 8px; }

/* The visitor's header: the mark, and a way in.  Deliberately thin — the
   trends wall is the page, and this is only there so the site has a name. */
.topbar.viewer { padding: 10px 24px; justify-content: space-between; }
.topbar.viewer .brand-mark { height: 36px; max-width: 170px; }
.topbar.viewer a.muted { font-size: .85rem; margin-inline-start: auto; }

/* ---- Discovery settings: connector checklist --------------------------- */
.discovery-sources-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.discovery-sources-head > label { margin: 0; }
.discovery-sources-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--text);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.discovery-sources-toggle input {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}
.discovery-sources-list {
    display: grid;
    gap: 2px;
    margin-bottom: 8px;
}
.discovery-sources-note {
    font-size: .8rem;
    margin: 2px 0 0;
}

/* ---- Watching a harvest happen ----------------------------------------- */

.run-panel > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.run-panel > summary::-webkit-details-marker { display: none; }
.run-panel-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.run-panel-summary h2 {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
}
.run-panel-summary h2::before {
    content: "";
    width: 0;
    height: 0;
    border-inline-start: 6px solid currentColor;
    border-block: 5px solid transparent;
    transition: transform .15s ease;
}
.run-panel[open] .run-panel-summary h2::before {
    transform: rotate(90deg);
}
.run-panel-body { margin-top: 12px; }

/* The run panel lists one row per source so the answer to "is it doing
   anything?" is a glance rather than a guess.  Rows keep a fixed height as
   their state changes, because the list is being rewritten underneath the
   reader every second and a shifting layout makes it unreadable. */
.run-steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }

.run-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
}

.run-step-name { font-weight: 600; min-width: 190px; }
.run-step .muted { font-size: .85rem; }
.run-step-error { flex: 1; text-align: left; direction: ltr; font-size: .78rem; }

/* The one being read right now is the only thing on the page worth looking
   at while a run is going, so it is the only row that is not quiet. */
.run-step.running { border-color: var(--warn); background: rgba(255, 183, 77, .08); }
.run-step.running .run-step-name { color: var(--warn); }
.run-step.pending { opacity: .55; }
.run-step.ok { border-color: rgba(76, 175, 80, .35); }
.run-step.blocked,
.run-step.failed { border-color: rgba(229, 115, 115, .35); }

.run-panel .progress-wrap { margin: 10px 0 0; }

/* Numbered pages, kept on one line and wrapping rather than scrolling. */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.page-numbers { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-numbers .chip { min-width: 34px; text-align: center; padding: 4px 8px; }

@media (max-width: 720px) {
    .run-step { flex-wrap: wrap; }
    .run-step-name { min-width: 0; }
}
.pager-note { text-align: center; margin: 6px 0 0; font-size: .85rem; }

/* ===========================================================================
   Landing (Exploding Topics–inspired discovery surface)
   ======================================================================== */

/* Keep the guest sign-in bar locked to the top of the landing page so a
   visitor who decides to join can hit the button without scrolling back. */
body.landing .topbar {
    position: sticky;
    inset-inline: 0;
    top: 0;
    background: rgba(6, 13, 38, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
}
body.landing {
    background: #040a1c;
}
body.landing .topbar .brand-mark {
    /* Keep the white wordmark on the dark landing bar. */
    filter: none;
}
body.landing .nav-primary a,
body.landing .nav-tools > summary,
body.landing .account a {
    color: rgba(230, 238, 255, 0.88);
}
body.landing .nav-primary a:hover,
body.landing .nav-tools > summary:hover,
body.landing .nav-tools[open] > summary {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: transparent;
}
body.landing .nav-primary a.nav-cta {
    background: rgba(43, 127, 255, 0.28);
    color: #fff;
}
body.landing .btn.ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}
body.landing .topbar.viewer .btn.small {
    background: rgba(43, 127, 255, 0.9);
    border-color: transparent;
    color: #fff;
}
body.landing .nav-tools-menu { color: var(--text); }
body.landing .nav-tools-menu a { color: var(--text); }
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 0;
    text-align: center;
    padding: 28px 18px 36px;
    color: var(--text-dim);
    font-size: .9rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}
.site-footer a {
    color: var(--accent-2);
    font-weight: 700;
}
.site-footer a:hover { text-decoration: underline; }
.site-footer-sep {
    margin: 0 8px;
    opacity: .55;
}
body.landing .site-footer {
    background: var(--bg);
}

.about-page {
    max-width: 640px;
    margin: 40px auto 64px;
    padding: 0 18px;
}
.about-page h1 {
    margin: 0 0 16px;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
}
.about-lead {
    font-size: 1.1rem;
    line-height: 1.85;
    margin: 0 0 14px;
}
.about-more { margin: 0; max-width: 36rem; }

/* ---- guide: how to read a trend ------------------------------------- */
.guide-page {
    max-width: 920px;
    margin: 28px auto 72px;
    padding: 0 18px;
}
.guide-hero { margin-bottom: 36px; max-width: 40rem; }
.guide-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    letter-spacing: -0.02em;
}
.guide-lead {
    margin: 0 0 20px;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text);
}
.guide-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /* The headline box above ends with a border, so buttons sitting on the
     * default margin looked stuck to it rather than placed under it. */
    margin-top: 18px;
}
.guide-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.guide-step {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 22px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
}
.guide-visual { display: grid; place-items: center; }
.guide-copy h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}
.guide-benefit {
    margin: 0 0 8px;
    font-weight: 600;
    line-height: 1.7;
}
.guide-copy .muted { margin: 0; line-height: 1.7; }

.gv-card {
    width: 100%;
    max-width: 200px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: linear-gradient(165deg, #f7f9fc, #eef3fb);
    padding: 12px;
}
.gv-overview .gv-title {
    display: block;
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: 10px;
}
.gv-line {
    display: block;
    height: 7px;
    border-radius: 99px;
    background: rgba(43, 127, 255, 0.18);
    margin-bottom: 7px;
}
.gv-line.short { width: 62%; }
.gv-chart { text-align: center; }
.gv-pills {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 6px;
}
.gv-pills span {
    font-size: .68rem;
    padding: 2px 7px;
    border-radius: 99px;
    background: rgba(15, 40, 90, 0.06);
    color: var(--text-dim);
}
.gv-pills .on {
    background: rgba(43, 127, 255, 0.18);
    color: var(--accent-2);
    font-weight: 700;
}
.gv-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.gv-stats div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gv-stats strong { font-size: 1rem; font-family: var(--font-display); }
.gv-stats .up { color: #12a150; }
.gv-stats small { color: var(--text-dim); font-size: .7rem; }
.gv-map { position: relative; min-height: 110px; }
.gv-map-shape {
    width: 78px;
    height: 78px;
    margin: 4px auto 0;
    border-radius: 42% 58% 48% 52% / 48% 42% 58% 52%;
    background: rgba(43, 127, 255, 0.16);
    border: 1px dashed rgba(43, 127, 255, 0.35);
}
.gv-map .dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2b7fff;
    box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.2);
}
.gv-map .d1 { top: 28px; inset-inline-start: 48%; }
.gv-map .d2 { top: 52px; inset-inline-start: 38%; }
.gv-map .d3 { top: 44px; inset-inline-start: 62%; }
.gv-ranks {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    font-size: .75rem;
}
.gv-ranks li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
}
.gv-ranks b { font-family: var(--font-display); }
.gv-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 72px;
    padding-top: 8px;
}
.gv-bars i {
    flex: 1;
    height: var(--h);
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, #5b9cff, #2b7fff);
    display: block;
}
.gv-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.gv-chips span {
    font-size: .72rem;
    padding: 4px 8px;
    border-radius: 99px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.gv-chips .hot {
    background: rgba(18, 161, 80, 0.12);
    border-color: rgba(18, 161, 80, 0.28);
    color: #0d7a3a;
    font-weight: 700;
}
.gv-result { margin-bottom: 10px; }
.gv-r-title {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.gv-r-snip {
    display: block;
    height: 6px;
    border-radius: 99px;
    background: rgba(15, 40, 90, 0.1);
    margin-bottom: 4px;
}
.gv-r-snip.short { width: 55%; }
.gv-r-src {
    font-size: .68rem;
    color: var(--text-dim);
    font-family: var(--font-display);
}
.gv-gap {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
    align-items: center;
    position: relative;
    padding-bottom: 22px;
}
.gv-gap-col {
    text-align: center;
    padding: 10px 6px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.gv-gap-col small { display: block; color: var(--text-dim); font-size: .68rem; }
.gv-gap-col.demand strong { color: #2b7fff; }
.gv-gap-col.supply strong { color: #c45c26; }
.gv-gap-arrow { color: var(--text-dim); font-size: 1.1rem; }
.gv-gap-tag {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    margin: auto;
    width: fit-content;
    font-size: .72rem;
    font-weight: 800;
    color: #0d7a3a;
    background: rgba(18, 161, 80, 0.12);
    padding: 2px 10px;
    border-radius: 99px;
}
.gv-ops ol {
    margin: 0;
    padding: 0 1.1rem 0 0;
    font-size: .82rem;
    line-height: 1.9;
}
.gv-graph { display: grid; place-items: center; }
.gv-watch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    padding: 18px 12px;
}
.gv-watch-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(43, 127, 255, 0.12);
    color: #2b7fff;
    border: 1px solid rgba(43, 127, 255, 0.22);
}
.gv-watch strong { font-size: .92rem; }
.gv-watch small { color: var(--text-dim); font-size: .72rem; line-height: 1.5; }

.guide-join { list-style: none; }
.guide-join-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(43, 127, 255, 0.12), rgba(18, 161, 80, 0.08)),
        #fff;
    border: 1px solid rgba(43, 127, 255, 0.22);
}
.guide-join-inner p {
    margin: 0;
    font-weight: 600;
    line-height: 1.7;
    max-width: 34rem;
}
.guide-finale {
    margin-top: 36px;
    padding: 28px 22px;
    border-radius: 18px;
    background: linear-gradient(165deg, #07122e, #122a55);
    color: #fff;
    text-align: center;
}
.guide-finale h2 { margin: 0 0 10px; font-size: 1.35rem; }
.guide-finale p {
    margin: 0 auto 18px;
    max-width: 34rem;
    line-height: 1.75;
    color: rgba(220, 232, 255, 0.88);
}
.guide-finale .btn.ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}
.card.has-hint {
    position: relative;
}
.card-hint {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(91, 101, 122, 0.72);
    font-family: "Vazirmatn", "Tahoma", sans-serif;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: normal;
    cursor: help;
    transition: color .15s ease, background .15s ease;
}
.card-hint:hover,
.card-hint:focus-visible {
    color: var(--accent-2);
    background: rgba(43, 127, 255, 0.08);
    outline: none;
}
.card-hint-icon {
    display: block;
}
.card-hint-tip {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: max-content;
    max-width: min(280px, 72vw);
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 22, 48, 0.96);
    color: rgba(236, 242, 255, 0.94);
    font-family: "Vazirmatn", "Tahoma", sans-serif !important;
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.75;
    letter-spacing: 0;
    text-align: right;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 12px 32px rgba(7, 18, 46, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
    pointer-events: none;
    direction: rtl;
}
.card-hint-tip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 10px;
    border: 5px solid transparent;
    border-bottom-color: rgba(11, 22, 48, 0.96);
}
.card-hint:hover .card-hint-tip,
.card-hint:focus-visible .card-hint-tip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/* Keep room so titles/edit controls don't sit under the control. */
.card.has-hint > h2,
.card.has-hint > .section-head {
    padding-inline-end: 36px;
}
.landing-secondary-sep {
    margin: 0 10px;
    opacity: .45;
    color: rgba(180, 208, 255, 0.8);
}

@media (max-width: 700px) {
    .guide-step {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .guide-visual { justify-items: start; }
}

.landing-hero {
    position: relative;
    overflow: hidden;
    min-height: min(92vh, 760px);
    display: grid;
    place-items: center;
    padding: 48px 20px 96px;
    background:
        radial-gradient(ellipse 55% 45% at 72% 18%, rgba(43, 127, 255, 0.38), transparent 62%),
        radial-gradient(ellipse 40% 35% at 12% 78%, rgba(20, 90, 200, 0.32), transparent 58%),
        linear-gradient(168deg, #040a1c 0%, #0a1638 48%, #122a55 100%);
    color: #fff;
}

.landing-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--hero-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 75% 70% at 50% 42%, #000 15%, transparent 72%);
    pointer-events: none;
}

.landing-hero-glow {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -52%);
    background: radial-gradient(circle, rgba(43, 127, 255, 0.22), transparent 68%);
    filter: blur(8px);
    animation: landing-pulse 7s ease-in-out infinite;
    will-change: transform, opacity;
    pointer-events: none;
}

/* The turning goods, behind everything the reader is actually here for.
   Between the hero's own glow and the headline, never above either, and
   with no pointer surface of its own.

   This used to be hidden below 768 px on the assumption that the band was
   all headline on a phone.  It is not: at 375 the canvas is 375x315, the
   object sits behind the logo and the headline without crowding either,
   and the frame budget is untouched.  The phone loads a smaller set of
   objects instead — see hero-objects.js. */
.hero-objects {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.landing-hero-inner {
    position: relative;
    z-index: 2;
    width: min(680px, 100%);
    text-align: center;
}

.landing-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    animation: landing-rise .7s ease both;
}

.landing-mark {
    height: clamp(64px, 30px + 5.5vw, 112px);
    width: auto;
    filter: drop-shadow(0 10px 28px rgba(43, 127, 255, 0.45));
}

.landing-headline {
    margin: 0 auto;
    max-width: 36rem;
    font-size: clamp(1.25rem, 0.9rem + 1.3vw, 2.05rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.5;
    color: rgba(236, 242, 255, 0.95);
}

.landing-rotator {
    display: grid;
    place-items: center;
    min-height: 3.2em;
}
.landing-rotator-item {
    grid-area: 1 / 1;
    margin: 0;
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    visibility: hidden;
}
.landing-rotator-item.is-active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    animation: landing-rise .7s ease both;
}
.landing-rotator-item.is-leaving {
    opacity: 0;
    visibility: visible;
    animation: landing-fall .45s ease both;
}

.landing-headline + .landing-secondary { margin-top: 28px; }

.landing-search {
    animation: landing-rise .8s .16s ease both;
}

.landing-search-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    background: var(--bg-card);
    border-radius: 16px;
    padding: 8px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 22px 60px rgba(0, 0, 0, 0.35);
    transition: box-shadow .2s ease, transform .2s ease;
}
.landing-search-row:focus-within {
    transform: translateY(-1px);
    box-shadow:
        0 0 0 2px rgba(43, 127, 255, 0.45),
        0 26px 70px rgba(0, 0, 0, 0.38);
}

.landing-search-row .landing-keyword,
.landing-search-row input {
    flex: 1;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 14px 18px;
    font-size: 1.08rem;
    color: var(--text);
}

.landing-cta {
    flex-shrink: 0;
    border-radius: 12px;
    padding-inline: 26px;
    white-space: nowrap;
    font-size: 1.02rem;
}

.landing-search .errorlist {
    text-align: start;
    margin-top: 10px;
    color: #ffb4b4;
}

.landing-advanced {
    margin-top: 16px;
    text-align: start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 4px 14px 0;
    backdrop-filter: blur(8px);
}

.landing-advanced summary {
    cursor: pointer;
    color: rgba(220, 230, 255, 0.72);
    font-size: .9rem;
    padding: 10px 0;
    list-style: none;
}

.landing-advanced summary::-webkit-details-marker { display: none; }
.landing-advanced summary::before { content: "▸ "; }
.landing-advanced[open] > summary::before { content: "▾ "; }
.landing-advanced[open] { padding-bottom: 14px; }

.landing-advanced label { color: rgba(220, 230, 255, 0.7); }
.landing-advanced .field-inline label { color: #fff; }
.landing-advanced .input,
.landing-advanced select,
.landing-advanced input[type="number"] {
    background: rgba(6, 13, 38, 0.45);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.landing-advanced .muted,
.landing-advanced .field-note { color: rgba(200, 212, 240, 0.65); }

.landing-secondary {
    margin: 24px 0 0;
    animation: landing-rise .8s .22s ease both;
}
.landing-secondary a {
    color: #b4d0ff;
    font-weight: 700;
    font-size: .95rem;
    border-bottom: 1px solid rgba(180, 208, 255, 0.35);
    padding-bottom: 2px;
}
.landing-secondary a:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-decoration: none;
}

.landing-hero-visual {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.hero-preview {
    position: absolute;
    width: min(220px, 28vw);
    padding: 14px 16px 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    /* Fixed ink: this card is white on the hero's dark gradient in both
       themes, so it must not follow `--text` into light. */
    color: #12182a;
    animation: landing-drift 7s ease-in-out infinite;
}
.hero-preview-name {
    display: block;
    font-weight: 800;
    font-size: .95rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hero-preview-growth {
    display: block;
    font-family: var(--font-display);
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.hero-preview-growth.up { color: var(--growth); }
.hero-preview-growth.down { color: var(--danger); }
.hero-preview-growth.flat { color: var(--text-dim); }
.hero-preview-chart {
    height: 44px;
    overflow: hidden;
}
.hero-preview-chart svg,
.hero-preview .sparkline {
    width: 100%;
    height: 100%;
    display: block;
}
.hero-preview.hp1 { top: 12%; inset-inline-start: 5%; transform: rotate(-4deg); }
.hero-preview.hp2 { top: 10%; inset-inline-end: 6%; animation-delay: .5s; transform: rotate(3deg); }
.hero-preview.hp3 { top: 42%; inset-inline-start: 3%; width: min(190px, 24vw); animation-delay: .25s; transform: rotate(-2deg); }
.hero-preview.hp4 { top: 38%; inset-inline-end: 4%; width: min(200px, 25vw); animation-delay: .7s; transform: rotate(2.5deg); }
.hero-preview.hp5 { bottom: 10%; inset-inline-start: 18%; width: min(180px, 23vw); animation-delay: .35s; transform: rotate(-3deg); }
.hero-preview.hp6 { bottom: 12%; inset-inline-end: 16%; width: min(185px, 23vw); animation-delay: .9s; transform: rotate(1.5deg); }

@media (max-width: 1100px) {
    .hero-preview.hp5,
    .hero-preview.hp6 { display: none; }
}
@media (max-width: 900px) {
    .hero-preview.hp3,
    .hero-preview.hp4 { display: none; }
}

@keyframes landing-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes landing-fall {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-12px); }
}
@keyframes landing-drift {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -14px; }
}
@keyframes landing-pulse {
    0%, 100% { opacity: .55; transform: translate(-50%, -52%) scale(1); }
    50% { opacity: .95; transform: translate(-50%, -52%) scale(1.06); }
}

.discover-block {
    position: relative;
    margin: 0;
    padding: 72px max(18px, calc((100% - 1180px) / 2)) 48px;
    background: var(--bg);
    color: var(--text);
}
.discover-block::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 220px;
    background: radial-gradient(ellipse at center top, rgba(43, 127, 255, 0.08), transparent 70%);
    pointer-events: none;
}

.discover-head {
    position: relative;
    text-align: center;
    margin-bottom: 34px;
}
.discover-head h2 {
    margin: 0;
    font-size: clamp(1.65rem, 3.2vw, 2.2rem);
    letter-spacing: -0.02em;
}
.discover-head .muted { margin: 10px auto 0; max-width: 28rem; }

.reveal-grid .topic-card {
    animation: none;
}

.discover-more {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin: 36px 0 0;
}
body.landing .discover-more .btn.ghost {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
body.landing .discover-more .btn.ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

.discover-empty {
    text-align: center;
    padding: 44px 20px;
}

.ops-panel {
    max-width: 1180px;
    margin: 0 auto 56px;
    padding: 0 18px;
}
body.landing .ops-panel {
    max-width: none;
    margin: 0;
    padding: 8px max(18px, calc((100% - 1180px) / 2)) 56px;
    background: var(--bg);
}
body.landing .ops-panel > details {
    max-width: 1180px;
    margin-inline: auto;
}
.ops-panel > details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 4px 18px 0;
}
.ops-panel summary {
    cursor: pointer;
    padding: 14px 0;
    color: var(--text-dim);
    font-weight: 600;
    list-style: none;
}
.ops-panel summary::-webkit-details-marker { display: none; }
.ops-panel summary::before { content: "▸ "; }
.ops-panel details[open] > summary::before { content: "▾ "; }
.ops-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-bottom: 16px;
}
.ops-grid .card { margin: 0; box-shadow: none; }

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; }
    .nav-primary { margin-inline-end: 0; order: 3; }
    .nav-tools { order: 4; }
    .landing-search-row { flex-direction: column; }
    .hero-preview { display: none; }
    .ops-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .landing-hero { min-height: auto; padding: 40px 16px 72px; }
    .landing-mark { height: 64px; }
    .landing-headline { max-width: none; }
}

/* ---- the hero at three sizes ----------------------------------------- */
/* Desktop: the band is the whole first screen, minus the bar above it.
   Tablet: four smaller cards pinned to the corners.  Phone: a taller band
   than before, so two compact cards — name and change, no curve — sit
   above and below the words without touching them. */
.landing-hero { min-height: clamp(560px, calc(100svh - 64px), 960px); }

/* A card the particle stream runs into lights up for a moment
   (hero-objects.js adds the class), as if a reading had just arrived. */
/* The glow lives on a pseudo-element whose only moving part is its
   opacity, so lighting a card up is a compositor fade — no repaint of the
   card, its shadow or its curve. */
.hero-preview::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 30px rgba(84, 206, 226, .34);
    opacity: 0;
    transition: opacity 1.1s ease;
    pointer-events: none;
}
.hero-preview.is-fed::after { opacity: 1; }

@media (max-width: 900px) and (min-width: 641px) {
    .hero-preview { display: block; width: min(170px, 24vw); padding: 10px 12px 8px; }
    .hero-preview.hp1 { top: 5%; inset-inline-start: 3%; }
    .hero-preview.hp2 { top: 5%; inset-inline-end: 3%; }
    .hero-preview.hp3 { display: block; top: auto; bottom: 6%; inset-inline-start: 3%; width: min(170px, 24vw); }
    .hero-preview.hp4 { display: block; top: auto; bottom: 6%; inset-inline-end: 3%; width: min(170px, 24vw); }
    .hero-preview.hp5,
    .hero-preview.hp6 { display: none; }
    .hero-preview-chart { height: 32px; }
}
@media (max-width: 640px) {
    .landing-hero { min-height: min(80svh, 700px); padding: 104px 16px 112px; }
    .hero-preview.hp1,
    .hero-preview.hp2 {
        display: block;
        width: auto;
        max-width: 48vw;
        padding: 8px 12px;
        border-radius: 14px;
    }
    .hero-preview.hp1 { top: 20px; inset-inline-start: 14px; }
    .hero-preview.hp2 { top: auto; bottom: 22px; inset-inline-end: 14px; }
    .hero-preview .hero-preview-chart { display: none; }
    .hero-preview .hero-preview-growth { margin-bottom: 0; }
    .hero-preview .hero-preview-name { font-size: .86rem; }
}

/* ---- the numbered grid under the hero --------------------------------- */
.discover-grid {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.discover-tile a {
    display: grid;
    grid-template-columns: 10px auto minmax(0, 1fr) 84px auto;
    align-items: start;
    gap: 12px;
    height: 100%;
    box-sizing: border-box;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.discover-tile a:hover,
.discover-tile a:focus-visible {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(43, 127, 255, .12);
}
.discover-dot { width: 9px; height: 9px; margin-top: 8px; border-radius: 50%; background: var(--text-dim); }
.discover-tile.up .discover-dot { background: var(--growth); }
.discover-tile.down .discover-dot { background: var(--danger); }
.discover-no {
    margin-top: 3px;
    font-family: var(--font-display);
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: .04em;
}
.discover-text { display: grid; gap: 3px; min-width: 0; }
.discover-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.discover-name {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* One line, cut with an ellipsis rather than wrapped: wrapping split
   «۵۳٪ اوج» across two lines on a narrow tile. */
.discover-line {
    font-size: .82rem;
    color: var(--text-dim);
    line-height: 1.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Under the name and the curve both, from the number's column to the
   arrow's, so two lines hold a sentence and not half of one. */
.discover-summary {
    grid-column: 3 / -1;
    margin-top: -2px;
    font-size: .8rem;
    line-height: 1.85;
    color: var(--text);
    opacity: .78;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.discover-flag {
    flex: 0 0 auto;
    display: inline-block;
    padding: 0 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    color: #c45c0d;
    background: rgba(226, 109, 20, .12);
}
.discover-flag.spark { color: var(--spark, #0a9bd8); background: rgba(10, 155, 216, .12); }
.discover-spark { display: block; height: 30px; align-self: center; }
.discover-spark svg { width: 100%; height: 100%; display: block; }
.discover-arrow {
    align-self: center;
    color: var(--text-dim);
    font-size: 1.05rem;
    transition: transform .18s ease, color .18s ease;
}
.discover-tile a:hover .discover-arrow { color: var(--accent); transform: translateX(-3px); }
:root[data-theme="dark"] .discover-flag:not(.spark) { color: #f09d5c; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .discover-flag:not(.spark) { color: #f09d5c; }
}
@media (max-width: 1100px) {
    .discover-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .discover-grid { grid-template-columns: 1fr; gap: 10px; }
    .discover-tile a { grid-template-columns: 10px auto minmax(0, 1fr) 64px; padding: 14px; gap: 10px; }
    .discover-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .discover-tile a,
    .discover-arrow { transition: none; }
    .landing-brand,
    .landing-headline,
    .landing-search,
    .landing-secondary,
    .reveal-grid .topic-card,
    .hero-preview,
    .landing-hero-glow,
    .hero-objects,
    .landing-rotator-item,
    .landing-rotator-item.is-active,
    .landing-rotator-item.is-leaving {
        animation: none !important;
    }
    .landing-rotator-item:not(.is-active) {
        display: none;
    }
    .landing-rotator-item.is-active {
        opacity: 1;
        transform: none;
        visibility: visible;
    }
}

/* ---- health dashboard ----------------------------------------------- */
.health-head { margin-bottom: 8px; }
.health-summary .stat .value { font-size: 1.15rem; min-height: 1.6em; }
.health-summary .stat small { display: block; margin-top: 4px; }
.health-quota { font-family: var(--font-display); letter-spacing: -0.02em; }
.health-quota small { font-size: .55em; color: var(--text-dim); font-weight: 600; }

.pulse {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
    box-shadow: 0 0 0 4px rgba(18, 161, 80, 0.12);
}
.pulse.ok { background: var(--growth); box-shadow: 0 0 0 4px rgba(18, 161, 80, 0.14); }
.pulse.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.14); }
.pulse.bad { background: var(--danger); box-shadow: 0 0 0 4px rgba(220, 74, 74, 0.14); }

.health-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0 32px;
}
.health-card-wide { grid-column: 1 / -1; }
.health-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-inline-start: 4px solid var(--border);
}
.health-card.is-ok { border-inline-start-color: var(--growth); }
.health-card.is-warn { border-inline-start-color: var(--warn); }
.health-card.is-bad { border-inline-start-color: var(--danger); }
.health-card.is-neutral { border-inline-start-color: var(--accent); }
.health-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.health-card-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-family: var(--font-display);
}
.health-detail {
    margin: 0 0 12px;
    color: var(--text-dim);
    font-size: .92rem;
    line-height: 1.7;
}
.health-meta {
    display: grid;
    gap: 10px;
    margin: 0 0 12px;
}
.health-meta-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.health-meta > div {
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 10px 12px;
}
.health-meta dt {
    margin: 0;
    font-size: .78rem;
    color: var(--text-dim);
    font-weight: 600;
}
.health-meta dd {
    margin: 4px 0 0;
    font-weight: 700;
    word-break: break-word;
}
.health-meta code {
    font-size: .85em;
    background: transparent;
    padding: 0;
}
.health-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px;
}
.health-chip {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(43, 127, 255, 0.1);
    color: var(--accent-2);
    font-size: .85rem;
    font-weight: 600;
}
.health-chain-arrow {
    color: var(--text-dim);
    font-size: .85rem;
}
.health-foot { margin: 8px 0 0; font-size: .9rem; }
.health-meter { margin: 4px 0 16px; }
.health-meter-track {
    height: 12px;
    border-radius: 999px;
    background: var(--bg-soft);
    overflow: hidden;
    border: 1px solid var(--border);
}
.health-meter-track i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: inherit;
    min-width: 0;
    transition: width .35s ease;
}
.health-meter-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: .85rem;
    color: var(--text-dim);
}
.health-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
.health-table th,
.health-table td {
    text-align: start;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
}
.health-table th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: .8rem;
}
.health-table tr:last-child td { border-bottom: none; }

@media (max-width: 800px) {
    /* minmax(0, …), as on the desktop rule: a bare 1fr lets the widest
       content set the column, and the address table pushed it — and the
       whole page — out to 541px on a 375px phone. */
    .health-grid { grid-template-columns: minmax(0, 1fr); }
    .health-card-wide { grid-column: auto; }
}

/* —— Users management —— */
.users-page { display: grid; gap: 20px; }
.users-head h1 { margin-bottom: 4px; }
.users-head .muted { margin: 0; max-width: 42rem; }

.users-setup {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 960px) {
    .users-setup { grid-template-columns: 1fr; }
}

.users-create h2,
.users-tools h2,
.users-directory-head h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
}
.users-create-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}
.users-create-grid .field:last-child { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .users-create-grid { grid-template-columns: 1fr; }
    .users-create-grid .field:last-child { grid-column: auto; }
}

.users-tools-lead { margin: 0 0 14px; font-size: .9rem; }
.users-tool-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.users-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    font-size: .9rem;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s ease, background .15s ease;
}
.users-tool-chip:has(input:checked) {
    border-color: rgba(43, 127, 255, 0.45);
    background: rgba(43, 127, 255, 0.08);
}
.users-tool-chip input {
    width: auto;
    margin: 0;
    accent-color: var(--accent);
}

.users-directory { padding: 0; overflow: visible; }
.users-directory-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}
.users-directory-head h2 { margin: 0; }
.users-directory-head .muted { font-size: .88rem; }

.users-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.user-row {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    overflow: visible;
}
.user-row:last-child { border-bottom: none; }
.user-row.is-self { background: rgba(43, 127, 255, 0.04); }
.user-row.is-inactive { opacity: .72; }
.users-empty { padding: 28px 20px; text-align: center; }

.user-row-main {
    display: grid;
    grid-template-columns: minmax(12rem, 1.4fr) minmax(11rem, auto) auto;
    gap: 14px 18px;
    align-items: center;
}
@media (max-width: 860px) {
    .user-row-main {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

.user-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.user-avatar {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(145deg, #1a5fd4, #2b7fff);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: 0;
}
.user-identity-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.user-name-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.user-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.user-fullname,
.user-login {
    font-size: .82rem;
    line-height: 1.5;
}

.user-role-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-width: 0;
}
.user-role-form .input {
    width: auto;
    min-width: 7.5rem;
    flex: 1 1 auto;
    padding: 7px 10px;
    font-size: .92rem;
}
.user-role-form .btn { flex: 0 0 auto; }

.user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: flex-start;
    margin: 0;
}
.user-actions form { margin: 0; }

.user-password {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.user-password > summary {
    list-style: none;
    user-select: none;
    width: fit-content;
}
.user-password > summary::-webkit-details-marker { display: none; }
.user-password[open] > summary {
    border-color: rgba(43, 127, 255, 0.45);
    color: var(--accent-2);
}
.user-password-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
}
.user-password-form .input {
    flex: 1 1 10rem;
    min-width: 8rem;
    max-width: 16rem;
    padding: 8px 10px;
    font-size: .92rem;
}
.user-password-form .btn { flex: 0 0 auto; }

/* ---- The light/dark switch --------------------------------------------- */

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-dim);
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.theme-icon { width: 18px; height: 18px; grid-area: 1 / 1; }

/* Which icon shows is driven by `aria-pressed`, the same attribute a screen
   reader is given, so the two can never disagree. */
.theme-toggle .theme-icon-moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-icon-sun { display: none; }
.theme-toggle[aria-pressed="true"] .theme-icon-moon { display: block; }

/* ---- Dark: the few places a literal survives ---------------------------- */

/* The wordmark file is white, and `.brand-mark` blackens it for the light
   top bar.  On a dark bar that filter has to come off or the logo is black
   on near-black — the same reason the landing bar already undoes it.  One
   rule rather than a second image file, so there is only ever one logo to
   replace. */
:root[data-theme="dark"] .brand-mark { filter: none; }
:root[data-theme="dark"] .signin-brand img { filter: none; }


/* The report's long-form prose is set on a white sheet in light; in dark the
   sheet goes with it rather than staying a white rectangle on a dark page. */
:root[data-theme="dark"] img.invertible { filter: invert(1) hue-rotate(180deg); }

/* Plotly and vis-network draw into these; they are given the token values by
   report.js, but the containers themselves are ours. */
:root[data-theme="dark"] .js-plotly-plot .plotly .modebar-btn path { fill: var(--text-dim); }
:root[data-theme="dark"] .js-plotly-plot .plotly .modebar-btn:hover path { fill: var(--accent); }

/* The sign-in page carries no top bar, so its switch sits in the corner. */
.signin-theme {
    position: absolute;
    top: 18px;
    inset-inline-start: 18px;
    z-index: 5;
}

/* ---- What a trend sells ------------------------------------------------ */

.commerce-shelves { margin: 0 0 12px; }

/* Product names are short — «کلاه برت زنانه», «شلف کافی بار» — so a stack of
   full-width rows was mostly empty rectangle.  They pack as pills instead,
   each one as wide as its own name, which is also how every other list of
   terms on this page behaves. */
.commerce-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.commerce-list li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-soft);
    font-size: .9rem;
    transition: border-color .15s ease, background .15s ease;
}
.commerce-list li:hover { border-color: var(--accent); background: var(--bg-card); }
.commerce-list a { color: var(--text); text-decoration: none; }
.commerce-list a:hover { color: var(--accent); text-decoration: none; }
/* The marker for a product that came out of a shop's article rather than
   its own listing: a dot, because the words were longer than the names. */
.commerce-list .badge {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    font-size: 0;
    flex: 0 0 6px;
}

/* ---- "What is it for" ---------------------------------------------------- */

.uses-page { max-width: 880px; margin: 0 auto; }
.uses-page h2 { margin: 34px 0 14px; }
.uses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 14px;
}
.uses-card { margin: 0; }
.uses-card h3 { margin: 0 0 8px; color: var(--accent); }
.uses-card p { margin: 0; color: var(--text-dim); }
.uses-cta { margin-top: 30px; text-align: center; }
.uses-cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0 0; }

/* ---- The tour: one real report, walked through -------------------------- */

.tour-headline {
    margin: 14px 0 0;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--bg-soft);
    line-height: 1.9;
}
.tour-note { margin: 12px 0 0; font-size: .86rem; }

.tour-jump {
    display: inline-block;
    margin-top: 10px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--accent);
}

/* The real prose, clipped to a taste of it. */
.tour-prose {
    text-align: start;
    line-height: 1.95;
    font-size: .92rem;
    color: var(--text-dim);
    max-height: 230px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, #000 68%, transparent);
    mask-image: linear-gradient(180deg, #000 68%, transparent);
}
.tour-prose h2, .tour-prose h3 { margin: 0 0 8px; font-size: 1rem; color: var(--text); }

.tour-stats { display: flex; gap: 10px; justify-content: space-between; text-align: center; }
.tour-stats strong { display: block; font-size: 1.3rem; font-weight: 800; }
.tour-stats strong.up { color: var(--growth); }
.tour-stats small { color: var(--text-dim); font-size: .78rem; }

.tour-season { display: grid; gap: 9px; }
.tour-season-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.tour-season-row span { color: var(--text-dim); font-size: .86rem; }
.tour-season-row b { font-size: 1.02rem; }
.tour-season-row b.up { color: var(--growth); }

/* Province ranks, each with its own share as a bar behind the number. */
.tour-ranks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tour-ranks li { display: grid; grid-template-columns: 1fr 86px auto; align-items: center; gap: 10px; font-size: .88rem; }
.tour-ranks i {
    display: block;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) var(--w), var(--border) var(--w));
}
.tour-ranks b { font-variant-numeric: tabular-nums; color: var(--text-dim); font-weight: 600; }

.tour-chips, .tour-shops, .tour-products { display: flex; flex-wrap: wrap; gap: 7px; }
.tour-shops .chip, .tour-products .chip { font-size: .8rem; }

/* A chip is `white-space: nowrap`, and as a flex item it is `min-width: auto`
 * — so it refuses to shrink and simply hangs out of the card.  These cards are
 * a fixed 200px with 12px of padding, and real product names do not fit: «کاپشن
 * مردانه چرم پفی کلاهدار MQ» measured 212px against 176px of room and hung 37px
 * past the edge.  The names are already shortened server-side, but no fixed
 * length is right for a box this narrow, so the chip clips its own text and
 * shows that it did.  `max-width` on an inline box is what makes the ellipsis
 * possible at all. */
.tour-chips .chip,
.tour-shops .chip,
.tour-products .chip {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.tour-finale { border-color: var(--accent); }

/* ---- The settings page ---------------------------------------------------- */

.settings-group { display: block; margin-bottom: 26px; }
.settings-group-title {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
    color: var(--text-dim);
    font-weight: 700;
}
.settings-credit { margin-bottom: 10px; }
.settings-token-form { display: grid; gap: 6px; margin-top: 14px; }
.settings-token-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ---- The guided tour ------------------------------------------------------
   One lit section at a time, with the rest of the page dimmed behind it.  The
   dimming is a single box with a very large outer shadow, so the hole is the
   element itself rather than four strips that have to agree with each other. */

body.tour-running { overflow-x: hidden; }

.tour-root { position: absolute; inset: 0; z-index: 2000; pointer-events: none; }

.tour-spot {
    position: absolute;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(4, 10, 24, 0.74);
    outline: 2px solid var(--accent);
    outline-offset: 0;
    transition: top .28s ease, left .28s ease, width .28s ease, height .28s ease;
}

.tour-bubble {
    position: absolute;
    width: min(380px, calc(100vw - 28px));
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    pointer-events: auto;
    transition: top .28s ease, left .28s ease;
}
.tour-bubble::after {
    content: "";
    position: absolute;
    inset-inline-start: calc(50% - 7px);
    top: -7px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: var(--bg-card);
    border-inline-start: 1px solid var(--border);
    border-top: 1px solid var(--border);
}
.tour-bubble.is-above::after {
    top: auto;
    bottom: -7px;
    border: 0;
    border-inline-end: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.tour-count { margin: 0 0 4px; font-size: .76rem; color: var(--accent); font-weight: 700; }
.tour-title { margin: 0 0 6px; font-size: 1.05rem; }
.tour-body { margin: 0; color: var(--text-dim); font-size: .92rem; line-height: 1.85; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-spacer { flex: 1; }
.tour-actions button[disabled] { opacity: .45; cursor: default; }

/* The invitation to take the tour, on the report it walks. */
.tour-invite {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 12px 16px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(43, 127, 255, .10), transparent);
}
.tour-invite p { margin: 0; flex: 1 1 260px; font-size: .92rem; }

@media (prefers-reduced-motion: reduce) {
    .tour-spot, .tour-bubble { transition: none; }
}

/* A card taller than the screen leaves nowhere to anchor the bubble, so it
   stops being anchored: fixed to the foot of the viewport, where the reader
   is already looking, with no arrow to point at a section that runs off the
   bottom of the screen. */
.tour-bubble.is-floating {
    position: fixed;
    top: auto;
    bottom: 18px;
    /* Physical `left`, not `inset-inline-start`: the transform is in screen
       coordinates either way, so pairing it with a logical property means
       the sign is only correct in one writing direction. */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
}
.tour-bubble.is-floating::after { display: none; }

/* «Fill this in» sits in a card's heading row, beside the edit control. */
.refill-form { margin: 0; }
.refill-button { white-space: nowrap; }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head > h2 { margin: 0; flex: 1; }

/* «Fill this in» sits in a card's heading row, beside the edit control. */
.refill-form { margin: 0; }
.refill-button { white-space: nowrap; }
.section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-head > h2 { margin: 0; flex: 1 1 auto; }

/* ---- Icons ----------------------------------------------------------------
   Inline SVG symbols, never an icon font: the page has to look the same when
   the link to the outside world is gone, and a webfont glyph is a blank box
   that day.  They take the colour and the size of the text beside them, so
   adding one to a label changes nothing else about the line. */

.icon {
    width: 1.05em;
    height: 1.05em;
    flex: 0 0 auto;
    vertical-align: -0.16em;
    color: inherit;
    fill: none;
    stroke: currentColor;
    pointer-events: none;
}
/* A label with an icon is a row, so the gap is even and nothing shifts when
   the text wraps. */
.nav-primary a,
.nav-tools-menu a,
.nav-tools > summary,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.nav-tools-menu a .icon { opacity: .75; }
.btn.small .icon { width: 1em; height: 1em; }

/* A card's own icon, in its heading.  Dimmed and a shade larger than a
   label's icon: it marks the section rather than decorating the words, so a
   reader scanning a long report finds the part they came for by shape. */
h2 > .icon.card-icon,
h3 > .icon.card-icon {
    width: 1.15em;
    height: 1.15em;
    margin-inline-end: 8px;
    color: var(--accent);
    opacity: .85;
}

/* A followed trend has been rebuilt since this member last opened it.  The
   dot rides on the link rather than displacing it, so the navigation does
   not reflow the moment a report finishes somewhere. */
.nav-watch { position: relative; }
.nav-dot {
    position: absolute;
    top: -2px;
    inset-inline-start: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--surface-bar);
}

/* «Rebuilt since you last looked», on a watchlist card. */
.card-updated {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}

/* ---- A run in progress ----------------------------------------------------
   The first stage spends minutes on Google Trends pacing with the number
   barely moving, so the bar is striped while a run is live: a still bar at
   1% reads as a dead one, and the stripes say «working» when the percentage
   cannot. */

.progress-bar.is-working {
    background-image: linear-gradient(
        115deg,
        rgba(255, 255, 255, .28) 25%, transparent 25%,
        transparent 50%, rgba(255, 255, 255, .28) 50%,
        rgba(255, 255, 255, .28) 75%, transparent 75%);
    background-size: 22px 22px;
    animation: run-stripes 1s linear infinite;
    min-width: 3px;
}
@keyframes run-stripes { to { background-position: 22px 0; } }

.run-stage { margin: 0 0 4px; font-weight: 600; }
.run-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .86rem; }
.run-sep { opacity: .5; }
/* Nothing has been logged for a while: say so rather than letting a cheerful
   animation imply progress that is not happening. */
#run-heartbeat.is-stalled { color: var(--warn); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
    .progress-bar.is-working { animation: none; }
}

/* «Sent to the server» — the ghost variant means the server already has
   this exact version, so the button is there to be read more than pressed. */
.push-button[disabled] { opacity: .5; }

/* The reveal button on password and API-key fields (js/password.js).
 *
 * The wrapper is added by that script, so none of this applies until it
 * runs — a browser without it sees the plain field it always saw.
 *
 * The side is decided by the field's own writing direction, not the page's:
 * the token boxes are dir="ltr" inside an RTL page, and a button on the
 * logical end would sit over the first characters typed.
 */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-inline-end: 0; }
.pw-wrap-ltr > input { padding-right: 40px; }
.pw-wrap-rtl > input { padding-left: 40px; }

.pw-reveal {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.pw-wrap-ltr > .pw-reveal { right: 5px; }
.pw-wrap-rtl > .pw-reveal { left: 5px; }
.pw-reveal:hover { color: var(--text); background: var(--bg-soft, rgba(127, 127, 127, .12)); }
.pw-reveal:focus-visible {
    outline: 2px solid rgba(43, 127, 255, 0.35);
    outline-offset: 1px;
    color: var(--text);
}
.pw-reveal .icon { width: 18px; height: 18px; }

/* ---- Phones and tablets ------------------------------------------------
 *
 * Six pages ran off the side of a phone — the keyword warehouse, the queue
 * and its detail, auto-discovery, settings and providers — and all six for
 * one reason.
 *
 * A grid or flex child is `min-width: auto` by default, which means it will
 * not shrink below the width of its content.  So a table that needs 563px
 * made its 339px card 605px wide, and the card took the page with it.  The
 * other four cards on the same page were fine; nothing was wrong with the
 * grid, which collapses to one column at 900px as it should.
 *
 * Hence two rules and no template changes: let the containers shrink, and
 * let a table that still cannot fit scroll by itself instead of widening
 * everything around it.  Cells keep `nowrap` on purpose — nine columns
 * squeezed into a phone are unreadable slivers, where a row that keeps its
 * shape and scrolls sideways is just a table on a small screen.
 */
@media (max-width: 860px) {
    .grid > *,
    .hero > *,
    .stat-row > *,
    .card { min-width: 0; }

    .card table,
    table.queue-table,
    table.momentum {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* The scroll area needs a visible edge, or it reads as a cut-off table. */
    .card table::-webkit-scrollbar,
    table.queue-table::-webkit-scrollbar { height: 6px; }
    .card table::-webkit-scrollbar-thumb,
    table.queue-table::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 999px;
    }
}

/* A phone showed «بازه» and «وضعیت» and left the comparison — the column
 * the table is for — off the edge, behind a sideways scroll nobody knew
 * was there.  Narrower than this, the in-period sparkline and the peak go:
 * the chart above already draws both, and what is left fits. */
@media (max-width: 560px) {
    table.momentum th:nth-child(4),
    table.momentum td:nth-child(4),
    table.momentum th:nth-child(6),
    table.momentum td:nth-child(6) { display: none; }
    table.momentum small { display: block; }
    /* The headers and the verdict pills were kept on one line, which alone
       made the four columns 400px; on a phone they may wrap. */
    table.momentum { white-space: normal; }
    table.momentum th,
    table.momentum td { padding-inline: 6px; }
    /* Same idea for a table whose columns move with the user's rights (the
       archive's «سرور»), where a column number would hide the wrong one:
       the template marks what can go. */
    .phone-off { display: none; }
    /* A list's first column is its name, and it took 566px: one line, plus
       the Google Trends link partial inside it.  Given a width and allowed
       to wrap, the name and its status share the screen and the rest is
       one swipe away. */
    table.queue-table th:first-child,
    table.queue-table td:first-child { width: 8.5em; max-width: 8.5em; white-space: normal; }
}

/* The knowledge graph on a phone was unlabelled dots in a 620px canvas
 * that took the swipe meant for the page.  It is left out there — the
 * clusters underneath say the same thing in words — and because the graph
 * is drawn only once it scrolls into view, a hidden one never loads its
 * library either. */
@media (max-width: 640px) {
    #graph,
    #card-graph .graph-hint { display: none; }
}

/* ---- «این ترند چه کالاهایی می‌فروشد؟» -----------------------------------
 *
 * Every other section on the page measures interest.  This is the only one
 * that names things somebody is actually selling, which is what the whole
 * report is for — and it looked exactly like the eight sections around it.
 *
 * Marked by frame and weight rather than by decoration: a rail in the colour
 * the site already uses for goods, a tinted heading strip, and a tally that
 * states what was found.  No prices and no product photos, which were both
 * tried and both rejected — the names and the shops are the useful part.
 */
.commerce-card {
    position: relative;
    overflow: hidden;
    border-color: rgba(18, 161, 80, .32);
}
.commerce-card::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--growth), rgba(18, 161, 80, .25));
}
.commerce-card .section-head { align-items: center; }
.commerce-card h2 .card-icon {
    color: var(--growth);
    width: 22px;
    height: 22px;
}

.commerce-tally {
    margin: 2px 0 16px;
    font-size: .95rem;
    color: var(--text-dim);
}
.commerce-tally b {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--growth);
    margin-inline-end: 2px;
}
.commerce-tally .sep { margin: 0 8px; opacity: .5; }

/* The products are the point of the card, so they read as the strongest
   thing in it rather than as another row of filter chips. */
.commerce-card .commerce-list li {
    background: var(--bg-card);
    border-color: rgba(18, 161, 80, .3);
    font-size: .95rem;
    padding: 8px 15px;
}
.commerce-card .commerce-list li:hover {
    border-color: var(--growth);
    background: rgba(18, 161, 80, .06);
}
.commerce-card .commerce-list a { font-weight: 600; }
.commerce-card .commerce-list a:hover { color: var(--growth); }

/* The standing reminder that the site is open to guests.  Deliberately not
   subtle: it is a temporary switch, and the settings page is the one place
   nobody looks at twice. */
/* Carries its own surface rather than tinting whatever is behind it.
 *
 * It used to be a 9% amber wash with `color: var(--text)`, which reads
 * everywhere except the one page it matters most on: the landing page sets
 * `background: #040a1c`, so a near-black `--text` landed on a near-black
 * page and the warning was invisible exactly where a visitor arrives.
 * An opaque surface cannot be undone by the page under it. */
.guest-open-banner {
    max-width: 1180px;
    margin: 14px auto 0;
    padding: 10px 16px;
    border: 1px solid rgba(217, 119, 6, .45);
    border-radius: 10px;
    background: #fff7ed;
    color: #7c2d12;
    font-size: .92rem;
}
.guest-open-banner b { color: #9a3412; }
.guest-open-banner a {
    margin-inline-start: 8px;
    font-weight: 600;
    color: #9a3412;
    text-decoration: underline;
}
:root[data-theme="dark"] .guest-open-banner {
    background: #2a1a08;
    color: #f5d9b8;
    border-color: rgba(217, 119, 6, .5);
}
:root[data-theme="dark"] .guest-open-banner b,
:root[data-theme="dark"] .guest-open-banner a { color: #f0b067; }

.preview-access.is-open { border-color: rgba(217, 119, 6, .45); }
.preview-state { margin: 0 0 14px; line-height: 1.8; }
.preview-state.open b { color: var(--warn); }

/* The way back from a report, so it is not the browser's own button.  A
   bordered control rather than a quiet link — it is the only way out of a
   page this long — and it sits with the other buttons rather than over the
   heading, where it was the first thing read and took the emphasis that
   belongs to the trend's own name. */
.back-link { display: inline-flex; align-items: center; gap: 6px; }
.back-link .icon { width: 15px; height: 15px; transform: scaleX(-1); }

/* ---- The title, kept in view ---------------------------------------------
 *
 * A report runs to nine sections; by the knowledge graph there was nothing on
 * screen saying which trend it belonged to.  The card sticks under the site
 * header — `--topbar-h` is measured in `js/report.js`, because the bar's
 * height changes with the signed-in state — and condenses once it does, since
 * the whole card would hold a third of the screen hostage.
 */
.report-head-sentinel { height: 1px; margin-bottom: -1px; }
.report-head-card {
    position: sticky;
    top: var(--topbar-h, 64px);
    z-index: 20;
    /* Only the shadow eases: report.js measures the card's height the moment
       it condenses, and a padding still mid-transition measured as the old
       one.  And never a scroll anchor — its own size changes on scroll. */
    transition: box-shadow .18s ease;
    overflow-anchor: none;
}
.report-head-card.is-stuck {
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: 0 6px 18px rgba(18, 24, 42, .08);
}
.report-head-card.is-stuck .report-head > div > p.muted,
.report-head-card.is-stuck .findable-inline,
.report-head-card.is-stuck .trends-route { display: none; }
.report-head-card.is-stuck h1 { font-size: 1.25rem; margin: 0; }
/* On a phone the stuck card is a name, not a toolbar: the rename button
   doubled its height.  It is still there at the top of the page. */
@media (max-width: 640px) {
    .report-head-card.is-stuck .title-edit { display: none; }
}

/* ---- Where this trend is findable ---------------------------------------
 *
 * One chip per window, under the title.  No label in front: «پیدا می‌شود در:»
 * named what the chips already show, and took a line of the header to do it.
 *
 * The windows disagree more often than not — «چاپستیک» falls across five
 * years and rises across three months — so they are laid out to be read
 * against each other rather than one at a time.
 */
.findable-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 10px;
}
/* Not a link, and nothing here may look like one: no hover background, no
   pointer, no link colour.  While these were links the row read as a filter
   the reader had switched on rather than a reading of the data. */
.findable-inline > .findable-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 4px 3px 8px;
}
.findable-inline .findable-window {
    color: var(--text-dim);
    font-size: .82rem;
    white-space: nowrap;
}
.findable-inline .pill { font-size: .78rem; padding: 2px 9px; }

@media (max-width: 560px) {
    .findable-inline { gap: 8px; }
    .findable-inline > .findable-row { padding-inline-start: 0; }
}

/* Stuck, the way back shrinks to its icon.  It is the one control worth
   keeping reachable while reading — the reader who wants to leave is three
   screens from where the button used to be — and as an icon it costs the
   width of a button rather than the width of a sentence. */
.report-head-card.is-stuck .back-link { padding-inline: 8px; }
.report-head-card.is-stuck .back-label { display: none; }

/* On a narrow screen the rest of the buttons wrap to a second row and the
   stuck card takes a third of the viewport, which is a high price for
   keeping them in reach.  They are a scroll away; the way out is not. */
@media (max-width: 700px) {
    .report-head-card.is-stuck .report-head .actions > *:not(.back-link) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .report-head-card { transition: none; }
}


/* The way back to the whole graph.  Dragging and zooming have no undo, and on
   sixty nodes it takes a few seconds to end up looking at two of them with no
   idea which way the rest went.  It appears only once the view has actually
   been moved: before the first drag there is nothing to go back to, and a
   control sitting over a picture from the start is one more thing to look
   past. */
/* The container has to be positioned for the button to sit inside the frame
   rather than fall out of flow below the canvas, which is what it does when
   this rule has not loaded yet. */
#graph { position: relative; }
.graph-reset {
    position: absolute;
    top: 10px;
    /* The visual left corner.  Spelled physically rather than with
       `inset-inline-end`, because the page is RTL and the two are easy to
       confuse when reading this back. */
    left: 10px;
    z-index: 2;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-dim);
    font-family: inherit;
    font-size: .82rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, color .15s ease, border-color .15s ease;
}
.graph-reset.is-on { opacity: 1; pointer-events: auto; }
.graph-reset:hover { color: var(--text); border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
    .graph-reset { transition: none; }
}

/* ===========================================================================
   The partnership page
   ---------------------------------------------------------------------------
   Read by somebody who has money at risk and has been sold a dashboard
   before, so it is laid out like a document rather than a landing page: one
   column, generous measure, and the two charts given room instead of being
   squeezed beside text.
   ======================================================================== */

.partners-page { max-width: 62rem; margin: 0 auto; }
.partners-page h1 { margin: 4px 0 18px; }
.partners-page h2 {
    margin: 44px 0 14px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.partners-page p { line-height: 2; }

/* The figures carry the argument, so they get the width and a quiet frame. */
.partners-figure {
    margin: 26px 0 8px;
    padding: 18px 18px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    box-shadow: var(--shadow);
}
.partners-figure svg { display: block; width: 100%; height: auto; }
.partners-figure figcaption {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: .88rem;
    line-height: 1.9;
}

.partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 18px;
}
.partner-step p { margin: 0; font-size: .93rem; line-height: 1.95; }
/* Number beside the heading, in the same flow.
   It was absolutely positioned with the card padded to clear it, which held
   only while the heading stayed one line at one font size — and it did not:
   the badge ran to 40px while the padding reserved 26px, so every title
   started underneath its own number. */
.step-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.partner-step h3 { margin: 0; font-size: 1.05rem; }
.step-no {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--card-tint);
    color: var(--accent-2);
    font-weight: 700;
    font-size: .82rem;
}

.partners-flow {
    margin: 18px 0 0;
    padding-inline-start: 1.3rem;
    line-height: 2.1;
}
.partners-flow li { margin-bottom: 10px; }

/* ---- the form ------------------------------------------------------- */
.partners-form { padding: 22px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-field { margin-bottom: 16px; min-width: 0; }
.form-field label {
    display: block;
    margin-bottom: 6px;
    font-size: .88rem;
    font-weight: 600;
}
.form-field .input,
.form-field input,
.form-field select,
.form-field textarea {
    box-sizing: border-box;
    width: 100%;
}
.form-field small { display: block; margin-top: 6px; line-height: 1.8; }
.form-field ul.errorlist {
    margin: 6px 0 0;
    padding-inline-start: 1.1rem;
    color: var(--danger);
    font-size: .84rem;
}
.partners-submit {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.partners-error {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: .9rem;
}
.partners-done { padding: 22px; border-inline-start: 4px solid var(--growth); }
.partners-done h3 { margin: 0 0 8px; }
.partners-done p { margin: 0; }

@media (max-width: 640px) {
    /* Two columns at this width is two unusable columns. */
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .partners-page h2 { margin-top: 32px; }
}

/* ---- «how this was found», at the foot of a report ------------------- */
.method-card { margin-top: 26px; }
.method-card h2 { margin-bottom: 18px; }
.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.method-step {
    padding: 16px 16px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
}
.method-step header { display: flex; align-items: center; gap: 10px; }
.method-step h3 { margin: 0; font-size: 1rem; }
.method-step > p { margin: 10px 0 12px; font-size: .9rem; line-height: 1.95; }
.method-no {
    flex: 0 0 auto;
    width: 24px; height: 24px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--accent); color: var(--accent-ink);
    font-size: .78rem; font-weight: 700;
}
/* Sources as chips: a dozen names read faster as a block than as a list. */
.method-sources {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 0; padding: 0; list-style: none;
}
.method-sources { gap: 8px; }
.method-sources li {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
}
/* The marks are other people's, in many shapes and two of them nearly
   white — the tile gives them a common frame so the row reads as a set. */
.method-sources img {
    width: 28px; height: 28px;
    object-fit: contain;
    display: block;
}
.method-mini { display: block; width: 100%; height: auto; margin: 4px 0 12px; }
.method-checks { margin: 0; padding-inline-start: 1.1rem; }
.method-checks li { font-size: .87rem; line-height: 1.9; margin-bottom: 6px; }
/* The ask at the foot of the method: a band in the accent's wash, with the
   button on the far side so the eye lands on it after the text. */
.method-cta {
    margin: 22px 0 0;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-radius: 14px;
    border: 1px solid rgba(43, 127, 255, .28);
    background:
        linear-gradient(135deg, rgba(43, 127, 255, .10), rgba(43, 127, 255, .03)),
        var(--bg-card);
}
.method-cta-body { display: flex; align-items: center; gap: 14px; min-width: 0; }
.method-cta-icon {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(43, 127, 255, .14);
    color: var(--accent-2);
}
.method-cta-icon .icon { width: 24px; height: 24px; }
.method-cta strong { display: block; font-size: 1.02rem; margin-bottom: 4px; }
.method-cta p { margin: 0; font-size: .88rem; line-height: 1.9; color: var(--text-dim); max-width: 40rem; }
.method-cta-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.method-cta-arrow { font-size: 1.05em; line-height: 1; transition: transform .15s ease; }
.method-cta-btn:hover .method-cta-arrow { transform: translateX(-3px); }
:root[data-theme="dark"] .method-cta { border-color: rgba(91, 156, 255, .35); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .method-cta { border-color: rgba(91, 156, 255, .35); }
}
@media (max-width: 640px) {
    .method-cta { flex-direction: column; align-items: stretch; padding: 16px; }
    .method-cta-btn { justify-content: center; }
}

/* ---- Instagram reels on a report ------------------------------------ */
/* Under the demand and supply pair, across both columns, so the pair
   stays side by side whatever else the report has. */
.grid.two > .reels-card { grid-column: 1 / -1; }
/* The Telegram card too: alone in its row it left the other column empty.
   Across the row, its figures and its sample posts sit side by side. */
.grid.two > .telegram-card { grid-column: 1 / -1; }
.reels-note { font-size: .88rem; line-height: 1.95; margin: 4px 0 14px; }
.reels-vpn { display: block; margin-top: 4px; font-size: .78rem; opacity: .85; }
.reels-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}
.reel {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
}
.reel-link {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: var(--text);
}
.reel-link:hover { color: var(--accent); text-decoration: none; }
/* Instagram's glyph in its own gradient, no tile behind it — the one
   place on the page that wears a brand's colours, because it is there to
   say whose content this is. */
.reel-icon { display: inline-grid; place-items: center; margin-top: 3px; }
.reel-icon .icon { width: 20px; height: 20px; }
.reels-title-icon { color: #d6249f; }
.reel-caption {
    font-size: .88rem;
    line-height: 1.9;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.reel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding-inline-start: 30px;
    font-size: .78rem;
    color: var(--text-dim);
}
.reel-meta a { color: var(--text-dim); }
.reel-meta a:hover { color: var(--accent); }

/* ---- the partnership inbox ------------------------------------------ */
.inbox-head { margin-bottom: 14px; align-items: flex-end; }
.inbox-head .topics-lead { max-width: 44rem; }
.inbox-head .chip small { color: inherit; opacity: .75; margin-inline-start: 3px; }
.inbox-list { display: grid; gap: 14px; }
.inbox-item { padding: 18px 20px; border-inline-start: 4px solid var(--border); }
.inbox-item.status-new { border-inline-start-color: var(--warn); }
.inbox-item.status-active { border-inline-start-color: var(--growth); }
.inbox-item.status-contacted { border-inline-start-color: var(--accent); }
.inbox-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.inbox-who h2 { margin: 0 0 4px; font-size: 1.1rem; }
.inbox-who .muted { margin: 0; font-size: .9rem; }
.inbox-meta { display: flex; align-items: center; gap: 10px; font-size: .85rem; white-space: nowrap; }
.inbox-status.new { background: rgba(214, 143, 0, .12); color: var(--warn); border-color: rgba(214, 143, 0, .3); }
.inbox-status.contacted { background: rgba(43, 127, 255, .10); color: var(--accent-2); border-color: rgba(43, 127, 255, .3); }
.inbox-status.active { background: rgba(18, 161, 80, .12); color: var(--growth); border-color: rgba(18, 161, 80, .28); }
.inbox-status.closed { background: transparent; color: var(--text-dim); border-color: var(--border); }
.inbox-body {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
    gap: 18px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.inbox-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.inbox-facts dt { font-size: .78rem; color: var(--text-dim); margin-bottom: 2px; }
.inbox-facts dd { margin: 0; font-size: .95rem; line-height: 1.8; }
.inbox-facts dd[dir="ltr"] { text-align: left; }
.inbox-goal { grid-column: 1 / -1; }
.inbox-goal dd { color: var(--text); background: var(--bg-soft); border-radius: 10px; padding: 8px 12px; }
.inbox-form { display: grid; grid-template-columns: 1fr; gap: 10px; align-content: start; }
.inbox-form label { display: grid; gap: 4px; font-size: .85rem; color: var(--text-dim); }
.inbox-form .input { width: 100%; box-sizing: border-box; }
.inbox-form textarea { resize: vertical; min-height: 56px; }
.inbox-form .btn { justify-self: start; }
@media (max-width: 760px) {
    .inbox-body { grid-template-columns: 1fr; }
    .inbox-facts { grid-template-columns: 1fr; }
}

/* ---- the landing page's one ask ------------------------------------- */
/* Sits on the dark landing background, so it carries its own light surface
   rather than inheriting a palette built for the pale pages. */
.landing-partners {
    padding: 56px 24px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.landing-partners-inner { max-width: 46rem; margin: 0 auto; text-align: center; }
.landing-partners h2 { margin: 6px 0 12px; }
.landing-partners p { margin: 0 0 20px; line-height: 2; color: var(--text-dim); }

.uses-more { margin: 10px 0 0; }
.uses-more a { font-weight: 600; }

/* Chart legends live in HTML, not in <text>.
   SVG text neither wraps nor resolves bidi, so a Persian sentence anchored
   to a frame edge runs out of it — and does so again at the next wording. */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    font-size: .86rem;
    color: var(--text-dim);
}
.chart-legend li { display: flex; align-items: center; gap: 8px; }
.chart-legend .swatch { width: 22px; height: 0; border-radius: 2px; }
.chart-legend .demand { border-top: 3px solid var(--accent); }
.chart-legend .supply { border-top: 3px dashed var(--text-dim); }

/* Narrow bar: the nav gets its own line, on purpose.
 *
 * Measured at 380px: brand, nav and account together need more width than
 * there is, so the nav fell to a second row wherever the leftover space ran
 * out — which moved as the label or the sign-in state changed.  Giving it
 * the whole line below makes the position fixed instead of incidental, and
 * the bar two rows instead of three. */
@media (max-width: 640px) {
    /* Not pinned on a phone.  A manager's bar was 200px — a quarter of the
       screen — and the report's own title card stuck under it, so a third
       of every report page was furniture.  The title card still pins, at
       the top of the screen; report.js reads the bar as 0px when it is not
       sticky.  The landing page keeps its pinned bar (body.landing). */
    .topbar { position: relative; flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px; }
    .topbar .brand { order: 1; }
    /* Tools on the first row, as an icon, beside the account: at ≤900px it
       was `order: 4`, which on a phone was a third row of its own. */
    .topbar .nav-tools { order: 2; position: static; margin-inline-end: 0; }
    .topbar .nav-tools > summary { padding: 6px 10px; }
    .topbar .nav-tools-label,
    .topbar .account-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    /* The menu hung from the button's inline end — its left, in RTL — and
       the button sits at the right edge here, so 200px of menu ran off the
       screen.  With the details static the menu hangs from the bar instead,
       inset from both edges. */
    .topbar .nav-tools-menu {
        inset-inline: 12px;
        top: 100%;
        min-width: 0;
        max-height: calc(100svh - 140px);
        overflow-y: auto;
    }
    /* Brand, tools and account need to share 343px.  Measured: a 151px
       wordmark, 36px of tools and 180px of account came to 391, and the
       account dropped onto a row of its own. */
    .topbar .brand-mark,
    .topbar.viewer .brand-mark { height: 30px; }
    .topbar .account { order: 3; margin-inline-start: auto; min-width: 0; gap: 6px; }
    /* It is the link to the password page, so a long name shortens rather
       than goes. */
    .topbar .account-name {
        display: inline-block;
        max-width: 5em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* One row that scrolls sideways rather than wrapping into two.  Centred
       with auto margins on the ends, not justify-content: a centred row
       that overflows is cut at both ends and its start cannot be scrolled
       to. */
    .topbar .nav-primary {
        order: 4;
        flex-basis: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
        margin-inline-end: 0;
    }
    .topbar .nav-primary::-webkit-scrollbar { display: none; }
    .topbar .nav-primary > * { flex-shrink: 0; }
    .topbar .nav-primary > :first-child { margin-inline-start: auto; }
    .topbar .nav-primary > :last-child { margin-inline-end: auto; }
}

/* ---- The trends dashboard --------------------------------------------
   One chart, every listed trend as a point, and the same trends as a
   ranked list beside it.  The two are one thing with two views: a row
   lights its point and a point lights its row, and the tiles above narrow
   both.  The list is also the page for a screen reader and for a browser
   with no script. */
.dash-head { margin-bottom: 10px; align-items: flex-end; }
.dash-head .topics-lead { max-width: 44rem; }
.dash-windows { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.dash-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 14px;
}
.dash-stat {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-dim);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.dash-stat:hover { border-color: var(--accent); transform: translateY(-1px); }
.dash-stat b {
    font-family: var(--font-display);
    font-size: 1.45rem;
    line-height: 1.1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.dash-stat span { font-size: .8rem; }
.dash-stat span i { font-style: normal; }
.dash-stat.up span i { color: var(--growth); }
.dash-stat.down span i { color: var(--danger); }
.dash-stat.is-on {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent) inset;
}
.dash-stat.is-on b { color: var(--accent-2); }

.dash-body {
    display: grid;
    grid-template-columns: minmax(0, 2.3fr) minmax(280px, 1fr);
    gap: 14px;
    align-items: stretch;
}
.dash-card { padding: 12px 12px 10px; min-width: 0; }
.dash-chart {
    width: 100%;
    height: clamp(420px, calc(100vh - 340px), 680px);
}
/* Plotly draws its own drag layer over the plot; the pointer has to be
   set there or a clickable point shows a crosshair. */
.dash-chart .nsewdrag { cursor: pointer !important; }
.dash-note { margin: 8px 4px 0; font-size: .8rem; line-height: 1.6; }

.dash-panel {
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-width: 0;
    max-height: calc(clamp(420px, calc(100vh - 340px), 680px) + 58px);
}
.dash-panel-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.dash-panel-tools input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    font: inherit;
    font-size: .9rem;
}
/* The search box is the thing that gives way when the panel is narrow,
   never these three: squeezed, «تغییر» wrapped to two lines and the
   rounded clip cut it to «تغ». */
.dash-sort {
    display: inline-flex;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.dash-sort button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: .8rem;
    line-height: 1.4;
    padding: 6px 10px;
    white-space: nowrap;
    cursor: pointer;
}
.dash-sort button + button { border-inline-start: 1px solid var(--border); }
.dash-sort button.is-on { background: var(--accent); color: var(--accent-ink); }

.dash-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: auto;
    flex: 1 1 auto;
    min-height: 0;
}
.dash-row a {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 10px;
    color: var(--text);
    border: 1px solid transparent;
}
.dash-row a:hover, .dash-row.is-hot a {
    background: var(--bg-soft);
    border-color: var(--border);
}
.dash-row.is-hot a { border-color: var(--accent); }
.dash-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); }
.dash-row.up .dash-dot { background: var(--growth); }
.dash-row.down .dash-dot { background: var(--danger); }
/* The ring, in the list as on the chart: a line that broke from its
   own past.  Orange and thick for a breakout, sky blue and thin for a
   spark — two colours because the reader asked to tell them apart at a
   glance, and blue rather than violet because violet sat too close to
   the grey of a flat trend's circle. */
.dash-row.burst .dash-dot { box-shadow: 0 0 0 2px var(--bg-soft), 0 0 0 4px var(--burst); }
.dash-row.spark .dash-dot { box-shadow: 0 0 0 2px var(--bg-soft), 0 0 0 3px var(--spark); }
.dash-stat.burst span i { color: var(--burst); font-weight: 700; }
.dash-chart .dash-halo path.point { animation: dash-pulse 1.8s ease-in-out infinite; }
.dash-chart .dash-halo-spark path.point { animation-duration: 2.8s; }
@keyframes dash-pulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: .25; stroke-width: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .dash-chart .dash-halo path.point { animation: none; }
}
.dash-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.dash-nums {
    display: inline-flex;
    gap: 10px;
    font-size: .8rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.dash-nums span { min-width: 2.6em; text-align: right; }
.dash-nums .up { color: var(--growth); }
.dash-nums .down { color: var(--danger); }
.dash-empty { margin: 10px 6px; font-size: .85rem; }

@media (max-width: 980px) {
    .dash-body { grid-template-columns: 1fr; }
    .dash-panel { max-height: none; }
    .dash-list { max-height: 360px; }
    .dash-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .dash-chart { height: 360px; }
    .dash-card { padding: 8px 6px 6px; }
    .dash-stats { gap: 8px; }
    .dash-stat { padding: 8px 10px; }
    .dash-stat b { font-size: 1.2rem; }
}

/* Google Trends beside every keyword offered as a lead (partials/gtrends.html). */
.gtrends-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-inline-start: 6px;
    border-radius: 6px;
    color: var(--muted, #888);
    vertical-align: middle;
    text-decoration: none;
}
.gtrends-btn:hover {
    color: #1a73e8;
    background: rgba(26, 115, 232, .1);
}
.gsearch-btn { margin-inline-start: 2px; }

/* ---- Outside addresses: the banner on every page, and the health card ---- */
.endpoint-alarm {
    max-width: 1180px;
    margin: 12px auto 0;
    padding: 10px 14px;
    border: 1px solid var(--danger);
    border-radius: 8px;
    background: var(--danger-wash);
    color: var(--text);
    font-size: .92rem;
    line-height: 1.8;
}
.endpoint-alarm strong { color: var(--danger); }
.endpoint-alarm small { color: var(--text-dim); }
.endpoint-alarm a { margin-inline-start: 8px; font-weight: 600; white-space: nowrap; }
@media (max-width: 1216px) { .endpoint-alarm { margin-inline: 18px; } }

.health-table-wrap { overflow-x: auto; margin-top: 12px; }
.endpoint-table td { vertical-align: top; }
.endpoint-table td .badge { white-space: nowrap; }
.endpoint-table td small { display: inline-block; }
.endpoint-table tr.is-alarm td { background: var(--danger-wash); }
.endpoint-table tr.is-idle td { opacity: .62; }
.endpoint-address { font-size: .74rem; color: var(--text-dim); word-break: break-all; }
.endpoint-detail { color: var(--text-dim); max-width: 34ch; overflow-wrap: anywhere; }
.health-card .health-action { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.health-card .health-action form { display: inline; }

/* ---- Product photos in «بازار این ترند» ----------------------------------
   Every photo arrives as the same white 480px square (services/
   product_images.py), so the tiles only have to agree on size and frame.
   The tile stays white in the dark theme: the photos are white-backed, and
   on the dark card they would otherwise read as mismatched patches. */
.product-photos { margin: 4px 0 18px; }
.product-photos figcaption { display: block; margin-bottom: 10px; }
.product-photos ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 14px;
}
/* A grid item's minimum is its content's, and an <img width="480"> is
   480px wide until told otherwise — which pushed the row off a phone. */
.product-photos li { min-width: 0; }
.product-photos a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}
.product-photo-tile {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: #fff;
    transition: border-color .15s ease, transform .15s ease;
}
.product-photo-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .25s ease;
}
/* Zoom on hover, inside the tile and towards the pointer (report.js moves
   the origin).  Mouse only: on a phone the tap opens the product page. */
@media (hover: hover) and (pointer: fine) {
    .product-photo-tile { cursor: zoom-in; }
    .product-photos a:hover .product-photo-tile img { transform: scale(2); }
}
.product-photos a:hover .product-photo-tile { border-color: var(--accent); transform: translateY(-2px); }
.product-photos a:hover .product-photo-name { color: var(--accent); }
.product-photo-name {
    font-size: .84rem;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.product-photo-shop { font-size: .74rem; color: var(--text-dim); direction: ltr; text-align: right; }
@media (max-width: 560px) {
    .product-photos ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .product-photo-tile, .product-photo-tile img { transition: none; }
    .product-photos a:hover .product-photo-tile { transform: none; }
}

/* ---- A phone's finger and a phone's eye --------------------------------
 *
 * Measured at 375px: the footer links were 26px tall, the «؟» hints 28px,
 * the guide's jump links 25px — all under what a thumb hits reliably —
 * and the labels on a trend card were 11.4px with a 9.7px unit beside the
 * number.  Each is grown here without changing how it looks on a desktop.
 */
@media (max-width: 640px) {
    .site-footer a {
        display: inline-flex;
        align-items: center;
        min-height: 40px;
        padding-inline: 4px;
    }
    /* The hit area grows, the drawn square does not: a bigger «؟» would
       crowd the card's heading. */
    .card-hint::after {
        content: "";
        position: absolute;
        inset: -8px;
    }
    .tour-jump {
        display: inline-flex;
        align-items: center;
        min-height: 36px;
    }
    .pill { font-size: .8rem; }
    .growth-badge small { font-size: .75rem; }
}

/* ========================================================================
   «پرونده ترند»: the case list and the case article.

   Written to be read top to bottom like a feature story, so one column and a
   comfortable measure.  The chart is inline SVG drawn on the server, styled
   here so it follows the theme.
   ======================================================================== */

.cases-page { max-width: 46rem; margin: 0 auto; }
.cases-page h1 { margin: 4px 0 14px; font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.5; }
.cases-page p, .cases-page li { line-height: 2.05; }
.case-article h2 {
    margin: 42px 0 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: clamp(1.15rem, 2.4vw, 1.4rem);
    line-height: 1.6;
}
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .85rem; color: var(--text-dim); margin: 0 0 14px; }
.crumbs a { color: var(--text-dim); }
.crumbs [aria-current] { color: var(--text); overflow-wrap: anywhere; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-dim); font-size: .9rem; margin: 0; }
.case-tag {
    padding: 2px 10px; border-radius: 999px; font-size: .78rem;
    background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-dim);
}
.case-lead { font-size: 1.12rem; line-height: 2; margin: 22px 0 6px; color: var(--text); }

.case-quote {
    margin: 22px 0; padding: 20px 22px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border); border-right: 4px solid var(--burst);
    box-shadow: var(--shadow);
}
.case-quote p { margin: 0 0 10px; font-size: 1.2rem; font-weight: 700; line-height: 1.9; }
.case-quote footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .86rem; color: var(--text-dim); }
.case-ts {
    font-family: var(--font-display); direction: ltr; font-weight: 700;
    background: var(--burst); color: #fff; border-radius: 6px; padding: 1px 8px;
}

/* LTR inside the drawing so text-anchor means what the geometry assumes:
   the episode label runs rightwards from its line, over the low bars. */
.case-figure svg { overflow: visible; direction: ltr; }
.case-grid { stroke: var(--border); stroke-width: 1; }
.case-baseline { stroke: var(--text-dim); stroke-width: 1.5; opacity: .6; }
.case-axis { fill: var(--text-dim); font-size: 12px; font-family: var(--font); }
.case-year { fill: var(--text-dim); font-size: 13px; font-weight: 700; font-family: var(--font); }
.case-value { fill: var(--text); font-size: 15px; font-weight: 800; font-family: var(--font); }
.case-bar-before { fill: #8090b6; }
.case-bar-after { fill: var(--burst); opacity: .82; }
.case-bar-after.is-peak { opacity: 1; }
.case-marker { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 5; }
.case-marker-label { fill: var(--text); font-size: 13px; font-weight: 800; font-family: var(--font); }
.case-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 0 0 6px; }
.case-key-before { background: #8090b6; }
.case-key-after { background: var(--burst); margin-right: 12px; }

.case-stats { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.case-stats li {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; line-height: 1.6;
}
.case-stats b { display: block; font-size: 1.9rem; font-weight: 900; line-height: 1.2; }
.case-stats b.hot { color: var(--burst); }
.case-stats span { color: var(--text-dim); font-size: .88rem; }

.case-steps { padding-right: 1.3rem; }
.case-steps li { margin-bottom: 8px; }

.case-data { margin: 26px 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; }
.case-data summary { cursor: pointer; color: var(--text-dim); }
.case-data table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; }
.case-data th, .case-data td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); }

.case-sources ul { padding-right: 1.2rem; color: var(--text-dim); font-size: .9rem; }
.case-others ul { padding-right: 1.2rem; }

.case-cta {
    margin: 44px 0 10px; padding: 24px 24px 26px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: #f2f5ff;
}
.case-cta h2 { margin: 0 0 8px; padding: 0; border: 0; color: #fff; }
.case-cta p { color: #c3cde6; margin: 0 0 16px; }
.case-cta .btn { margin-left: 8px; }
.case-cta .btn.ghost { color: #f2f5ff; border-color: rgba(242, 245, 255, .35); }

.case-cards { display: grid; gap: 20px; margin: 26px 0; }
.case-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow); overflow: hidden; }
.case-card-link { display: block; color: inherit; text-decoration: none; }
.case-card img { display: block; width: 100%; height: auto; }
.case-card-body { padding: 16px 20px 20px; }
.case-card h2 { margin: 8px 0 6px; font-size: 1.25rem; line-height: 1.6; }
.case-card p { margin: 0 0 10px; color: var(--text-dim); }
.case-more { color: var(--accent); font-weight: 700; }
.case-card-link:hover h2 { color: var(--accent); }

.case-photo { margin: 22px 0; }
.case-photo img { display: block; width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.case-photo figcaption { margin-top: 8px; color: var(--text-dim); font-size: .85rem; line-height: 1.9; }
.case-photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.case-photo-pair figcaption { grid-column: 1 / -1; margin-top: 0; }
.case-photo-pair img { background: #fff; }

/* ---- YouTube leads (staff) ------------------------------------------- */
.yt-page { max-width: 60rem; margin: 0 auto; }
.yt-note { background: var(--bg-soft); border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px 16px; line-height: 2; }
.yt-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.yt-tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.yt-tabs a.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.yt-list { display: grid; gap: 12px; }
.yt-moment { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.yt-moment header { display: flex; gap: 10px; align-items: baseline; }
.yt-at { font-family: var(--font-display); direction: ltr; font-weight: 700; background: var(--burst); color: #fff; border-radius: 6px; padding: 1px 8px; flex: none; }
.yt-title { font-weight: 700; color: var(--text); line-height: 1.7; }
.yt-meta { margin: 6px 0; color: var(--text-dim); font-size: .85rem; }
.yt-terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.yt-terms span { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: .88rem; }
.yt-terms small { color: var(--text-dim); }
.yt-said { line-height: 2; color: var(--text-dim); font-size: .9rem; margin: 6px 0; }
.yt-said b { color: var(--text); }
.yt-actions { display: flex; gap: 8px; margin-top: 8px; }
.yt-add { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.yt-channels { width: 100%; border-collapse: collapse; font-size: .9rem; }
.yt-channels th, .yt-channels td { text-align: right; padding: 8px; border-bottom: 1px solid var(--border); }
.yt-channels td small { color: var(--text-dim); margin-right: 6px; }
.yt-channels tr.is-off { opacity: .5; }
@media (max-width: 640px) { .yt-channels th:nth-child(3), .yt-channels td:nth-child(3), .yt-channels th:nth-child(5), .yt-channels td:nth-child(5) { display: none; } }

/* Episode cards: one per video, its moments as compact rows in time order. */
.yt-list { gap: 14px; }
.yt-ep { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.yt-ep-head { padding: 12px 16px 10px; border-bottom: 1px solid var(--border); }
.yt-ep-title { display: block; font-weight: 800; color: var(--text); line-height: 1.7; }
.yt-ep-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 0; color: var(--text-dim); font-size: .82rem; }
.yt-jump { color: var(--growth); font-weight: 700; }
.yt-rows { list-style: none; margin: 0; padding: 0; }
.yt-row {
    display: grid; grid-template-columns: auto 1fr auto auto; gap: 4px 12px; align-items: start;
    padding: 9px 16px; border-top: 1px solid var(--border);
}
.yt-row:first-child { border-top: 0; }
.yt-row.is-top { background: var(--growth-wash); }
.yt-row.is-lead { box-shadow: inset -3px 0 0 var(--growth); }
.yt-row.is-off { opacity: .45; }
.yt-row .yt-at { margin-top: 2px; font-size: .82rem; }
.yt-row-body { min-width: 0; }
.yt-row-said { margin: 0; font-size: .88rem; line-height: 1.85; color: var(--text); }
.yt-row-said summary { cursor: pointer; list-style: none; }
.yt-row-said summary::-webkit-details-marker { display: none; }
.yt-row-said[open] summary { display: none; }
.yt-row-said p { margin: 0; }
.yt-row-terms { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.yt-row-terms span { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; font-size: .78rem; line-height: 1.8; }
.yt-react { color: var(--text-dim); font-size: .78rem; white-space: nowrap; margin-top: 3px; }
.yt-row.is-top .yt-react { color: var(--growth); font-weight: 700; }
.yt-judge { display: flex; gap: 4px; }
.yt-judge button {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text-dim); cursor: pointer; font-size: .9rem;
}
.yt-judge button[value="lead"]:hover:not(:disabled) { border-color: var(--growth); color: var(--growth); }
.yt-judge button[value="dismissed"]:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.yt-judge button:disabled { opacity: .35; cursor: default; }
.yt-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.yt-watch { font-size: .8rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
@media (max-width: 640px) {
    .yt-row { grid-template-columns: auto 1fr; }
    .yt-row-side { grid-column: 2; grid-row: 2; flex-direction: row; align-items: center; gap: 12px; }
    .yt-judge { grid-column: 2; grid-row: 2; justify-self: end; }
}

/* «رو به رشد گزارش‌ها»: which report raised the keyword. */
.tk-from { font-size: .74rem; color: var(--text-dim); margin-top: 2px; line-height: 1.8; }
.tk-from a { color: var(--accent); }

/* ---- «تأیید بازار» ---------------------------------------------------- */
.mc-verdict-row {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    background: var(--bg-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.mc-verdict {
    font-weight: 700; border-radius: 999px; padding: 5px 14px; white-space: nowrap;
    border: 1.5px solid currentColor;
}
.mc-ok { color: var(--growth); background: var(--growth-wash); }
.mc-early { color: var(--warn); }
.mc-new { color: var(--accent); }
.mc-flat { color: var(--text-dim); }
.mc-none { color: var(--text-dim); border-style: dashed; }
.mc-sentence { margin: 0; line-height: 1.9; flex: 1; min-width: 200px; }
.mc-stats { margin-bottom: 14px; }
.mc-stats .value { font-size: 1.25rem; }
.mc-stats .value.up { color: var(--growth); }
.mc-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--text-dim); margin-bottom: 4px; }
.mc-key { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-inline-end: 6px; }
.mc-key-buy { background: var(--growth); }
.mc-key-search { background: var(--accent); opacity: .55; }
.mc-key-shade { background: var(--growth-wash); height: 12px; border: 1px solid var(--border); }
.mc-chart { padding: 6px 30px 26px 0; }   /* the value axis sits on the right */
.mc-plot { position: relative; height: 190px; }
.mc-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mc-lines .mc-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mc-lines .mc-shade { fill: var(--growth-wash); }
.mc-lines .mc-search { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .55; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.mc-lines .mc-buy { fill: none; stroke: var(--growth); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mc-y, .mc-x { position: absolute; font-size: .72rem; color: var(--text-dim); white-space: nowrap; line-height: 1; }
.mc-y { right: -26px; transform: translateY(-50%); }
.mc-x { top: calc(100% + 8px); transform: translateX(-50%); }
.mc-x.mc-x-start { transform: none; }
@media (max-width: 480px) { .mc-x.mc-x-mid { display: none; } }
.mc-note { color: var(--text-dim); font-size: .8rem; margin: 6px 0 14px; line-height: 1.8; }
.mc-new-tag {
    position: absolute; top: 12px; inset-inline-start: 12px; background: var(--accent); color: var(--accent-ink);
    border-radius: 999px; padding: 1px 8px; font-size: .72rem;
}
.mc-debug ul { font-size: .8rem; padding-inline-start: 18px; margin-top: 8px; }

/* ---- «بازار این ترند»: buying and goods in one card -------------------
   The verdict heads the card; under it, two parts — whether people buy,
   and what is sold where — each with a small heading and a hairline
   between them, so the card reads as one answer in two steps rather than
   as two cards glued together. */
.goods-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.goods-pending { margin: 0 0 14px; }
.goods-part + .goods-part { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 18px; }
.goods-part-title { font-size: 1rem; margin: 0 0 12px; color: var(--text); }
.goods-part .mc-note { margin-bottom: 8px; }
.product-photo-tile { position: relative; }
.product-photo-tile .mc-new-tag { top: 6px; inset-inline-start: 6px; }

/* «بازار این ترند» as one story (services/story.py): «now» — stage, advice,
   confidence — then the dated past, then the five steps.  The why sits in
   the locked part below. */
.story-head { background: var(--bg-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.story-now { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.story-kicker { font-size: .8rem; color: var(--text-dim); }
.story-stage {
    font-weight: 700; border-radius: 999px; padding: 4px 14px; border: 1.5px solid currentColor; white-space: nowrap;
}
.st-before { color: var(--accent); }
.st-growth { color: var(--growth); background: var(--growth-wash); }
.st-mature { color: var(--text); }
.st-saturation { color: var(--warn); }
.st-fading { color: var(--text-dim); border-style: dashed; }
.story-advice { font-weight: 700; }
.adv-enter { color: var(--growth); }
.adv-avoid, .adv-exit { color: var(--warn); }
.story-sure { font-size: .8rem; color: var(--text-dim); margin-inline-start: auto; }
.story-past { margin: 10px 0 12px; line-height: 1.9; }
.story-why { margin: 0 0 14px; line-height: 1.9; }
.story-why p { margin: 0 0 6px; }
.story-numbers { color: var(--text-dim); font-size: .8rem; }
.lc-steps { display: flex; list-style: none; margin: 0; padding: 0; }
.lc-step {
    flex: 1; text-align: center; font-size: .8rem; color: var(--text-dim); padding: 6px 4px;
    border: 1px solid var(--border); white-space: nowrap; background: var(--surface, transparent);
}
.lc-step + .lc-step { border-inline-start: 0; }
.lc-step:first-child { border-start-start-radius: 999px; border-end-start-radius: 999px; }
.lc-step:last-child { border-start-end-radius: 999px; border-end-end-radius: 999px; }
.lc-here { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
@media (max-width: 480px) {
    .lc-step { font-size: .72rem; padding: 6px 2px; }
    .story-sure { margin-inline-start: 0; width: 100%; }
}
.story-change { color: var(--warn); }
.story-updated { margin: 8px 0 0; font-size: .75rem; color: var(--text-dim); }
.st-unknown { color: var(--text-dim); }

/* ---- Telegram card: the trend in the selling channels --------------------
   Every part runs the card's full width — tiles, chart, chips, a grid of
   posts — so it fills the same way whether a trend has one feature or
   twelve; two columns left a hole under the shorter one. */
.telegram-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 4px 0 14px; }
.telegram-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: calc(var(--radius) - 6px); background: var(--bg-soft); min-width: 0; }
.telegram-stat b { font-size: 1.2rem; font-weight: 700; color: var(--text); line-height: 1.4; }
.telegram-stat span { font-size: .78rem; color: var(--text-dim); }
.telegram-stat .telegram-momentum { font-size: 1rem; }
.telegram-momentum.is-rising, .telegram-momentum.is-new { color: var(--growth); }
.telegram-momentum.is-fading { color: var(--warn); }
.telegram-weeks { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-size: .8rem; }
.telegram-spark { width: 100%; height: 40px; display: block; }
.telegram-spark rect { fill: var(--accent); opacity: .7; }
.telegram-features, .telegram-variants { margin-bottom: 12px; }
.telegram-samples { list-style: none; margin: 4px 0 6px; padding: 0; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.telegram-samples li { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; min-width: 0;
    border: 1px solid var(--border); border-radius: calc(var(--radius) - 6px); background: var(--bg-soft); }
.telegram-samples a { color: var(--text); text-decoration: none; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.telegram-samples a:hover { color: var(--accent); }
.telegram-samples .muted { font-size: .76rem; }
.telegram-vpn, .telegram-channels { margin: 6px 0 0; }
.telegram-channels a { color: var(--text-dim); }
.telegram-card.is-empty { opacity: .9; }

/* ---- Telegram channels page ------------------------------------------- */
.tg-stats { color: var(--text-dim); }
.tg-stats b { color: var(--text); }
.tg-stats .sep { margin: 0 8px; opacity: .5; }
.tg-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 24px; }
.tg-actions form { display: inline-flex; gap: 6px; align-items: center; }
.tg-add input { min-width: 200px; }
.tg-channels tr.is-off td { opacity: .55; }
.tg-title { font-size: .78rem; max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-error { font-size: .75rem; color: var(--warn); }
.tg-channels select { font: inherit; font-size: .85rem; }
