/* BackupZit console */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e5e9f2; --line-2: #d6dce8;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-soft: #eef2ff; --accent-text: #ffffff;
  --side: #0f172a; --side-text: #cbd5e1; --side-muted: #64748b; --side-hover: #1e293b; --side-on: #312e81;
  --ok: #047857; --ok-bg: #d1fae5; --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --radius: 12px; --radius-sm: 8px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
/* Dark follows the system unless the user picked a theme (data-theme, set by app.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --panel: #121829; --panel-2: #0f1524; --text: #e2e8f0; --muted: #8b97ad; --line: #1f2940; --line-2: #2b3755;
    --accent: #818cf8; --accent-2: #6366f1; --accent-soft: #1e1b4b; --accent-text: #0b1020;
    --side: #080c18; --side-text: #cbd5e1; --side-muted: #5b6886; --side-hover: #141b2e; --side-on: #24215a;
    --ok: #34d399; --ok-bg: #062f24; --warn: #fbbf24; --warn-bg: #33250a;
    --bad: #f87171; --bad-bg: #3a1214; --info: #93c5fd; --info-bg: #13244b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --panel: #121829; --panel-2: #0f1524; --text: #e2e8f0; --muted: #8b97ad; --line: #1f2940; --line-2: #2b3755;
  --accent: #818cf8; --accent-2: #6366f1; --accent-soft: #1e1b4b; --accent-text: #0b1020;
  --side: #080c18; --side-text: #cbd5e1; --side-muted: #5b6886; --side-hover: #141b2e; --side-on: #24215a;
  --ok: #34d399; --ok-bg: #062f24; --warn: #fbbf24; --warn-bg: #33250a;
  --bad: #f87171; --bad-bg: #3a1214; --info: #93c5fd; --info-bg: #13244b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -4px; }

/* ---- shell */
.side { position: fixed; inset: 0 auto 0 0; width: 240px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand b { color: #a5b4fc; font-weight: 650; }
.logo { width: 30px; height: 30px; flex: none; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--side-text); font-weight: 500; }
.side nav a .ic { color: var(--side-muted); }
.side nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.side nav a .navcount { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: #fbbf24; color: #1f1300; font-size: 12px; font-weight: 700; text-align: center; }
.side nav a.on { background: var(--side-on); color: #fff; }
.side nav a.on .ic { color: #a5b4fc; }
.navlabel { margin: 16px 12px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--side-muted); line-height: 1.6; }
.side-foot .support-link { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: linear-gradient(135deg, #fcd34d, #f59e0b); color: #1c1203; font-size: 13px; font-weight: 650; box-shadow: 0 1px 0 rgba(255,255,255,.25) inset; }
.side-foot .support-link:hover { background: linear-gradient(135deg, #fde68a, #fbbf24); text-decoration: none; }
.side-foot .support-link .ic { width: 16px; height: 16px; color: #1c1203; }
.side-foot .bug-link { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 7px 10px; border-radius: 8px; color: var(--side-text); font-size: 13px; font-weight: 500; }
.side-foot .bug-link:hover { background: var(--side-hover); text-decoration: none; }
.side-foot .bug-link .ic { width: 16px; height: 16px; color: var(--side-muted); }

.shell { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.crumb { font-weight: 600; color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user { display: flex; align-items: center; gap: 10px; margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), #a855f7); color: #fff; font-weight: 700; font-size: 13px; }
.uname { font-weight: 600; }
.iconbtn.menu { display: none; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px; flex: 1; }

/* ---- typography */
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 14px; letter-spacing: -.005em; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.mono, code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }
pre.scroll { max-height: 480px; overflow-y: auto; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 18px; }

/* ---- panels & stats */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel > h2:first-child { margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-height: 84px; display: flex; flex-direction: column; justify-content: center; }
.stat:has(.si) { padding-left: 70px; }
.stat .si { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat .si .ic { width: 20px; height: 20px; }
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.ok .si { background: var(--ok-bg); color: var(--ok); }
.stat.bad .si { background: var(--bad-bg); color: var(--bad); } .stat.bad b { color: var(--bad); }
.stat.warn .si { background: var(--warn-bg); color: var(--warn); } .stat.warn b { color: var(--warn); }
.stat.info .si { background: var(--info-bg); color: var(--info); }
.empty { display: grid; justify-items: center; gap: 8px; padding: 28px 12px; color: var(--muted); text-align: center; }
.empty .ic { width: 28px; height: 28px; opacity: .7; }
.empty p { margin: 0; }

/* ---- tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel-2); border-bottom: 1px solid var(--line); }
thead th:first-child, table > tbody:first-child > tr:first-child > th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tr:last-child td { border-bottom: 0; }
.idlink { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.kind { font-weight: 500; }

/* ---- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.runprog { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; white-space: nowrap; }
.runprog progress { width: 110px; height: 8px; border: 0; border-radius: 999px; background: var(--panel-2); accent-color: var(--accent); overflow: hidden; }
.runprog progress::-webkit-progress-bar { background: var(--panel-2); border-radius: 999px; }
.runprog progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.runprog progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.badge.success, .badge.online { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warning { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.failed, .badge.offline { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.cancelled { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.badge.running, .badge.queued { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.running i { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---- flash */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; border: 1px solid transparent; }
.flash .ic { margin-top: 1px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }

/* ---- forms */
form.stack { display: grid; gap: 16px; max-width: 720px; }
form.inline { display: inline; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:disabled { opacity: .6; }
textarea { min-height: 90px; font-family: var(--mono); font-size: 13px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; padding: 0; }
label.check.muted { color: var(--muted); }
fieldset.sched { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 12px; margin: 0; background: var(--panel-2); }
fieldset.sched legend { font-weight: 650; font-size: 13px; padding: 0 6px; }
.times, .days { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.times input, .times select { width: auto; }
.days label.check { min-width: 64px; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice label.check { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--panel); cursor: pointer; }
.choice label.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.keep { display: flex; gap: 12px; flex-wrap: wrap; } .keep label { width: 120px; }
select.narrow { width: auto; }
input.narrow { width: 5.5em; display: inline-block; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
details { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--panel-2); }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }

/* ---- buttons */
button, .btn { font: inherit; font-weight: 600; font-size: 13.5px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--accent); color: var(--accent-text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .15s, box-shadow .15s, transform .05s; box-shadow: 0 1px 2px rgba(79, 70, 229, .25); line-height: 1.3; }
button:hover, .btn:hover { background: var(--accent-2); text-decoration: none; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) button:hover, :where(:root:not([data-theme="light"])) .btn:hover { background: #a5b4fc; } }
:where(:root[data-theme="dark"]) button:hover, :where(:root[data-theme="dark"]) .btn:hover { background: #a5b4fc; }
button:active { transform: translateY(1px); }
button.secondary, a.btn.secondary-link { background: var(--panel); color: var(--text); border-color: var(--line-2); box-shadow: var(--shadow); }
button.secondary:hover, a.btn.secondary-link:hover { background: var(--panel-2); border-color: var(--accent); }
button.danger { background: var(--panel); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); box-shadow: none; }
button.danger:hover { background: var(--bad-bg); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 500; box-shadow: none; }
button.link:hover { background: none; text-decoration: underline; }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; box-shadow: none; padding: 7px 10px; }
button.ghost:hover { background: var(--panel); color: var(--text); border-color: var(--line); }
button.sm { font-size: 13px; }
.topbar .user button.ghost { height: 36px; }
.iconbtn { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--muted); box-shadow: none; }
.iconbtn:hover { background: var(--panel); border-color: var(--line); color: var(--text); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }

/* ---- key/value lists */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
dl.kv dt { color: var(--muted); font-weight: 500; }
dl.kv dd { margin: 0; word-break: break-word; }
dl.kv dd.mono { word-break: break-all; }

/* ---- image jobs, browsing */
.disks { display: grid; gap: 10px; }
.disk { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--panel-2); }
.disk .parts { display: grid; gap: 4px; margin: 8px 0 0 26px; font-family: var(--mono); font-size: 12.5px; }
.crumbs { margin-bottom: 14px; font-family: var(--mono); font-size: 13px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.files td:first-child, table.files th:first-child { width: 32px; }
table.files input { width: 16px; height: 16px; accent-color: var(--accent); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.key { font-size: 18px; letter-spacing: .05em; font-weight: 600; }

/* ---- login */
body.guest { min-height: 100vh; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #a855f7 18%, transparent), transparent 60%), var(--bg); }
.guest-main { max-width: 420px; padding: 12vh 16px 40px; }
.login { padding: 32px 30px; box-shadow: var(--shadow-lg); border-radius: 16px; }
.login .brand { color: var(--text); justify-content: center; font-size: 24px; padding: 0 0 6px; }
.login .brand b { color: var(--accent); }
.login .logo { width: 38px; height: 38px; }
.login .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.login form.stack { max-width: none; }
.login button { justify-content: center; padding: 11px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ---- responsive */
@media (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .shell { margin-left: 0; }
  .iconbtn.menu { display: inline-grid; }
  .topbar { padding: 0 16px; }
  main { padding: 20px 16px; }
}
@media (max-width: 700px) {
  .row { grid-template-columns: 1fr; }
  .uname, .user button span { display: none; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 10px; }
  .panel { padding: 16px; } .table-wrap { margin: 0 -16px; padding: 0 16px; }
}
@media print { .side, .topbar { display: none; } .shell { margin: 0; } .panel { box-shadow: none; } }
.strong { font-weight: 600; }
.small { font-size: 12px; }

/* ---- page heads, reports */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead h1 { margin: 0; }
.pagehead .actions { margin: 0; }
form.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
form.filters label { min-width: 170px; flex: 1; }
form.filters > div { flex: none; }
.report-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.report-title h2 { font-size: 19px; margin: 0; }
.chart { width: 100%; height: 220px; display: block; }
.chart .axis { stroke: var(--line-2); stroke-width: 1; }
.b-ok { fill: #10b981; } .b-warn { fill: #f59e0b; } .b-fail { fill: #ef4444; }
.chart g:hover rect { opacity: .8; }
.chart-labels { display: flex; font-size: 11px; color: var(--muted); }
.chart-labels span { flex: 1; text-align: center; white-space: nowrap; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--muted); }
.legend .l-ok::before { background: #10b981; } .legend .l-warn::before { background: #f59e0b; }
.legend .l-fail::before { background: #ef4444; } .legend .l-plan::before { background: var(--accent); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.meter meter { flex: 1; height: 8px; }
.meter span { font-variant-numeric: tabular-nums; font-size: 12.5px; width: 52px; text-align: right; }
td.msg { max-width: 460px; word-break: break-word; }
form.inline-form { display: grid; gap: 12px; }
form.inline-form label { max-width: 560px; }

/* ---- calendar */
.calwrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.calhead { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.calhead h2 { margin: 0; font-size: 18px; }
.calhead .legend { margin: 0; }
.calfilter select { width: auto; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dow { padding: 8px 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calday { min-height: 116px; padding: 6px 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calday.out { background: var(--panel-2); }
.calday.out .dnum { opacity: .45; }
.calday.past .ev.plan { opacity: .5; }
.dnum { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 2px 4px; }
.calday.today .dnum { background: var(--accent); color: var(--accent-text); border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; }
.ev { display: block; font-size: 11.5px; line-height: 1.35; padding: 3px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); background: var(--panel-2); border-left: 3px solid var(--muted); }
.ev:hover { text-decoration: none; filter: brightness(.97); }
.ev b { font-weight: 650; font-variant-numeric: tabular-nums; }
.ev i { font-style: normal; color: var(--muted); }
.ev.plan { background: var(--accent-soft); border-left-color: var(--accent); }
.ev.success { background: var(--ok-bg); border-left-color: #10b981; }
.ev.warning { background: var(--warn-bg); border-left-color: #f59e0b; }
.ev.failed { background: var(--bad-bg); border-left-color: #ef4444; }
.ev.running, .ev.queued { background: var(--info-bg); border-left-color: var(--info); }
.more { font-size: 11px; color: var(--muted); padding: 0 6px; }
.agenda-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.agenda-list li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.agenda-list li:last-child { border-bottom: 0; }
.agenda-list .when { display: grid; font-size: 12.5px; }
.agenda-list .when span { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- documentation */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.docnav { position: sticky; top: 80px; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.docnav-title { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 4px 8px 10px; }
.docnav a { padding: 7px 10px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.docnav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.docnav a.on { background: var(--accent-soft); color: var(--accent); }
article.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 36px; box-shadow: var(--shadow); line-height: 1.7; font-size: 14.5px; max-width: 900px; }
article.doc h1 { font-size: 28px; margin-bottom: 8px; }
article.doc .lead { font-size: 16px; color: var(--muted); margin-bottom: 24px; }
article.doc h2 { font-size: 19px; margin: 32px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
article.doc h3 { font-size: 15.5px; margin: 22px 0 8px; }
article.doc ul, article.doc ol { padding-left: 22px; margin: 0 0 14px; }
article.doc li { margin-bottom: 5px; }
article.doc table { margin: 8px 0 16px; font-size: 13.5px; }
article.doc pre { margin: 6px 0 16px; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; margin: 14px 0; }
.callout.warn { border-left-color: #f59e0b; background: var(--warn-bg); }
.callout.tip { border-left-color: #10b981; background: var(--ok-bg); }
.callout p:last-child { margin-bottom: 0; }
.docpager { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); }
kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--panel-2); }

@media (max-width: 1100px) { .calwrap { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } .docnav { position: static; } article.doc { padding: 20px; } }
@media (max-width: 700px) { .calday { min-height: 70px; } .ev { font-size: 10.5px; padding: 2px 4px; } .ev b { display: none; } }
@media print { .noprint, .docnav { display: none !important; } body { background: #fff; } }

/* ---- users */
.me { display: flex; align-items: center; gap: 10px; color: var(--text); }
.me:hover { text-decoration: none; }
.uname { display: grid; line-height: 1.2; }
.uname small { font-weight: 500; font-size: 11.5px; color: var(--muted); }
@media (max-width: 700px) { .uname { display: none; } .crumb { visibility: hidden; } .topbar { gap: 8px; } .langs { margin-right: 0; } .langs select { padding: 0 24px 0 8px; } }
.avatar.lg { width: 40px; height: 40px; font-size: 17px; display: inline-grid; }
.badge.active { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.disabled { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge.info-badge { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.role-admin { background: #ede9fe; color: #6d28d9; border-color: transparent; }
.badge.role-operator { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.role-restore { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
@media (prefers-color-scheme: dark) { :where(:root:not([data-theme="light"])) .badge.role-admin { background: #2e1065; color: #c4b5fd; } }
:where(:root[data-theme="dark"]) .badge.role-admin { background: #2e1065; color: #c4b5fd; }
table.roles td, table.roles th { padding: 7px 8px; font-size: 12.5px; }
.center { text-align: center; }
.yes { color: var(--ok); font-weight: 700; } .no { color: var(--line-2); }
.role-notes { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; display: grid; gap: 4px; }
.perm-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13px; }
.perm-list li::before { content: "✓"; display: inline-block; width: 20px; color: var(--ok); font-weight: 700; }
.perm-list li.no { color: var(--muted); } .perm-list li.no::before { content: "—"; color: var(--line-2); }
.forbidden { padding: 48px 20px; }
.forbidden h1 { justify-content: center; margin: 8px 0; }
label.check.top { align-self: end; padding-bottom: 10px; }

/* ---- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 22px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tabs a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- settings with side tabs */
.settings { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidetabs { position: sticky; top: 80px; display: grid; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.sidetabs a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; color: var(--text); font-weight: 600; }
.sidetabs a .ic { margin-top: 2px; color: var(--muted); }
.sidetabs a span { display: grid; gap: 1px; }
.sidetabs a small { font-weight: 400; font-size: 12px; color: var(--muted); }
.sidetabs a:hover { background: var(--panel-2); text-decoration: none; }
.sidetabs a.on { background: var(--accent-soft); color: var(--accent); }
.sidetabs a.on .ic { color: var(--accent); }
.settings-body > .panel:first-child { margin-top: 0; }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } .sidetabs { position: static; grid-auto-flow: column; overflow-x: auto; } .sidetabs a small { display: none; } }

/* calendar: collapsed extra entries, expandable day */
.calday .ev.extra { display: none; }
.calday.expanded .ev.extra { display: block; }
.calday.expanded { position: relative; z-index: 2; background: var(--panel); box-shadow: var(--shadow-lg); }
button.more { background: none; border: 0; box-shadow: none; color: var(--accent); font-size: 11.5px; font-weight: 600; padding: 2px 6px; text-align: left; cursor: pointer; }
button.more:hover { background: none; text-decoration: underline; }
/* number inputs: room for the value next to the spin buttons */
input.narrow { width: 7.5em; padding-right: 4px; }
input[type=number] { min-width: 5.5em; }
label.check input[type=number], label.check input[type=text] { width: 7.5em; height: auto; padding: 6px 8px; flex: none; }

/* ---- two-factor */
input.otp { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; max-width: 220px; text-align: center; }
input.narrow-otp { font-size: 16px; max-width: 180px; }
.setup2fa { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: start; }
svg.qr { width: 220px; height: 220px; display: block; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0 12px; }
code.secret { display: inline-block; margin-top: 4px; font-size: 13px; letter-spacing: .05em; }
ul.codes { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
ul.codes li { font-size: 15px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; background: var(--panel-2); }
@media (max-width: 700px) { .setup2fa { grid-template-columns: 1fr; } }

/* ---- downloads */
.dl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dl-list li { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: center; }
.dl-list li .btn { justify-content: flex-start; width: 100%; }
@media (max-width: 700px) { .dl-list li { grid-template-columns: 1fr; } }
pre.code-box { font-size: 14px; word-break: break-all; white-space: pre-wrap; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

/* ---- restore wizard */
.wizard { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.wizard li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.wizard li > a, .wizard li:not(:has(a)) { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; padding: 10px 12px; color: var(--muted); }
.wizard li > a:hover { text-decoration: none; background: var(--panel-2); border-radius: var(--radius-sm); }
.wizard span { grid-row: span 2; align-self: center; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.wizard b { color: var(--text); font-weight: 600; }
.wizard small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wizard li.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wizard li.on span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.wizard li.done span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 6px; align-content: start; padding: 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.tile .ic { width: 26px; height: 26px; color: var(--accent); }
.tile span { color: var(--muted); font-size: 13px; }
.tile small { color: var(--accent); font-weight: 600; margin-top: 4px; }
a.tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-lg); }
.tile.off { opacity: .55; }
.tile.off .ic, .tile.off small { color: var(--muted); }
table.pick td .btn { padding: 6px 12px; }
@media (max-width: 760px) {
  .wizard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- VMware hosts */
#vmware select[name=proxy_agent_id] { min-width: 10rem; }
.wrap-any { overflow-wrap: anywhere; }

/* Job list: filter bar, kind badges */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.filterbar input[type=search] { flex: 1 1 220px; max-width: 340px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: none; }
.chip small { color: var(--muted); margin-left: 4px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.bad { color: var(--bad); }
.chip.bad.on { background: var(--bad-bg); border-color: var(--bad); }
.kind-badge { margin-top: 4px; font-weight: 500; font-size: 11px; padding: 1px 8px; }
.kind-vm { color: var(--info); }
.kind-sql { color: var(--warn); }
.kind-copy { color: var(--accent); }

/* Dashboard: needs attention */
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { padding: 8px 0; border-top: 1px solid var(--line); }
.attention li:first-child { border-top: 0; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); margin: 0; }

/* Language switch */
.langs { display: flex; gap: 2px; margin-right: 6px; }
.langs select { width: auto; min-width: 0; height: 36px; padding: 0 30px 0 12px; font-size: 13.5px; background-color: transparent; color: var(--text); border-color: var(--line); }
.langs button { padding: 3px 8px; font-size: 12px; }
.login-langs { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 12px; }
.iconbtn.theme { margin-right: 4px; }

/* storage usage */
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.usage-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel-2); min-width: 0; }
.usage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.usage-cap { display: grid; gap: 4px; margin-bottom: 8px; }
.usage-bar { width: 100%; height: 8px; display: block; }
.usage-bar .ub-bg { fill: var(--line-2); }
.usage-bar .ub-fill { fill: var(--accent); }
.usage-bar.high .ub-fill { fill: var(--warn); }
.usage-bar.crit .ub-fill { fill: var(--bad); }
.usage-chart { width: 100%; height: auto; display: block; margin: 4px 0; }
.usage-chart .uc-grid { stroke: var(--line); stroke-width: 1; }
.usage-chart .uc-cap { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 4 3; }
.usage-chart .uc-area { fill: var(--accent-soft); }
.usage-chart .uc-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.usage-chart .uc-proj { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 4; opacity: .7; }
.usage-chart .uc-text { fill: var(--muted); font-size: 11px; }
.usage-forecast { margin: 6px 0 0; }
.docnav-search { margin: 0 4px 8px; }
.docnav-search input { width: 100%; padding: 6px 10px; font-size: 13px; }
.docsearch-big { display: flex; gap: 8px; margin: 8px 0 16px; }
.docsearch-big input { flex: 1; }
.search-hits { padding-left: 20px; display: grid; gap: 14px; }
.search-hits p { margin: 4px 0 0; color: var(--muted); }
.search-hits mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 2px; }
.sso-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.sso-or::before, .sso-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.sso-btn { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; }
.panel fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 12px; margin: 0; background: var(--panel-2); }
.panel fieldset legend { font-weight: 650; font-size: 13px; padding: 0 6px; }
.panel fieldset .check small { display: block; margin-left: 24px; }
.release-notes { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 14px; }
.release-notes h4 { margin: 12px 0 4px; }
.release-notes ul { margin: 4px 0; padding-left: 20px; }
.release-notes li { margin: 3px 0; }
