/* Sudo Command — design system
   Tokens are taken from sudogroup.co.uk (styles.css) so the platform and the
   public site read as one brand. Dark is the default, matching the site. */

:root {
  --canvas: #05070d;
  --paper: #090d16;
  --panel: #0d1320;
  --panel-raised: #121a2a;
  --ink-panel: #03060d;
  --blue-deep: #061731;
  --blue-wash: #0b1728;
  --ink: #f7f9fd;
  --ink-soft: #c3cbd9;
  --muted: #929daf;
  --quiet: #687386;
  --line: #242d3d;
  --line-strong: #344056;
  --card-line: rgba(91, 113, 149, 0.32);
  --btn-line: rgba(110, 137, 178, 0.4);
  --blue: #0878ff;
  --blue-soft: #55b8ff;
  --cyan: #41c9f2;
  --violet: #6536da;
  --green: #43d6a2;
  --amber: #ffb45c;
  --red: #ff7a70;
  --grad: linear-gradient(90deg, #0878ff 0%, #6536da 100%);
  /* Risk severity: one hue, rising intensity (ordinal), always paired with a text label. */
  --sev-low: #4a3440;
  --sev-medium: #8a4048;
  --sev-high: #c9544f;
  --sev-critical: #ff7a70;
  --sans: Inter, "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 28px;
  --shadow-sm: 0 14px 38px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 34px 110px rgba(0, 0, 0, 0.48);
  --focus: 0 0 0 3px rgba(85, 184, 255, 0.45);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --canvas: #f4f6fa;
  --paper: #eef1f7;
  --panel: #ffffff;
  --panel-raised: #f7f9fc;
  --ink-panel: #eef1f7;
  --blue-deep: #e6effd;
  --blue-wash: #edf3fd;
  --ink: #0b1220;
  --ink-soft: #2c3749;
  --muted: #56627a;
  --quiet: #6f7a8f;
  --line: #dde3ec;
  --line-strong: #c8d1de;
  --card-line: #dde3ec;
  --btn-line: #c8d1de;
  --blue-soft: #0a62d0;
  --cyan: #0a7ea4;
  --green: #0f8a5f;
  --amber: #a55d00;
  --red: #c7362c;
  --sev-low: #f2d9d6;
  --sev-medium: #e6a9a3;
  --sev-high: #d4675d;
  --sev-critical: #b3261e;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--blue-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.ico { width: 18px; height: 18px; flex: none; }
a.card { color: inherit; }
a.card:hover { border-color: var(--line-strong); }
.grid.top { align-items: start; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------- type ---- */
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.035em; line-height: 1.1; }
h2 { font-size: 20px; line-height: 1.25; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; color: var(--ink-soft); }
.eyebrow { font: 750 11.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.quiet { color: var(--quiet); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.accent { color: var(--blue-soft); }
.nowrap { white-space: nowrap; }
.prompt::before { content: '$ '; color: var(--quiet); }

/* ----------------------------------------------------------- layout ---- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--ink-panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--ink); }
.brand img { height: 30px; width: auto; display: block; }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1; }
.brand .wordmark b { font-weight: 800; letter-spacing: 0.06em; font-size: 17px; }
.brand .wordmark span { font: 700 9.5px/1.4 var(--mono); letter-spacing: 0.28em; color: var(--blue-soft); }
.brand-sub { font: 700 10px/1 var(--mono); letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; padding: 0 8px 14px; }
.org-switch { margin: 0 4px 16px; }
.org-switch select { width: 100%; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font: 700 10.5px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--quiet); padding: 16px 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px;
  color: var(--ink-soft); font-size: 14px; text-decoration: none; border: 1px solid transparent;
}
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--blue-deep); color: var(--ink); border-color: var(--card-line); }
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav a.planned { color: var(--quiet); pointer-events: none; }
.nav a .tag { margin-left: auto; font: 700 9.5px/1 var(--mono); letter-spacing: 0.08em; color: var(--quiet); border: 1px solid var(--line); padding: 3px 5px; border-radius: 5px; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; min-width: 0; }
.topbar .crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 28px; max-width: 1340px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .lede { margin-top: 8px; max-width: 70ch; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }

/* ------------------------------------------------------------ cards ---- */
.card { background: var(--panel); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card.flat { background: transparent; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { font-size: 15px; letter-spacing: -0.01em; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 12.5px; color: var(--muted); }
.hero-number { font-size: 64px; font-weight: 650; letter-spacing: -0.05em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.hero-number small { font-size: 22px; color: var(--muted); letter-spacing: -0.02em; font-weight: 500; }

/* --------------------------------------------------------- controls ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  background: var(--panel); color: var(--ink); border: 1px solid var(--btn-line); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: border-color .15s, background .15s, filter .15s;
}
.btn:hover { border-color: var(--blue-soft); text-decoration: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ico { width: 16px; height: 16px; }
.icon-btn { width: 36px; padding: 0; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); min-width: 0; }
label.field .hint { color: var(--muted); font-size: 12px; }
label.field .err { color: var(--red); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 12px; color: var(--ink); min-height: 40px; font-size: 14px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-soft); box-shadow: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.search { max-width: 280px; }

/* ----------------------------------------------------------- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 700 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-raised); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--blue-wash); }
td.title { color: var(--ink); font-weight: 500; }
.ref { font: 600 12.5px/1 var(--mono); color: var(--blue-soft); white-space: nowrap; }

/* ----------------------------------------------------------- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--paper); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.badge.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.badge.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badge.info { color: var(--blue-soft); border-color: color-mix(in srgb, var(--blue-soft) 40%, transparent); }
.badge.neutral { color: var(--muted); }
.badge.ai { color: #c9b8ff; border-color: rgba(101, 54, 218, .6); background: rgba(101, 54, 218, .14); }
:root[data-theme="light"] .badge.ai { color: #5226c2; }
.sev { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.sev i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sev-critical i { background: var(--sev-critical); }
.sev-high i { background: var(--sev-high); }
.sev-medium i { background: var(--sev-medium); }
.sev-low i { background: var(--sev-low); outline: 1px solid var(--line-strong); }

/* ------------------------------------------------------------ meters ---- */
.meter { height: 8px; background: var(--paper); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.meter.green > span { background: var(--green); }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .track { height: 10px; background: var(--paper); border-radius: 0 4px 4px 0; position: relative; }
.bar-row .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--blue-soft); }

/* Risk matrix */
.matrix { display: grid; grid-template-columns: 26px repeat(5, minmax(36px, 1fr)); gap: 2px; font-size: 12px; }
.matrix .cell { aspect-ratio: 1.4; border-radius: 4px; display: grid; place-items: center; font-weight: 700; color: var(--ink); position: relative; font-variant-numeric: tabular-nums; }
.matrix .cell.empty { color: transparent; }
.matrix .axis { color: var(--muted); display: grid; place-items: center; font: 600 11px/1 var(--mono); }
.matrix-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }

/* ----------------------------------------------------------- lists ---- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { color: var(--ink); font-weight: 500; font-size: 14px; }
.list-item .meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pri { width: 4px; align-self: stretch; border-radius: 4px; flex: none; background: var(--line-strong); }
.pri.critical { background: var(--sev-critical); }
.pri.high { background: var(--sev-high); }
.pri.medium { background: var(--amber); }
.pri.low { background: var(--quiet); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty h3 { margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 600 12px/1 var(--mono); padding: 5px 7px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue-soft); text-decoration: none; }
.callout { border: 1px solid var(--card-line); background: var(--blue-wash); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; color: var(--ink-soft); }
.callout.warn { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); }
.callout.bad { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: color-mix(in srgb, var(--red) 8%, var(--panel)); }
.req-section { margin-top: 26px; }
.req-section:first-child { margin-top: 0; }
.req { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: start; }
.req:last-child { border-bottom: 0; }
.status-select { min-width: 150px; }

/* ------------------------------------------------------------ auth ---- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 520px); }
.auth-hero {
  padding: 56px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(120% 90% at 0% 0%, #0b2150 0%, var(--canvas) 55%), var(--canvas); border-right: 1px solid var(--line);
}
:root[data-theme="light"] .auth-hero { background: radial-gradient(120% 90% at 0% 0%, #dfe9fb 0%, var(--canvas) 60%); }
.auth-hero .claim { font-size: clamp(34px, 4.4vw, 58px); font-weight: 650; letter-spacing: -0.055em; line-height: 1.02; margin-top: 16px; }
.auth-hero .claim span { color: var(--blue-soft); }
.auth-hero .points { display: grid; gap: 14px; max-width: 520px; margin-top: 32px; }
.auth-hero .points div { display: flex; gap: 12px; color: var(--ink-soft); font-size: 14.5px; }
.auth-hero .points b { color: var(--ink); font-weight: 600; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 28px; margin: 10px 0 8px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.auth-card .btn.primary { height: 44px; width: 100%; }
.auth-card .form-actions { justify-content: stretch; }
.auth-hero .points .ico { color: var(--green); margin-top: 3px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font: 600 14px/1.6 var(--mono); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.qr { background: #fff; border-radius: 12px; padding: 8px; display: inline-block; }
.qr svg { display: block; width: 200px; height: 200px; }
.secret { font: 600 14px/1.5 var(--mono); letter-spacing: 0.08em; word-break: break-all; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }

/* ----------------------------------------------------------- overlay ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 4, 10, 0.66); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 860px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal .body { padding: 20px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: var(--panel); border-left: 1px solid var(--card-line); box-shadow: var(--shadow-lg); z-index: 40; display: flex; flex-direction: column; }
.drawer header { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer .body { padding: 18px; overflow-y: auto; flex: 1; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel-raised); border: 1px solid var(--card-line); border-radius: 12px; padding: 12px 14px; font-size: 14px; box-shadow: var(--shadow-sm); max-width: 380px; }
.toast.bad { border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.toast .rid { display: block; font: 11px var(--mono); color: var(--muted); margin-top: 4px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--blue-soft); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 30px 0; }
.ai-answer { white-space: pre-wrap; line-height: 1.6; color: var(--ink); font-size: 14.5px; }
.ai-answer .cite { font: 600 12px var(--mono); color: var(--blue-soft); background: var(--blue-wash); border-radius: 4px; padding: 1px 4px; }
.ai-answer .cite.unverified { color: var(--amber); text-decoration: line-through; }

/* ----------------------------------------------------------- report ---- */
.report { background: #fff; color: #0b1220; border-radius: var(--radius); padding: 48px 56px; max-width: 920px; }
.report h1, .report h2, .report h3 { color: #0b1220; }
.report p, .report td, .report li { color: #2c3749; }
.report th { background: #f3f5f9; color: #56627a; }
.report td, .report th { border-bottom: 1px solid #e3e8ef; }
.report .eyebrow { color: #0a62d0; }
.report .rhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #0878ff; padding-bottom: 18px; margin-bottom: 28px; }
.report section { margin-top: 28px; break-inside: avoid; }
.report .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.report .kpi { border: 1px solid #e3e8ef; border-radius: 10px; padding: 12px; }
.report .kpi b { display: block; font-size: 26px; color: #0b1220; font-variant-numeric: tabular-nums; }
.report .kpi span { font-size: 12px; color: #56627a; }
.report .foot { margin-top: 36px; font-size: 11.5px; color: #6f7a8f; border-top: 1px solid #e3e8ef; padding-top: 12px; }
.report .sev { color: #2c3749; }
.report .sev i { outline: none; }
.report .badge { background: #f3f5f9; }

/* ----------------------------------------------------------- responsive ---- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px; }
  .topbar { padding: 10px 16px; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .req { grid-template-columns: 1fr; gap: 8px; }
  .hero-number { font-size: 52px; }
  .report { padding: 24px 18px; }
  .report .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .report { border-radius: 0; padding: 0; max-width: none; }
  @page { margin: 16mm 14mm; }
}
