/*
 * Design tokens + shared layout for the portal: modern-formal, no cards.
 * Flat surfaces, hairline rules, tabular numerals, a single accent.
 * Every template reuses these classes.
 */

:root {
  color-scheme: light;
  --paper: #fcfcfb;
  --surface: #ffffff;
  --sidebar: #f6f6f5;
  --ink: #17191e;
  --slate: #5a5f68;
  --faint: #8a8f97;
  --mist: #e4e5e7;
  --rule-strong: #17191e;
  --accent: #24418e;
  --accent-hover: #1b3474;
  --accent-quiet: #eef1f8;
  --on-accent: #ffffff;
  --nav-hover: #efefee;
  --moss: #1b7a41;
  --amber: #a96f0b;
  --brick: #b3261e;
  /* Production self-hosts IBM Plex Sans as a woff2;
     system sans is the dev fallback so this renders without a font build step. */
  --font: "IBM Plex Sans", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* ---------- dark mode (additive) — same tokens, alternate values.
   Toggled by setting data-theme="dark"/"light" on <html> (see theme.js);
   the attribute is set from an inline script in <head> before first paint
   to avoid a flash of the wrong theme, falling back to prefers-color-scheme
   the first time a browser visits with nothing in localStorage yet. ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #16181d;
  --surface: #1c1f26;
  --sidebar: #101216;
  --ink: #e8e9ec;
  --slate: #a0a5ae;
  --faint: #6c7178;
  --mist: #2b2e35;
  --rule-strong: #e8e9ec;
  --accent: #6f93e0;
  --accent-hover: #86a6ea;
  --accent-quiet: #202a42;
  --on-accent: #0e1116;
  --nav-hover: #22252c;
  --moss: #4cbf7c;
  --amber: #d99a2b;
  --brick: #e5675d;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- app frame ---------- */
/* height (not min-height): pins the frame to exactly one viewport so the
   sidebar and main column below scroll independently within it, instead
   of the whole page growing and scrolling as one block. */
.app { display: flex; height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  border-right: 1px solid var(--mist);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}
.brand { padding: 18px 20px 16px; border-bottom: 1px solid var(--mist); }
.brand .co { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; white-space: nowrap; }
.brand .suite { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; margin-top: 2px; }
.nav { padding: 14px 0; flex: 1; }
.nav-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 14px 20px 6px;
}
.nav a.nav-item, .nav button.nav-item, .nav summary.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 20px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.nav .nav-item:hover { background: var(--nav-hover); text-decoration: none; }
.nav .nav-item.active { border-left-color: var(--accent); background: var(--nav-hover); font-weight: 600; color: var(--accent); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--slate); font-variant-numeric: tabular-nums; }

/* ---------- collapsible sidebar sections (additive — <details>/<summary>, no JS) ---------- */
.nav details > summary { cursor: pointer; list-style: none; }
.nav details > summary::-webkit-details-marker { display: none; }
.nav details > summary::before {
  content: "▸";
  display: inline-block;
  flex: 0 0 10px;
  width: 10px;
  font-size: 9px;
  color: var(--faint);
  transition: transform 0.1s ease;
}
.nav details[open] > summary::before { transform: rotate(90deg); }

