/* LinkDesk - plain CSS, no build step. Light and dark themes via custom properties. */

:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --surface: #fffefb;
  --surface-2: #f1eee7;
  --ink: #1d1c1a;
  --ink-2: #52514e;
  --muted: #7a7872;
  --line: #e2ded4;
  --line-strong: #c9c4b7;
  --brand: #1f4e5f;
  --brand-ink: #ffffff;
  --brand-soft: #e3eef1;
  --link: #1d5f8a;
  --ok: #0b7d3b;
  --ok-soft: #e2f3e7;
  --warn: #8a5a00;
  --warn-soft: #fbf0d6;
  --bad: #b3261e;
  --bad-soft: #fbe4e1;
  --info: #1d5f8a;
  --info-soft: #e2eef7;
  --focus: #2a78d6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.06), 0 2px 8px rgba(20, 18, 14, 0.04);

  /* Chart tokens (validated reference palette). */
  --viz-surface: #fcfcfb;
  --viz-grid: #e1e0d9;
  --viz-axis: #c3c2b7;
  --viz-tick: #898781;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #9a988f;
    --line: #2f2f2c;
    --line-strong: #45443f;
    --brand: #6fb3c8;
    --brand-ink: #0d1d23;
    --brand-soft: #1d3138;
    --link: #8cc4ee;
    --ok: #5cc98a;
    --ok-soft: #173023;
    --warn: #f0c060;
    --warn-soft: #3a2d10;
    --bad: #ff8a80;
    --bad-soft: #3d1b18;
    --info: #8cc4ee;
    --info-soft: #182a39;
    --shadow: none;
    --viz-surface: #1a1a19;
    --viz-grid: #2c2c2a;
    --viz-axis: #383835;
    --viz-tick: #898781;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a988f;
  --line: #2f2f2c; --line-strong: #45443f; --brand: #6fb3c8; --brand-ink: #0d1d23; --brand-soft: #1d3138; --link: #8cc4ee;
  --ok: #5cc98a; --ok-soft: #173023; --warn: #f0c060; --warn-soft: #3a2d10; --bad: #ff8a80; --bad-soft: #3d1b18;
  --info: #8cc4ee; --info-soft: #182a39; --shadow: none;
  --viz-surface: #1a1a19; --viz-grid: #2c2c2a; --viz-axis: #383835; --viz-tick: #898781;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code, pre, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
