/* XPower RGS panel. Dark, calm, readable. No framework. */
:root {
  --bg: #0a0f1f;
  --bg2: #0e1530;
  --panel: #121a36;
  --panel2: #18224a;
  --line: #243259;
  --line2: #31417a;
  --text: #e8ecff;
  --muted: #98a4d0;
  --faint: #6b779f;
  --gold: #ffdf7a;
  --gold2: #f5b84a;
  --blue: #7aa7ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --crit: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --side: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(1200px 600px at 80% -10%, #16215a 0%, transparent 60%), var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: 0.1px; }
h2 { font-size: 15px; color: var(--text); }
h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #0d1330, #0a1028); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1b1300; display: grid; place-items: center; font-weight: 800; font-size: 16px; box-shadow: 0 4px 14px rgba(245, 184, 74, 0.35); }
.brand b { display: block; font-size: 15px; letter-spacing: 0.3px; }
.brand span { color: var(--muted); font-size: 11.5px; }
.nav { flex: 1; overflow: auto; padding: 4px 10px 10px; }
.nav h4 { margin: 14px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 0; border-radius: 9px; color: var(--muted); font-weight: 520; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav a:hover { background: rgba(122, 167, 255, 0.08); color: var(--text); text-decoration: none; }
.nav a.on { background: linear-gradient(90deg, rgba(255, 223, 122, 0.16), rgba(255, 223, 122, 0.04)); color: var(--gold); box-shadow: inset 2px 0 0 var(--gold); }
.side-foot { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.health-pill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; font-size: 12.5px; }
.health-pill:hover { text-decoration: none; border-color: var(--line2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.dot.info { background: var(--info); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px rgba(251, 191, 36, 0.6); }
.dot.crit { background: var(--crit); box-shadow: 0 0 8px rgba(248, 113, 113, 0.7); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line2); display: grid; place-items: center; font-weight: 700; color: var(--gold); text-transform: uppercase; }
.me b { display: block; font-size: 13px; }
.me small { font-size: 11.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(10, 15, 31, 0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; }
.top .crumbs { color: var(--muted); font-size: 13px; }
.btn.menu-btn { display: none; } /* (.btn, further down, would show it: the menu is always there on a wide screen, the button only on a narrow one) */
.view { padding: 22px 24px 60px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.scrim { display: none; }

/* ---------------------------------------------------------------- blocks */
.card { background: linear-gradient(180deg, var(--panel), #0f1730); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card > header { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; flex-wrap: wrap; }
.card > header h2 { flex: 1; min-width: 0; }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 14px; align-content: start; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols-kpi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: grid; gap: 14px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.gap-lg { gap: 18px; }
.kpi { background: linear-gradient(180deg, var(--panel), #0f1730); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.7px; }
.kpi .value { font-size: 26px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12.5px; }
.kpi.ok .value { color: var(--ok); }
.kpi.warn .value { color: var(--warn); }
.kpi.crit .value { color: var(--crit); }
.kpi.gold .value { color: var(--gold); }
.banner { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.banner.ok { border-color: rgba(74, 222, 128, 0.4); background: linear-gradient(90deg, rgba(74, 222, 128, 0.1), var(--panel)); }
.banner.info { border-color: rgba(96, 165, 250, 0.4); background: linear-gradient(90deg, rgba(96, 165, 250, 0.1), var(--panel)); }
.banner.warn { border-color: rgba(251, 191, 36, 0.45); background: linear-gradient(90deg, rgba(251, 191, 36, 0.12), var(--panel)); }
.banner.crit { border-color: rgba(248, 113, 113, 0.5); background: linear-gradient(90deg, rgba(248, 113, 113, 0.14), var(--panel)); }
.banner b { display: block; font-size: 15px; margin-bottom: 2px; }
.banner ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.note { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(122, 167, 255, 0.06); color: var(--muted); font-size: 13px; }
.note.warn { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.08); color: #f3dca0; }
.note.crit { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.09); color: #f6c0c0; }
.note.ok { border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); color: #bdeccd; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ---------------------------------------------------------------- badges and buttons */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(152, 164, 208, 0.14); color: var(--muted); border: 1px solid rgba(152, 164, 208, 0.25); white-space: nowrap; }
.badge.ok { background: rgba(74, 222, 128, 0.12); color: var(--ok); border-color: rgba(74, 222, 128, 0.35); }
.badge.warn { background: rgba(251, 191, 36, 0.12); color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.badge.crit { background: rgba(248, 113, 113, 0.12); color: var(--crit); border-color: rgba(248, 113, 113, 0.4); }
.badge.info { background: rgba(96, 165, 250, 0.12); color: var(--info); border-color: rgba(96, 165, 250, 0.4); }
.badge.gold { background: rgba(255, 223, 122, 0.12); color: var(--gold); border-color: rgba(255, 223, 122, 0.4); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; color: var(--text); margin: 1px 3px 1px 0; }
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.05s; white-space: nowrap; }
.btn:hover { background: #202c5e; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #201600; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--gold), var(--gold2)); }
.btn.danger { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.5); color: #ffb4b4; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(122, 167, 255, 0.1); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { padding: 7px; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { appearance: none; border: 0; background: var(--panel); color: var(--muted); padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--gold); color: #201600; }
.seg button.on.warn { background: var(--warn); }
.seg button.on.crit { background: var(--crit); color: #2a0707; }
.seg button.on.ok { background: var(--ok); color: #052512; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { appearance: none; background: none; border: 0; padding: 9px 14px; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 9px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); background: rgba(24, 34, 74, 0.6); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid rgba(36, 50, 89, 0.7); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(122, 167, 255, 0.05); }
.tbl tr.click { cursor: pointer; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td small { display: block; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.field .hint { font-size: 12px; color: var(--faint); }
input[type='text'], input[type='password'], input[type='number'], input[type='email'], input[type='search'], input[type='date'], input[type='datetime-local'], select, textarea { width: 100%; background: #0b1230; color: var(--text); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; font: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 223, 122, 0.14); }
textarea { resize: vertical; min-height: 70px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--gold); width: 16px; height: 16px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check span { display: block; }
.check small { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { min-width: 150px; }
.filters .field.wide { min-width: 240px; flex: 1; }
.err { color: var(--crit); font-size: 13px; min-height: 18px; }
.dialog .err:not(:empty) { font-size: 14px; font-weight: 600; padding: 8px 12px; border: 1px solid rgba(248, 113, 113, 0.45); border-radius: 8px; background: rgba(248, 113, 113, 0.1); } /* an error in a form is a box, not a thin line at the bottom of a tall dialog */

/* ---------------------------------------------------------------- dialogs, toasts */
.overlay { position: fixed; inset: 0; background: rgba(3, 6, 18, 0.7); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade 0.12s; }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: linear-gradient(180deg, #151f45, #0f1730); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.dialog.wide { width: min(860px, 100%); }
.dialog.xwide { width: min(1080px, 100%); }
.dialog > header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #151f45; z-index: 1; }
.dialog > header h2 { flex: 1; font-size: 16px; }
.dialog .body { padding: 18px 20px; display: grid; gap: 14px; }
.dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #131c3f; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { min-width: 240px; max-width: 420px; padding: 11px 14px; border-radius: 10px; background: #172250; border: 1px solid var(--line2); box-shadow: var(--shadow); animation: rise 0.18s; }
.toast.ok { border-color: rgba(74, 222, 128, 0.55); }
.toast.err { border-color: rgba(248, 113, 113, 0.6); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- bars and charts */
.bar { height: 8px; border-radius: 999px; background: #0b1230; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #9bc0ff); border-radius: 999px; }
.bar.ok > i { background: linear-gradient(90deg, #22c55e, var(--ok)); }
.bar.warn > i { background: linear-gradient(90deg, #f59e0b, var(--warn)); }
.bar.crit > i { background: linear-gradient(90deg, #ef4444, var(--crit)); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold2), var(--gold)); }
.stackbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); background: #0b1230; }
.stackbar > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--blue)); margin-right: 6px; vertical-align: -1px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.chart .grid-line { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { stroke: var(--line2); }
svg.chart .bar-rect { fill: var(--blue); opacity: 0.85; }
svg.chart .bar-rect:hover { opacity: 1; }
svg.chart .bar-rect.gold { fill: var(--gold2); }
svg.chart .bar-rect.ok { fill: var(--ok); }
svg.chart .bar-rect.crit { fill: var(--crit); }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .area { opacity: 0.14; }
svg.chart .ref { stroke: var(--gold); stroke-dasharray: 4 4; stroke-width: 1.2; }
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.ring .center b { font-size: 20px; }
.ring .center small { font-size: 11px; }

/* ---------------------------------------------------------------- key/value, lists */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 7px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { display: grid; gap: 0; }
.list > li, .list > div.item { list-style: none; display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid rgba(36, 50, 89, 0.7); }
.list > li:last-child, .list > div.item:last-child { border-bottom: 0; }
ul.list { margin: 0; padding: 0; }
.ev-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--panel2); color: var(--muted); }
.ev-ic svg { width: 15px; height: 15px; }
.ev-ic.ok { color: var(--ok); background: rgba(74, 222, 128, 0.12); }
.ev-ic.warn { color: var(--warn); background: rgba(251, 191, 36, 0.12); }
.ev-ic.crit { color: var(--crit); background: rgba(248, 113, 113, 0.12); }
.ev-ic.info { color: var(--info); background: rgba(96, 165, 250, 0.12); }
.codebox { position: relative; background: #070c20; border: 1px solid var(--line2); border-radius: 9px; padding: 9px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; word-break: break-all; color: #cfe0ff; }
.linkrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.linkrow .codebox { padding: 7px 10px; }
.reel-grid { display: inline-grid; grid-auto-flow: column; gap: 4px; }
.reel-grid .reel { display: grid; gap: 4px; }
.sym { min-width: 74px; padding: 7px 6px; text-align: center; border-radius: 8px; background: #0b1230; border: 1px solid var(--line2); font-size: 12px; font-weight: 600; color: var(--text); }
.sym.book { border-color: var(--gold); color: var(--gold); background: rgba(255, 223, 122, 0.08); }
.sym.hit { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.55); }
.step { display: flex; align-items: center; gap: 8px; }
.step i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); color: var(--faint); flex: none; }
.step i svg { width: 11px; height: 11px; }
.step.done i { background: rgba(74, 222, 128, 0.18); border-color: rgba(74, 222, 128, 0.6); color: var(--ok); }
.step.done span { color: var(--text); }
.step span { color: var(--muted); font-size: 12.5px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line2); border-top-color: var(--gold); animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(420px, 100%); padding: 28px 26px 24px; border-radius: 16px; background: linear-gradient(180deg, #131c40, #0e1631); border: 1px solid var(--line2); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); display: grid; gap: 14px; }
.login .brand { padding: 0 0 6px; }
.login h1 { font-size: 19px; }
.login p { margin: 0; color: var(--muted); }
.login .btn { width: 100%; padding: 11px 14px; }

/* ---------------------------------------------------------------- help */
.prose { max-width: 78ch; color: #cfd7f7; }
.prose h2 { margin: 22px 0 8px; color: var(--gold); font-size: 16px; }
.prose h3 { margin: 16px 0 6px; }
.prose p, .prose li { color: #c6cff2; }
.prose code { background: #0b1230; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; color: #cfe0ff; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform 0.2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(3, 6, 18, 0.6); z-index: 25; }
  .btn.menu-btn { display: inline-flex; }
  .top { padding: 10px 14px; }
  .view { padding: 16px 14px 60px; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(90px, 40%) 1fr; }
}
@media (max-width: 600px) {
  .cols-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 21px; }
  .card { padding: 14px; }
  .dialog > header, .dialog .body, .dialog > footer { padding-left: 14px; padding-right: 14px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .filters .field { min-width: 100%; }
  .filters .field.wide { min-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- light mode (2026-10-09, the user: "modalità chiara ... a volte stanca gli occhi"): the sun / moon button at the top
   right sets data-theme on <html>; the choice stays in this browser. The gold becomes a dark amber where it is text or a line (readable on white); the gold buttons stay bright. */
:root[data-theme='light'] {
  --bg: #f3f5fa;
  --bg2: #eaeef7;
  --panel: #ffffff;
  --panel2: #eef2fa;
  --line: #dde3ef;
  --line2: #c6cfe2;
  --text: #141b33;
  --muted: #4c5878;
  --faint: #7a85a3;
  --gold: #8f5b00;
  --gold2: #e3a21a;
  --blue: #3d74e0;
  --ok: #15803d;
  --warn: #b45309;
  --crit: #c62828;
  --info: #1f62c9;
  --shadow: 0 6px 20px rgba(20, 30, 60, 0.07);
  color-scheme: light;
}
:root[data-theme='light'] body { background: radial-gradient(1200px 600px at 80% -10%, #e2e9ff 0%, transparent 60%), var(--bg); }
:root[data-theme='light'] .side { background: linear-gradient(180deg, #ffffff, #f4f6fb); }
:root[data-theme='light'] .nav a.on { background: linear-gradient(90deg, rgba(245, 184, 74, 0.24), rgba(245, 184, 74, 0.06)); }
:root[data-theme='light'] .top { background: rgba(255, 255, 255, 0.86); }
:root[data-theme='light'] .card, :root[data-theme='light'] .kpi { background: linear-gradient(180deg, #ffffff, #fafbfe); }
:root[data-theme='light'] .note.warn { color: #6f4300; }
:root[data-theme='light'] .note.crit { color: #8f1d1d; }
:root[data-theme='light'] .note.ok { color: #14532d; }
:root[data-theme='light'] .badge.gold { background: rgba(245, 184, 74, 0.18); border-color: rgba(176, 116, 0, 0.35); }
:root[data-theme='light'] .badge.warn { background: rgba(245, 158, 11, 0.12); }
:root[data-theme='light'] .btn:hover { background: #e3e9f6; }
:root[data-theme='light'] .btn.primary, :root[data-theme='light'] .brand .logo { background: linear-gradient(180deg, #ffd966, #f2b544); color: #201600; }
:root[data-theme='light'] .btn.danger { color: #b42318; background: rgba(220, 38, 38, 0.07); border-color: rgba(220, 38, 38, 0.4); }
:root[data-theme='light'] .btn.danger:hover { background: rgba(220, 38, 38, 0.14); }
:root[data-theme='light'] .seg button.on { background: #f5c451; color: #201600; }
:root[data-theme='light'] .seg button.on.crit { background: #ef5350; color: #ffffff; }
:root[data-theme='light'] .seg button.on.ok { background: #3cc46d; color: #052512; }
:root[data-theme='light'] .tbl th { background: #eef2fa; }
:root[data-theme='light'] .tbl td, :root[data-theme='light'] .list > li, :root[data-theme='light'] .list > div.item { border-bottom-color: var(--line); }
:root[data-theme='light'] input[type='text'], :root[data-theme='light'] input[type='password'], :root[data-theme='light'] input[type='number'], :root[data-theme='light'] input[type='email'], :root[data-theme='light'] input[type='search'], :root[data-theme='light'] input[type='date'], :root[data-theme='light'] input[type='datetime-local'], :root[data-theme='light'] select, :root[data-theme='light'] textarea { background: #ffffff; }
:root[data-theme='light'] input:focus, :root[data-theme='light'] select:focus, :root[data-theme='light'] textarea:focus { border-color: #e3a21a; box-shadow: 0 0 0 3px rgba(245, 184, 74, 0.25); }
:root[data-theme='light'] .overlay { background: rgba(20, 27, 51, 0.32); }
:root[data-theme='light'] .dialog { background: #ffffff; box-shadow: 0 30px 80px rgba(20, 30, 60, 0.25); }
:root[data-theme='light'] .dialog > header { background: #ffffff; }
:root[data-theme='light'] .dialog > footer { background: #f6f8fc; }
:root[data-theme='light'] .toast { background: #ffffff; }
:root[data-theme='light'] .bar, :root[data-theme='light'] .stackbar, :root[data-theme='light'] .sym { background: #e9edf6; }
:root[data-theme='light'] .codebox { background: #f3f6fc; color: #1d2b55; }
:root[data-theme='light'] .login { background: #ffffff; box-shadow: 0 30px 80px rgba(20, 30, 60, 0.18); }
:root[data-theme='light'] .prose { color: var(--text); }
:root[data-theme='light'] .prose p, :root[data-theme='light'] .prose li { color: #2a3555; }
:root[data-theme='light'] .prose code { background: #f1f4fb; color: #1d2b55; }
:root[data-theme='light'] svg.chart .bar-rect.gold { fill: #f0a92a; }
:root[data-theme='light'] .scrim.open { background: rgba(20, 27, 51, 0.3); } /* (it shows only on a narrow screen, where the menu slides in) */