/* ---------- nav sub-items (additive — the portfolio-company tree under "Companies") ---------- */
.nav a.nav-subitem, .nav summary.nav-subitem { padding: 5px 20px 5px 36px; font-size: 12px; color: var(--slate); }
.nav summary.nav-subitem a { flex: 1; color: inherit; text-decoration: none; }
.nav .nav-subitem.depth-2 { padding-left: 52px; }
.nav .nav-subitem.depth-3 { padding-left: 68px; }
.nav .nav-subitem.active { color: var(--accent); font-weight: 600; }
.nav a.nav-subitem.nav-resource { color: var(--faint); font-size: 11.5px; }
.nav a.nav-subitem.nav-resource.active { color: var(--accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--faint); }
.dot.ok { background: var(--moss); }
.dot.degraded { background: var(--amber); }
.dot.down { background: var(--brick); }
.dot.unknown { background: var(--mist); border: 1px solid var(--faint); }
.ext { margin-left: auto; color: var(--faint); font-size: 11px; }
.userblock { border-top: 1px solid var(--mist); padding: 14px 20px; font-size: 12px; }
.userblock .name { font-weight: 600; }
.userblock .mail { color: var(--faint); margin-top: 1px; }
.userblock form { margin-top: 6px; }
.userblock a.linklike { display: block; margin-top: 6px; text-decoration: none; }
.userblock button.linklike,
.userblock a.linklike {
  border: 0; background: none; padding: 0; font: inherit; font-size: 12px;
  color: var(--accent); cursor: pointer;
}
.userblock button.linklike:hover,
.userblock a.linklike:hover { text-decoration: underline; }

/* ---------- main / top bar ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
.topbar {
  height: 48px;
  border-bottom: 1px solid var(--mist);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
}
.omnibox {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--mist);
  color: var(--faint);
  font-size: 12.5px;
  padding: 5px 12px;
  width: 340px;
  background: var(--paper);
}
.omnibox input {
  border: 0; background: none; font: inherit; color: var(--ink); width: 100%; outline: none;
}
.omnibox .kbd { margin-left: auto; font-size: 10.5px; border: 1px solid var(--mist); padding: 1px 5px; color: var(--faint); letter-spacing: 0.04em; }
.topbar .spacer { flex: 1; }
.topbar .approvals-link { font-size: 12.5px; font-weight: 600; }
.topbar .asof { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- content column ---------- */
.content { padding: 26px 28px 64px; max-width: 1180px; width: 100%; margin: 0; }

.pagehead {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--rule-strong);
  flex-wrap: wrap;
}
.pagehead h1 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.pagehead .sub { color: var(--slate); font-size: 12.5px; }
.pagehead .right { margin-left: auto; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- metrics strip ---------- */
.metrics { display: flex; border-bottom: 1px solid var(--mist); overflow-x: auto; }
.metric { flex: 1 1 0; min-width: 150px; padding: 18px 20px 16px; border-left: 1px solid var(--mist); }
.metric:first-child { border-left: 0; padding-left: 0; }
.metric .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--faint); white-space: nowrap; }
.metric .value { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.15; }
.metric .delta { font-size: 11.5px; margin-top: 3px; color: var(--slate); font-variant-numeric: tabular-nums; }
.metric .delta.up { color: var(--moss); }
.metric .delta.down { color: var(--brick); }
.metric .delta.warn { color: var(--amber); }

/* ---------- sections ---------- */
.section { margin-top: 34px; }
.sechead { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-strong); flex-wrap: wrap; }
.sechead .t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; }
.sechead .src { font-size: 11.5px; color: var(--faint); }
.sechead .go { margin-left: auto; font-size: 12px; white-space: nowrap; }

.emptystate { color: var(--faint); font-size: 13px; padding: 18px 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tablewrap { overflow-x: auto; }
th {
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--faint); padding: 9px 14px 7px 0;
  border-bottom: 1px solid var(--mist); white-space: nowrap;
}
td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--mist); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
td .sub { color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.strong { font-weight: 600; }
.muted { color: var(--slate); }

/* buttons */
.btn {
  font: inherit; font-size: 12px; font-weight: 600; padding: 4px 12px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; letter-spacing: 0.02em;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-quiet); }
.actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
/* A POST-only action button (e.g. deactivate/reactivate) inside .actions
   needs a <form> wrapper, but the form itself shouldn't participate in the
   flex layout as its own box — this lets its .btn child sit flush next to
   sibling <a class="btn"> actions instead of stacking below them. */
.actions .inlineform { display: contents; }

