/* Podcast-Dashboard – Stylesheet
   Farben als Rollen; Dunkelmodus folgt der Systemeinstellung. */

:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.12);
  --accent: #256abf;
  --accent-hover: #1c5cab;
  --accent-soft: #e6f0fd;
  --link: #1c5cab;
  --good: #006300;
  --bad: #b12a2a;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --ok-bg: #e4f5e4;
  --ok-text: #0a4d0a;
  --err-bg: #fde8e8;
  --err-text: #8c1d1d;
  --info-bg: #e6f0fd;
  --info-text: #104281;
  --tooltip-bg: #1a1a19;
  --tooltip-text: #f0efec;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --series-other: #898781;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242423;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #a09e97;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #256abf;
    --accent-hover: #2a78d6;
    --accent-soft: #14283f;
    --link: #86b6ef;
    --good: #2fbf2f;
    --bad: #f08080;
    --warn-bg: #3a2e0c;
    --warn-text: #f5d37a;
    --ok-bg: #12301a;
    --ok-text: #8fdf9a;
    --err-bg: #3a1616;
    --err-text: #f5a3a3;
    --info-bg: #14283f;
    --info-text: #b7d3f6;
    --tooltip-bg: #f0efec;
    --tooltip-text: #0b0b0b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #0ca30c;
    --series-7: #9085e9;
    --series-8: #e66767;
    --series-other: #898781;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { line-height: 1.25; margin: 0; text-wrap: balance; }
