@import url('/theme-tokens.css');   /* every token lives there; this file is components */

/* ---- Section 3: typography ------------------------------------------- */
/* Aldrich ships ONE weight. Never ask for 700 — the browser fake-bolds it. */
html{font-family:var(--font-body)}
h1,h2,h3,h4,h5,h6{font-family:var(--font-heading);font-weight:400;letter-spacing:0.02em}
.eyebrow{font-family:var(--font-heading);font-weight:400;font-size:0.75rem;letter-spacing:0.2em;text-transform:uppercase;color:var(--accent)}
/* Monospace stays the platform's own — no webfont, matching trackcast.tv. */
code,kbd,pre,samp,.code{font-family:monospace}
/* Any column of numbers lines up. */
.tabular,.stat-value,td.num,.tile .n{font-variant-numeric:tabular-nums}

/* ---- Section 6.2: buttons --------------------------------------------- */
/* ONE filled button per view. Two primary-looking buttons means one is wrong. */
.btn{display:inline-block;background:var(--accent);color:var(--accent-ink);font-family:var(--font-body);font-weight:700;text-transform:uppercase;letter-spacing:0.05em;border:1px solid transparent;border-radius:var(--radius);padding:0.875rem 2rem;cursor:pointer;text-decoration:none;transition:background .15s,box-shadow .15s,color .15s,border-color .15s}
.btn:hover{background:var(--accent-hover);box-shadow:0 0 24px rgba(17,163,228,.3)}
.btn-outline{background:transparent;border:1px solid var(--border);color:var(--text)}
.btn-outline:hover{background:color-mix(in srgb,var(--accent) 10%,transparent);border-color:var(--border-hover);color:var(--accent);box-shadow:none}
.btn-sm{padding:0.5rem 1rem;font-size:0.75rem}

/* ---- Section 6.3: cards & panels -------------------------------------- */
/* Border + fill is the default. Spend a glow on the ONE thing that lifts. */
.card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.75rem}
a.card:hover,.card-link:hover{border-color:var(--border-hover);background:var(--bg-card-hover)}

/* ---- Section 6.4: stat tiles ------------------------------------------ */
/* A KPI strip stays four across on desktop; the 6.8 grid rule does not apply. */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:1.25rem}
@media (max-width:900px){.stats{grid-template-columns:repeat(2,1fr)}}
@media (max-width:560px){.stats{grid-template-columns:1fr}}
.stat{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-lg);padding:1.5rem}
.stat-label{font-family:var(--font-heading);font-size:0.6875rem;letter-spacing:0.15em;text-transform:uppercase;color:var(--muted)}
.stat-value{font-family:var(--font-heading);font-weight:400;font-size:2.25rem;color:var(--text);font-variant-numeric:tabular-nums;line-height:1.2}
.stat-sub{font-family:var(--font-body);font-size:0.8125rem;color:var(--text-secondary)}
.stat-value.near-limit{color:var(--amber)}
.stat-value.over-limit{color:var(--red)}