/* filter tabs (e.g. an approval/inbox-style screen) */
.filters { display: flex; align-items: baseline; gap: 22px; padding: 14px 0 0; font-size: 13px; flex-wrap: wrap; }
.filters button.tab, .filters a.tab {
  border: 0; background: none; font: inherit; font-size: 13px; color: var(--slate); cursor: pointer;
  padding: 0 0 6px; border-bottom: 2px solid transparent; font-variant-numeric: tabular-nums;
}
.filters .tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.filters .right { margin-left: auto; font-size: 12px; color: var(--faint); }

.foot { margin-top: 14px; font-size: 11.5px; color: var(--faint); max-width: 68ch; }

/* ---------- standalone auth screen (no sidebar) ---------- */
.authscreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}
.authbox { width: 100%; max-width: 360px; padding: 0 24px; }
.authbox .co { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; white-space: nowrap; }
.authbox .suite { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; margin-top: 2px; margin-bottom: 28px; }
.authbox h1 { font-size: 18px; font-weight: 600; border-bottom: 2px solid var(--rule-strong); padding-bottom: 10px; margin: 0 0 6px; }
.authbox .note { font-size: 12px; color: var(--faint); margin-bottom: 18px; }
.userlist { display: flex; flex-direction: column; border-top: 1px solid var(--mist); }
.userlist form { border-bottom: 1px solid var(--mist); }
.userlist button {
  width: 100%; text-align: left; padding: 11px 2px; border: 0; background: none; font: inherit; cursor: pointer;
}
.userlist button:hover { background: var(--accent-quiet); }
.userlist .u-name { font-weight: 600; font-size: 13px; }
.userlist .u-meta { font-size: 11.5px; color: var(--faint); margin-top: 1px; }

@media (prefers-reduced-motion: no-preference) {
  .content { animation: fadein 150ms ease-out; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- form fields (additive — not part of the original locked spec,
   which only had button-list dev-login; needed for a real password form
   and for company/address/contact/document create-edit forms) ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 5px;
}
.field-input,
.authbox input[type="text"],
.authbox input[type="email"],
.authbox input[type="password"] {
  width: 100%;
  border: 1px solid var(--mist);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}
.field-input:focus,
.authbox input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
select.field-input { appearance: auto; }
textarea.field-input { resize: vertical; }
.field .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--brick); font-size: 11.5px; }
.field .helptext { color: var(--faint); font-size: 11.5px; margin-top: 4px; }
.form-errors { color: var(--brick); font-size: 12.5px; margin-bottom: 14px; }
.formactions { display: flex; gap: 10px; margin-top: 20px; }

/* ---------- license banner (additive — grace/trial warnings) ---------- */
.license-banner {
  padding: 8px 28px;
  font-size: 12.5px;
  color: var(--amber);
  background: var(--surface);
  border-bottom: 1px solid var(--mist);
}
.license-banner a { white-space: nowrap; }

/* ---------- notice banner (additive — generic; calendar due/overdue today) ---------- */
.notice-banner {
  padding: 8px 28px;
  font-size: 12.5px;
  color: var(--amber);
  background: var(--surface);
  border-bottom: 1px solid var(--mist);
}
.notice-banner.urgent { color: var(--brick); }
.notice-banner a { white-space: nowrap; }

/* ---------- flash messages (additive — django.contrib.messages) ---------- */
.flash-messages { padding: 0 28px; }
.flash { padding: 8px 0; font-size: 12.5px; color: var(--moss); border-bottom: 1px solid var(--mist); }
.flash.warning { color: var(--amber); }
.flash.error { color: var(--brick); }

/* ---------- checklist (additive — catalog-style checkbox lists, e.g. the
   License Console's "Issue license" plan/add-ons picker) ---------- */
.checklist { border-top: 1px solid var(--mist); }
.checklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--mist);
  font-size: 13px;
  cursor: pointer;
}
.checklist-row input[type="checkbox"] { flex: 0 0 auto; }
/* .field label (above) targets every descendant <label>, including these
   checkbox rows — reset back to normal running text since a "MODULE - HCM"
   checkbox option is not a form-field label. */