h1, .h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code { font: 0.86em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }
small, .small { font-size: 0.84rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; min-width: 14rem; }
.pad { padding: 1rem 1.25rem; }
.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; }

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

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0.55rem 1.25rem; display: flex; align-items: center; gap: 1rem 1.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 650; color: var(--text); text-decoration: none; }
.brand svg { color: var(--accent); }
.brand-logo { display: block; height: 32px; width: auto; max-width: 220px; object-fit: contain; }
.auth-logo { display: block; max-height: 72px; max-width: 220px; width: auto; height: auto; }
.brand-preview { display: inline-flex; align-items: center; padding: 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); align-self: flex-start; }
.brand-preview img { display: block; max-height: 56px; max-width: 220px; width: auto; height: auto; }
.brand-preview-favicon img { max-height: 32px; max-width: 32px; }
.mainnav { display: flex; align-items: center; gap: 0.15rem; flex-wrap: wrap; flex: 1; }
.mainnav a { color: var(--text-2); text-decoration: none; padding: 0.35rem 0.7rem; border-radius: 7px; }
.mainnav a:hover { background: var(--surface-2); color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-sep { width: 1px; height: 1.2rem; background: var(--border); margin: 0 0.4rem; }
.usermenu { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.user-link { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--text); text-decoration: none; }
.user-link:hover .user-name { text-decoration: underline; }

.page { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.page-head, .section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.section { margin-top: 2rem; }
.section > h2, .section-head h2 { margin-bottom: 0.75rem; }
.section-head h2 { margin-bottom: 0; }
.backlink { display: inline-block; font-size: 0.86rem; color: var(--muted); text-decoration: none; margin-bottom: 0.2rem; }
.backlink:hover { color: var(--link); text-decoration: underline; }
.narrow { max-width: 640px; }
.narrow-field { max-width: 22rem; }

/* ---------- Karten, Buttons, Formulare ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card, form.card + form.card { margin-top: 1rem; }
.card h2 { margin-bottom: 0.25rem; }
.card.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--text-2); }
.table-card { padding: 0; overflow: hidden; }
.stack > * + * { margin-top: 1rem; }
.stack > h2 { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.stack > h2:first-of-type, .stack > input[type="hidden"] + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.stack > h3 { margin-top: 1.25rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; font: inherit; font-weight: 550; line-height: 1.2; padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: #b12a2a; border-color: #b12a2a; color: #fff; }
.btn-danger:hover { background: #8c1d1d; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.86rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > span, .field > label { font-weight: 550; font-size: 0.9rem; }
.field small { font-weight: 400; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
input[type="text"], input:not([type]), input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], input[type="file"], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 0.5rem 0.65rem; width: 100%; min-width: 0;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; }
.field.inline input, .field.inline select, .range-form input, .range-form select { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 0; border-color: var(--accent-hover); }
::placeholder { color: var(--muted); opacity: 1; }
.check { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; }
.check input { margin-top: 0.25rem; flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.4rem 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.hint { color: var(--muted); font-size: 0.86rem; }
.hint ul { margin: 0.3rem 0 0.6rem; padding-left: 1.2rem; }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.inline-form { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1 1 14rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem 1rem; margin: 0; min-width: 0; }
fieldset.plain { border: 0; padding: 0; }
legend { font-weight: 600; padding: 0 0.35rem; }
fieldset.plain legend { padding: 0; margin-bottom: 0.5rem; }
.connector-box { border-left: 3px solid var(--series-1); padding: 0.25rem 0 0.25rem 1rem; }
.connector-box > * + * { margin-top: 0.75rem; }
.js .connector-box[hidden] { display: none; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.danger-zone > * + * { margin-top: 0.75rem; }
details.hint summary { cursor: pointer; color: var(--link); }
details.hint p { margin: 0.4rem 0 0; }

.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }

.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; overflow-wrap: anywhere; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--err-bg); color: var(--err-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }
.status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.86rem; font-weight: 550; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--ok-bg); color: var(--ok-text); }
.status.warn { background: var(--warn-bg); color: var(--warn-text); }
.status.none { background: var(--surface-2); color: var(--text-2); }

.facts { display: grid; gap: 0.5rem; margin: 0 0 1.5rem; }
.facts div { display: flex; gap: 1rem; }
.facts dt { width: 6rem; color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- Anmeldung, Installation, Fehler ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; }
.auth-card.wide { max-width: 680px; }
.auth-card > * + * { margin-top: 1rem; }
.auth-card h2 { margin-top: 1.75rem; }
.eyebrow { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.checklist { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.35rem; }
.checklist li { display: flex; gap: 0.6rem; align-items: baseline; }
.checklist .check { display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border-radius: 50%; font-size: 0.75rem; font-weight: 700; cursor: default; flex: none; }
.checklist .ok .check { background: var(--ok-bg); color: var(--ok-text); }
.checklist .fail .check { background: var(--err-bg); color: var(--err-text); }

/* ---------- Podcast-Kopf, Reiter, Filter ---------- */
.podcast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.podcast-card { display: flex; gap: 1rem; align-items: center; text-decoration: none; color: var(--text); margin: 0 !important; }
.podcast-card:hover { border-color: var(--accent); }
.podcast-card.inactive { opacity: 0.65; }
.podcast-card-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.podcast-card-body strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.cover { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.podcast-card .cover { width: 64px; height: 64px; }
.cover-placeholder { display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: var(--text-2); }

.podcast-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.podcast-title { flex: 1; min-width: 12rem; }
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tabs, .subtabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a, .subtabs a { padding: 0.55rem 0.9rem; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 550; }
.tabs a:hover, .subtabs a:hover { color: var(--text); }
.tabs a[aria-current="page"], .subtabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.subtabs { margin-bottom: 0; border-bottom: 0; background: var(--surface-2); padding: 0.25rem; border-radius: 10px; }
.subtabs a { border: 0; margin: 0; border-radius: 7px; padding: 0.4rem 0.9rem; }
.subtabs a[aria-current="page"] { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }

.filters { display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.segmented a { padding: 0.3rem 0.7rem; border-radius: 7px; text-decoration: none; color: var(--text-2); font-size: 0.9rem; white-space: nowrap; }
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.range-form { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.range-form input, .range-form select { padding: 0.3rem 0.5rem; font-size: 0.9rem; }
.filters-note { flex-basis: 100%; margin: 0; font-size: 0.84rem; color: var(--muted); }

/* ---------- Kennzahl-Kacheln ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); min-width: 0; }
.kpi-label { color: var(--text-2); font-size: 0.88rem; }
.kpi-value { font-size: 1.85rem; font-weight: 650; line-height: 1.2; margin: 0.15rem 0 0.25rem; overflow-wrap: anywhere; }
.kpi-unit { font-size: 1rem; font-weight: 500; color: var(--text-2); }
.kpi-delta { font-size: 0.86rem; display: flex; gap: 0.35rem; align-items: baseline; flex-wrap: wrap; color: var(--text-2); font-weight: 550; }
.kpi-delta.good, .delta.good { color: var(--good); }
.kpi-delta.bad, .delta.bad { color: var(--bad); }
.kpi-delta.none { font-weight: 400; color: var(--muted); }
.kpi-delta .arrow { font-size: 0.7rem; }
.kpi-ref { color: var(--muted); font-weight: 400; }
.kpi-note { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
.delta { white-space: nowrap; font-weight: 550; }
.delta [aria-hidden] { font-size: 0.7rem; }

/* ---------- Diagramme ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 1rem; }
.chart-card { margin: 0 !important; display: flex; flex-direction: column; gap: 0.6rem; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.chart-note { font-size: 0.8rem; color: var(--muted); margin: 0.15rem 0 0; }
.chart-wrap { position: relative; height: 280px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.86rem; color: var(--text-2); min-height: 1.3rem; }
.legend:empty { display: none; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; color: inherit; background: none; border: 0; padding: 0.1rem 0.25rem; margin: 0 -0.25rem; border-radius: 6px; cursor: pointer; }
.legend-item:hover { background: var(--surface-2); color: var(--text); }
.legend-item[aria-pressed="false"] { color: var(--muted); text-decoration: line-through; }
.legend-item[aria-pressed="false"] .swatch, .legend-item[aria-pressed="false"] .picon { opacity: 0.35; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.swatch.line { height: 0; width: 18px; border-radius: 0; border-top: 3px solid; background: none !important; }
.picon { width: 1em; height: 1em; fill: currentColor; flex: none; vertical-align: -0.125em; color: var(--text-2); }
h2 .picon { color: var(--text); }
.chart-wide { grid-column: 1 / -1; }
.chart-wide .chart-wrap { height: 340px; }
.chart-table { max-height: 320px; overflow: auto; border-top: 1px solid var(--border); }

/* ---------- Tabellen ---------- */
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.data th, table.data td { padding: 0.6rem 0.9rem; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data thead th { font-size: 0.8rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); white-space: nowrap; vertical-align: bottom; }
table.data thead th a { color: inherit; text-decoration: none; }
table.data thead th a:hover { text-decoration: underline; }
table.data tbody th { font-weight: 550; }
table.data tbody tr:last-child th, table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td form { display: inline; }
table.data .badge { margin-left: 0.3rem; }

/* ---------- Letzte Episoden ---------- */
.latest-episodes { margin: 0 0 1rem; }
.latest-episodes .section-head { margin-bottom: 0.75rem; }
.latest-episodes .head-actions { align-items: center; gap: 1rem; }
.cell-bar { display: grid; grid-template-columns: minmax(4rem, 1fr) 5.5rem; align-items: center; gap: 0.75rem; min-width: 13rem; }
.cell-bar progress { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border: 0; background: transparent; display: block; }
.cell-bar progress::-webkit-progress-bar { background: transparent; }
.cell-bar progress::-webkit-progress-value { background: var(--series-1); border-radius: 0 4px 4px 0; }
.cell-bar progress::-moz-progress-bar { background: var(--series-1); border-radius: 0 4px 4px 0; }
.cell-bar strong { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
table.data th.col-main, table.data td.col-main { width: 27%; }
.latest-episodes table.data th:first-child { width: 33%; min-width: 14rem; }

/* ---------- Verteilungen ---------- */
.dist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 1rem; }
.dist-card { margin: 0 !important; }
.bars { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.55rem; }
.bars li { display: grid; grid-template-columns: minmax(6rem, 9rem) 1fr 3.6rem; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.bar-label { overflow-wrap: anywhere; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.bars progress { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border: 0; background: transparent; display: block; }
.bars progress::-webkit-progress-bar { background: transparent; }
.bars progress::-webkit-progress-value { background: var(--series-1); border-radius: 0 4px 4px 0; }
.bars progress::-moz-progress-bar { background: var(--series-1); border-radius: 0 4px 4px 0; }

/* ---------- Erfassung & Import ---------- */
.entry-date { display: flex; align-items: center; gap: 0.75rem 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.entry-date .hint { flex-basis: 100%; margin: 0; }
.entry-list { display: grid; gap: 0.9rem; margin-top: 1rem; }
.entry-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.9rem 1.25rem; }
.entry-fields .field small { font-size: 0.78rem; }
.entry-table input { min-width: 7.5rem; }
.grid-table th, .grid-table td { padding: 0.3rem 0.4rem; }
.grid-table thead th { padding: 0.5rem 0.6rem; white-space: normal; }
.grid-table input { min-width: 6.5rem; padding: 0.35rem 0.5rem; font-variant-numeric: tabular-nums; }
.grid-table td:first-child input { min-width: 7.5rem; }
.entry-table tbody th { min-width: 14rem; font-weight: 500; }
.dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 1rem; margin-top: 0.5rem; }
.dim-rows { display: grid; gap: 0.4rem; margin-bottom: 0.5rem; }
.dim-row { display: grid; grid-template-columns: 1fr 7.5rem; gap: 0.4rem; }
.import-file { background: var(--surface); }
.import-file > * + * { margin-top: 0.75rem; }
.import-meta { display: flex; gap: 0.75rem 1.25rem; align-items: center; flex-wrap: wrap; }
.import-table th { min-width: 13rem; }
.import-header { display: block; margin-bottom: 0.35rem; white-space: normal; color: var(--text); font-size: 0.86rem; }
.import-table select { font-size: 0.86rem; padding: 0.3rem 0.4rem; font-weight: 400; }

@media (max-width: 760px) {
  .mainnav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -0.4rem; }
  .mainnav a { white-space: nowrap; }
}

@media (max-width: 640px) {
  .page { padding: 1rem 0.9rem 3rem; }
  .topbar-inner { padding: 0.5rem 0.9rem; }
  .kpi-value { font-size: 1.5rem; }
  .bars li { grid-template-columns: minmax(5rem, 7rem) 1fr 3.4rem; }
  .chart-wrap { height: 240px; }
  .user-name { display: none; }
}

@media print {
  .topbar, .filters, .tabs, .head-actions, [data-toggle-table] { display: none !important; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}