/* ---- Section 6.5: tabs ------------------------------------------------ */
/* Never wraps to two lines; it scrolls inside its own container instead. */
.tabs{display:flex;gap:0;overflow-x:auto;border-bottom:1px solid var(--border);scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{flex:0 0 auto;white-space:nowrap;font-family:var(--font-heading);font-weight:400;font-size:0.8125rem;text-transform:uppercase;letter-spacing:0.1em;color:var(--text-secondary);text-decoration:none;background:none;border:0;border-bottom:2px solid transparent;margin-bottom:-1px;padding:0.875rem 1.25rem;cursor:pointer}
.tab:hover{color:var(--text)}
.tab.active{color:var(--accent);border-bottom-color:var(--accent)}

/* ---- Section 6.6: pills / badges -------------------------------------- */
.pill{display:inline-block;font-family:var(--font-heading);font-weight:400;font-size:0.625rem;letter-spacing:0.15em;text-transform:uppercase;padding:0.25rem 0.75rem;border-radius:999px;background:color-mix(in srgb,var(--accent) 12%,transparent);border:1px solid color-mix(in srgb,var(--accent) 45%,transparent);color:var(--accent)}
.pill-neutral{background:rgba(255,255,255,0.06);border-color:var(--border);color:var(--text-secondary)}

/* ---- Section 6.7: forms & inputs -------------------------------------- */
.form-label,.field > label{display:block;font-family:var(--font-heading);font-weight:400;font-size:0.625rem;letter-spacing:0.2em;text-transform:uppercase;color:var(--muted);margin-bottom:0.375rem}
.input{width:100%;background:var(--bg-input);border:1px solid var(--border);border-radius:var(--radius);padding:0.75rem 1rem;color:var(--text);font-family:var(--font-body);font-size:0.9375rem}
.input:focus{border-color:var(--accent)}
.field-error{color:var(--red);font-size:0.8125rem;margin-top:0.375rem}
.input.has-error{border-color:var(--red)}
/* Never remove an outline without replacing it. One ring, everywhere. */
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

/* ---- Section 6.8: grid column rules ----------------------------------- */
/* Deliberately NOT auto-fit: auto-fit picks whatever fits, which is how a
 * block of four ends up three across with one card stranded underneath.
 *
 * The element guard is not decoration. `.grid` is already taken twice in this
 * codebase: the media library's thumbnail grid in partials/manager-style.ejs,
 * and — the dangerous one — <g class="grid"> inside the sponsor-report SVG
 * charts, where `display:grid` on an SVG group is not something you want to
 * find out about on a customer's report. :where() contributes no specificity,
 * so these still read as a plain `.grid` for anything overriding them. */
:where(div,section,main,ul,ol,nav).grid{display:grid;grid-template-columns:1fr;gap:1.25rem}
@media (min-width:768px){
  :where(div,section,main,ul,ol,nav).grid{grid-template-columns:repeat(2,1fr)}                                  /* 2 and 4 */
  :where(div,section,main,ul,ol,nav).grid:has(> :nth-child(3):last-child){grid-template-columns:repeat(3,1fr)}  /* exactly 3 */
  :where(div,section,main,ul,ol,nav).grid:has(> :nth-child(5)){grid-template-columns:repeat(3,1fr)}             /* 5 or more */
}

/* ---- Section 5: the wordmark ------------------------------------------ */
/* Never re-coloured, never stretched, never on a coloured fill. */
.td-logo{display:block;height:26px;width:auto}
@media (min-width:1024px){.td-logo{height:32px}}
.td-logo-login{height:38px;width:auto;display:block;margin:0 auto}
.td-logo-footer{height:20px;width:auto;opacity:0.65}

/* ---- Theme picker (rendered by partials/app-header.ejs) ---- */
.thm-wrap{position:relative}
.thm-btn{display:inline-flex;align-items:center;gap:7px;color:var(--text-secondary);background:transparent;border:1px solid var(--border);border-radius:var(--radius);padding:6px 12px;font-family:var(--font-heading);font-weight:400;font-size:0.6875rem;letter-spacing:0.15em;text-transform:uppercase;cursor:pointer}
.thm-btn:hover{color:var(--accent);border-color:var(--border-hover)}
.thm-btn .thm-dot{width:10px;height:10px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 1px var(--border)}
.thm-pop{display:none;position:absolute;right:0;top:calc(100% + 8px);z-index:400;width:218px;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--td-shadow);padding:14px}
.thm-pop.open{display:block}
.thm-pop h4{font-family:var(--font-heading);font-size:0.625rem;text-transform:uppercase;letter-spacing:0.2em;color:var(--muted);margin:0 0 8px;font-weight:400}
.thm-pop h4+h4{margin-top:14px}
.thm-seg{display:flex;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.thm-seg button{flex:1;padding:8px 0;background:transparent;border:none;color:var(--text-secondary);font-family:var(--font-body);font-size:12px;font-weight:700;cursor:pointer}
.thm-seg button+button{border-left:1px solid var(--border)}
.thm-seg button.on{background:var(--td-accent-soft);color:var(--accent)}
.thm-swatches{display:flex;gap:10px;margin-top:10px}
.thm-sw{width:26px;height:26px;border-radius:50%;border:2px solid transparent;cursor:pointer;padding:0;position:relative}
.thm-sw.on{border-color:var(--text)}