pre.code, textarea.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .75rem; overflow: auto; white-space: pre-wrap; word-break: break-word; width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.break { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.bad { color: var(--bad); }
.lead { font-size: 1.05rem; color: var(--ink-2); max-width: 70ch; }
.empty { color: var(--muted); padding: 1.5rem; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.js .js-hide { display: none; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.nl-name { font-weight: 600; color: var(--ink-2); }
.switcher select { font-weight: 600; max-width: 14rem; }
.mainnav { display: flex; gap: .15rem; flex-wrap: wrap; flex: 1; }
.mainnav a { padding: .35rem .6rem; border-radius: 6px; color: var(--ink-2); text-decoration: none; }
.mainnav a:hover { background: var(--surface-2); }
.mainnav a[aria-current="page"] { background: var(--brand-soft); color: var(--ink); font-weight: 600; }
.usermenu { position: relative; margin-left: auto; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 14rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: .35rem; z-index: 30; }
.menu a, .menu .linkish { display: block; width: 100%; text-align: left; padding: .45rem .6rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.menu a:hover, .menu .linkish:hover { background: var(--surface-2); }
.menu-head { padding: .45rem .6rem; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
.menu-head small { display: block; font-weight: 400; color: var(--muted); }
.linkish { background: none; border: 0; font: inherit; color: var(--link); cursor: pointer; padding: 0; }

.banner { padding: .6rem 1rem; border-bottom: 1px solid var(--line); }
.banner-warn { background: var(--warn-soft); color: var(--ink); }
.banner-info { background: var(--info-soft); color: var(--ink); }

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 5rem; }
.container.narrow { max-width: 560px; }
body.bare .container { padding-top: 2.5rem; }
.bare-brand { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 700; margin-bottom: 1rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.muted-card { background: transparent; box-shadow: none; }

/* Flash */
.flash { padding: .65rem .85rem; border-radius: 8px; margin-bottom: .75rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 20%, transparent); }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; }
label.check, label.inline { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; margin-right: .75rem; }
label > small { font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: .45rem .6rem; max-width: 100%;
}
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { display: block; width: 100%; margin-top: .25rem; font-weight: 400; }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; }
.row .grow, .grow { flex: 1 1 14rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem 1rem; }
.w-sm { width: 6rem !important; }
.w-md { width: 12rem !important; }
.inline-form { display: inline; }
.narrow-form { max-width: 26rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2;
  padding: .5rem .85rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 38px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, black); }
.btn-danger { color: var(--bad); }
.btn-sm { padding: .25rem .55rem; min-height: 30px; font-size: .82rem; }
.btn-big { width: 100%; min-height: 48px; font-size: 1rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.is-busy { opacity: .6; pointer-events: none; }

/* Badges */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-section { background: var(--brand-soft); color: var(--ink); border-color: transparent; }
.badge-flag { background: transparent; }
.count { display: inline-block; min-width: 1.4rem; text-align: center; font-size: .75rem; font-weight: 700; padding: 0 .35rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }

/* Tabs and filters */
.tabs { display: flex; gap: .25rem; flex-wrap: nowrap; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: .75rem; scrollbar-width: thin; }
.tabs a { padding: .45rem .7rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filters input[type="search"] { flex: 1 1 12rem; }
.bulkbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }

/* Queue */
.queue-group > h2 { display: flex; align-items: center; gap: .5rem; margin: 1.25rem 0 .5rem; }
.item { padding: .85rem 1rem; }
.item.is-low { opacity: .92; border-style: dashed; }
.item-head { display: flex; gap: .6rem; align-items: flex-start; }
.item-head .bulk-check { margin-top: .3rem; }
.item-titlebox { min-width: 0; flex: 1; }
.item-title { font-weight: 650; font-size: 1.02rem; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.item-title:hover { text-decoration: underline; }
.meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.meta-link { font-size: .8rem; margin-left: .35rem; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin: .45rem 0; }
.blurb-view p { margin: .35rem 0; }
.blurb-view .note { font-size: .9rem; color: var(--ink-2); }
.rationale { font-size: .82rem; color: var(--muted); font-style: italic; }
.error-text { font-size: .85rem; color: var(--bad); }
.item-edit { margin: .5rem 0; border-top: 1px solid var(--line); padding-top: .5rem; }
.item-edit > summary { cursor: pointer; font-weight: 600; color: var(--link); width: max-content; }
.item-edit[open] > summary { margin-bottom: .5rem; }
.item-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .5rem; }
.item-actions form { margin: 0; }
.more-actions { position: relative; }
.more-actions > summary { list-style: none; }
.more-actions > summary::-webkit-details-marker { display: none; }
.more-actions .menu { left: 0; right: auto; }
.item.flash-out { transition: opacity .35s, transform .35s; opacity: 0; transform: translateX(12px); }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: none; }
.table tr.sub th, .table tr.sub td { padding-left: 1.25rem; font-weight: 400; }
.table tr.current { background: var(--brand-soft); }
.table.compact th, .table.compact td { padding: .3rem .45rem; }
.table.num td { font-variant-numeric: tabular-nums; }
.table caption { text-align: left; font-weight: 600; padding: .25rem 0; }
section.card { overflow-x: auto; }

dl.details { display: grid; grid-template-columns: 10rem 1fr; gap: .3rem .75rem; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }
.pre { white-space: pre-wrap; font-size: .9rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.checks { list-style: none; padding: 0; }
.checks li.ok { color: var(--ok); }
.checks li.bad { color: var(--bad); }
.checks li.warn { color: var(--warn); }

/* Steps */
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .5rem; margin: 0 0 1rem; }
.steps li { display: flex; gap: .6rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; }
.step-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--surface-2); font-weight: 700; flex: none; }
.steps li.done .step-n { background: var(--ok-soft); color: var(--ok); }

/* Taxonomy editor */
.taxonomy-editor .tx-meta { margin-bottom: 1rem; }
.tx-section { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; background: var(--surface); }
.tx-sub { border-left: 3px solid var(--line-strong); padding: .5rem .75rem; margin: .5rem 0 .5rem .5rem; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.tx-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: .5rem; align-items: end; }
.tx-tools { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }

/* Issue builder */
.toolbar { margin-bottom: 1rem; gap: .5rem; align-items: center; }
.toolbar form { margin: 0; }
.inline-details { position: relative; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] > form { position: absolute; z-index: 15; min-width: 22rem; margin-top: .4rem; }
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1rem; align-items: start; }
.sortable { list-style: none; padding: 0; margin: 0 0 .5rem; }
.sortable-item { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .4rem; background: var(--surface); }
.sortable-item.dragging { opacity: .5; }
.sortable-item.drop-before { box-shadow: 0 -3px 0 var(--focus); }
.sortable-item.has-error { border-color: var(--bad); }
.handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 .1rem; }
.sortable-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sortable-buttons { display: flex; gap: .25rem; }
.sortable-buttons form { margin: 0; }
.coverage tr.cov-ok th::before { content: "✓ "; color: var(--status-good); }
.coverage tr.cov-warn th::before { content: "! "; color: var(--warn); font-weight: 700; }
.coverage tr.cov-bad th::before { content: "✗ "; color: var(--status-critical); }
.coverage tr.cov-bad td { color: var(--bad); font-weight: 600; }
.avail li label { font-weight: 400; display: flex; align-items: flex-start; gap: .4rem; }
.export-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.export-preview { border: 1px solid var(--line); border-radius: 8px; padding: .5rem 1rem; background: var(--viz-surface); max-height: 32rem; overflow: auto; }
.export pre.code { max-height: 32rem; }
.warnings { color: var(--warn); }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi-label { font-size: .85rem; color: var(--ink-2); }
.kpi-value { font-size: 1.9rem; font-weight: 650; line-height: 1.2; margin: .2rem 0; }
.kpi-delta { font-size: .8rem; color: var(--muted); }
.meter { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--series-1) 18%, var(--viz-surface)); overflow: hidden; margin: .35rem 0; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--series-1); }
.meter-fill.warn { background: var(--status-warning); }
.meter-fill.bad { background: var(--status-critical); }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); gap: 1rem; }
.viz-grid .card { margin: 0; }
.viz { margin: 0; }
.viz figcaption { font-weight: 600; margin-bottom: .5rem; }
.viz-plot { position: relative; background: var(--viz-surface); border-radius: 8px; }
.viz-svg { display: block; width: 100%; height: auto; }
.viz-svg .grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-svg .axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg .tick { fill: var(--viz-tick); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-svg .direct { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.viz-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .dot { stroke: var(--viz-surface); stroke-width: 2; }
.viz-svg .hit { fill: transparent; cursor: crosshair; outline: none; }
.viz-svg .hit:focus-visible { fill: color-mix(in srgb, var(--focus) 10%, transparent); }
.viz-svg .crosshair { stroke: var(--viz-axis); stroke-width: 1; }
.viz-svg .mark.is-hover { filter: brightness(1.12); }
.viz-svg .s1, .key.s1 { fill: var(--series-1); stroke: var(--series-1); background: var(--series-1); }
.viz-svg .s2, .key.s2 { fill: var(--series-2); background: var(--series-2); }
.viz-svg .s3, .key.s3 { fill: var(--series-3); background: var(--series-3); }
.viz-svg .s4, .key.s4 { fill: var(--series-4); background: var(--series-4); }
.viz-svg .s5, .key.s5 { fill: var(--series-5); background: var(--series-5); }
.viz-svg .s6, .key.s6 { fill: var(--series-6); background: var(--series-6); }
.viz-svg .s7, .key.s7 { fill: var(--series-7); background: var(--series-7); }
.viz-svg .s8, .key.s8 { fill: var(--series-8); background: var(--series-8); }
.viz-svg .mark { stroke: none; }
.viz-svg .line.s1 { fill: none; }
.viz-svg .dot.s1 { stroke: var(--viz-surface); }
.viz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .9rem; padding: 0; margin: 0 0 .5rem; font-size: .82rem; color: var(--ink-2); }
.viz-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.key-line { width: 14px; height: 2px; border-radius: 1px; }
.viz-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.15); padding: .45rem .6rem; font-size: .82rem; min-width: 9rem; z-index: 5; }
.viz-tip .tip-title { color: var(--muted); margin-bottom: .2rem; }
.viz-tip .tip-row { display: flex; align-items: center; gap: .4rem; }
.viz-tip .tip-row strong { font-variant-numeric: tabular-nums; }
.viz-tip .tip-row span.lbl { color: var(--ink-2); }
.viz-tip .key-line.s0 { background: var(--line-strong); }
.viz-table { margin-top: .5rem; font-size: .85rem; }
.viz-table summary { cursor: pointer; color: var(--link); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--surface); padding: .55rem 1rem; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 2rem); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--bad); color: #fff; }

/* Mobile bottom nav */
.bottomnav { display: none; }
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .topbar { padding: .45rem .75rem; flex-wrap: wrap; }
  .switcher, .nl-name { flex: 1; min-width: 0; }
  .switcher select { width: 100%; max-width: none; }
  .usermenu { margin-left: 0; }
  .mainnav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .mainnav::-webkit-scrollbar { display: none; }
  .mainnav a { white-space: nowrap; }
  .container { padding: 1rem .75rem 6rem; }
  .card { padding: .85rem; }
  .issue-layout, .export-panes { grid-template-columns: 1fr; }
  .tx-row { grid-template-columns: 1fr; }
  dl.details { grid-template-columns: 1fr; }
  .item-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .45rem 0 .5rem; color: var(--ink-2); text-decoration: none; font-size: .75rem; font-weight: 600; }
  .bottomnav a span { font-size: 1.15rem; line-height: 1; }
  .bottomnav a[aria-current="page"] { color: var(--brand); }
  .inline-details[open] > form { position: static; min-width: 0; }
}

@media (forced-colors: active) {
  .viz-svg .mark, .viz-svg .dot { forced-color-adjust: none; }
}
@media print {
  .topbar, .bottomnav, .item-actions, .item-edit, .toolbar, .banner { display: none; }
  body { background: #fff; }
}