.field label.checklist-row {
  text-transform: none;
  font-size: 13px;
  letter-spacing: normal;
  color: var(--ink);
  margin-bottom: 0;
}

/* ---------- theme toggle (additive) — a plain linklike button, wired up
   by static/js/theme.js. On the app shell it sits in the sidebar userblock
   (in normal flow, styled by the .userblock .linklike rule above); on the
   standalone auth screens, which have no sidebar and no .userblock, it's
   pinned to the top-right corner instead and needs its own button reset. ---------- */
.theme-toggle-corner {
  position: fixed;
  top: 16px;
  right: 20px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
.theme-toggle-corner:hover { text-decoration: underline; }

/* ---------- asset photo gallery (additive — asset_detail.html) ---------- */
.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0 4px;
}
.photo-card {
  width: 160px;
  border: 1px solid var(--mist);
}
.photo-card img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: cover;
}
.photo-caption {
  padding: 6px 8px 0;
  font-size: 11.5px;
  color: var(--slate);
}
.photo-card form { padding: 6px 8px 8px; }
.photo-card .btn { width: 100%; }
.photo-upload-form { max-width: 420px; margin-top: 20px; }

/* ---------- inline document viewer (additive — document_detail.html) ---------- */
.doc-viewer {
  width: 100%;
  height: 75vh;
  border: 1px solid var(--mist);
  margin-top: 12px;
  background: var(--surface);
}
.doc-viewer-image {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.doc-viewer-image img { max-width: 100%; height: auto; }

/* ---------- org chart (additive — org_chart.html) ---------- */
/* Classic pure-CSS nested-list tree: each <li>'s ::before/::after draw the
   top-left/top-right half of the horizontal line joining it to its
   siblings, and ul ul::before draws the vertical drop from a parent node
   down to that line. No JS, no SVG — just border lines on pseudo-elements,
   same hairline color (--mist) used for every other rule/border in this
   design system. Wrapped in .orgchart-wrap for horizontal scroll (a chart
   a few levels deep gets wide fast) rather than letting it overflow the
   page, same pattern as .tablewrap for wide tables. */
.orgchart-wrap { overflow-x: auto; padding: 8px 4px 28px; }
.orgchart, .orgchart ul, .orgchart li {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.orgchart, .orgchart ul {
  display: flex;
  justify-content: center;
}
.orgchart ul { padding-top: 24px; }
.orgchart li {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 10px 0;
}
.orgchart li::before, .orgchart li::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 24px;
  border-top: 1px solid var(--mist);
}
.orgchart li::after { right: auto; left: 50%; border-left: 1px solid var(--mist); }
.orgchart li:only-child::before, .orgchart li:only-child::after { display: none; }
.orgchart li:only-child { padding-top: 0; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border: 0 none; }
.orgchart li:last-child::before { border-right: 1px solid var(--mist); }
.orgchart > li::before, .orgchart > li::after { display: none; } /* roots have nothing above them */
.orgchart > li { padding-top: 0; }
.orgchart ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 24px;
  border-left: 1px solid var(--mist);
}

.orgchart-node {
  border: 1px solid var(--mist);
  border-top: 2px solid var(--mist);
  background: var(--surface);
  padding: 8px 14px;
  min-width: 140px;
}
.orgchart-node.owner { border-top-color: var(--accent); }
.orgchart-name { font-size: 13px; font-weight: 600; white-space: nowrap; }
.orgchart-role { font-size: 11.5px; color: var(--slate); white-space: nowrap; margin-top: 1px; }

/* ---------- setup wizard (additive — onboarding app). A standalone,
   no-sidebar screen like .authscreen/.authbox (login.html), just wider —
   the one new component here is .wizard-steps, the step rail; everything
   else (.field, .btn, .section/.sechead) is reused as-is. ---------- */
.wizardscreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 48px 0;
}
.wizardbox { width: 100%; max-width: 580px; padding: 0 24px; }
.wizardbox .co { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; white-space: nowrap; }
.wizardbox .suite { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; margin-top: 2px; }
.wizardbox h1 { font-size: 19px; font-weight: 600; margin: 22px 0 6px; }
.wizardbox .note { font-size: 12.5px; color: var(--slate); margin: 0 0 22px; max-width: 60ch; }
.wizardbox .foot { margin-top: 20px; }

/* The step rail: a numbered circle per step joined by a hairline, matching
   the ".dot" convention (border-radius: 50%) already used for status
   indicators elsewhere rather than inventing a new shape. Upcoming steps
   are hollow/muted; the current step and the connector leading into it are
   accent; completed steps and the connectors between them turn moss green
   with a checkmark, so progress reads left-to-right at a glance. */
.wizard-steps { display: flex; margin: 28px 0 8px; }
.wizard-step { flex: 1; position: relative; text-align: center; }
.wizard-step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 11px;
  left: -50%;
  width: 100%;
  height: 1px;
  background: var(--mist);
}
.wizard-step .num {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid var(--mist);
  background: var(--surface);
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wizard-step .label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin-top: 6px;
  padding: 0 2px;
}
.wizard-step.current .num { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.wizard-step.current:not(:first-child)::before { background: var(--accent); }
.wizard-step.current .label { color: var(--ink); font-weight: 600; }
.wizard-step.done .num { border-color: var(--moss); background: var(--moss); color: var(--on-accent); }
.wizard-step.done:not(:first-child)::before { background: var(--moss); }

.wizard-existing-license {
  border: 1px solid var(--mist);
  background: var(--accent-quiet);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--slate);
  margin-bottom: 18px;
}

.wizard-summary dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-top: 10px;
}
.wizard-summary dt:first-child { margin-top: 0; }
.wizard-summary dd { margin: 2px 0 0; font-size: 13px; }

/* ---------- mobile nav toggle (additive) — hidden on desktop; the sidebar
   itself is unchanged above this breakpoint. Below the breakpoint the
   .app-frame media query turns the sidebar into an off-canvas drawer that
   this button and overlay control (see static/js/nav.js). ---------- */
.navtoggle {
  display: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--mist);
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.navtoggle span { display: block; width: 15px; height: 1.5px; background: var(--ink); }
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* ---------- mobile layout (additive) — below this width, the sidebar
   becomes an off-canvas drawer instead of a permanent column, the topbar
   and content get tighter padding, and the metrics strip wraps into a
   2-column grid instead of one unbroken row. ---------- */
@media (max-width: 860px) {
  .navtoggle { display: flex; }
  .nav-overlay { display: block; }
  .nav-overlay.open { opacity: 1; pointer-events: auto; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  }
  .sidebar.open { transform: translateX(0); }

  .main { width: 100%; }
  .topbar { padding: 0 14px; gap: 10px; }
  .omnibox { width: auto; flex: 1 1 auto; min-width: 0; }
  .topbar .asof { display: none; }

  .content { padding: 18px 14px 48px; }
  .pagehead .right { margin-left: 0; flex-basis: 100%; display: flex; gap: 8px; }
  .pagehead .right .btn { flex: 1; text-align: center; }

  /* A metric's label is nowrap on desktop (it sits on its own wide flex
     item, plenty of room). At 50% width on a phone a long label like
     "Documents expiring in 30 days" would force horizontal overflow of the
     whole page, so mobile lets it wrap — and shrinks the value/padding so
     two compact rows fit above the fold instead of one giant column. */
  .metrics { flex-wrap: wrap; }
  .metric {
    flex: 1 1 50%;
    min-width: 0;
    padding: 14px 12px 9px;
    border-left: 1px solid var(--mist);
    border-bottom: 1px solid var(--mist);
  }
  .metric:nth-child(odd) { border-left: 0; padding-left: 0; }
  .metric .label { white-space: normal; }
  .metric .value { font-size: 20px; margin-top: 2px; }

  .doc-viewer { height: 60vh; }
}
