/* Remindora Admin
   Ink navy chrome, cool paper work area, state colours carry meaning only:
   green = active, amber = inactive / needs attention, red = disabled / destructive, blue = action. */

:root {
  --ink: #0e1a36;
  --ink-2: #172650;
  --ink-text: #c9d3ee;
  --ink-muted: #7f8db3;
  --paper: #f3f5fa;
  --surface: #ffffff;
  --line: #dfe4ee;
  --line-strong: #c8d0df;
  --text: #121a2c;
  --text-2: #4a5570;
  --text-3: #7a849c;
  --blue: #2f5bea;
  --blue-deep: #2247c4;
  --blue-soft: #e8eefe;
  --green: #1f9d6b;
  --green-soft: #e3f5ec;
  --amber: #c27a12;
  --amber-soft: #fbf0dc;
  --red: #c8363d;
  --red-soft: #fbe7e8;
  --grey-soft: #eceff5;
  --focus: 0 0 0 3px rgba(47, 91, 234, 0.35);
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.text-danger, .btn.text-danger { color: var(--red); }

/* ------------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: var(--ink-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px;
  color: #fff; font-size: 17px; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand b { font-weight: 800; color: #8fa9ff; }
.nav-group { padding: 6px 12px 10px; }
.nav-group-label { color: var(--ink-muted); font-size: 12.5px; font-weight: 600; padding: 6px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--ink-text); font-weight: 500; font-size: 14.5px;
}
.nav-item svg { opacity: 0.75; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 #8fa9ff; }
.nav-item.active svg { opacity: 1; color: #8fa9ff; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.whoami { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: #2b3d70; color: #fff; font-weight: 700;
}
.whoami-name { color: #fff; font-weight: 600; font-size: 14px; }
.whoami-role { color: var(--ink-muted); font-size: 12.5px; text-transform: capitalize; }
.signout {
  margin-top: 12px; width: 100%;
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink-text); border-radius: var(--radius-sm);
  padding: 7px; font: inherit; font-size: 13.5px; cursor: pointer;
}
.signout:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.main-col { min-width: 0; }
.topbar { display: none; }
.content { padding: 28px 36px 64px; max-width: 1280px; }
.scrim { display: none; }

/* ------------------------------------------------------------------ page header */

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { color: var(--text-2); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ buttons & inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 8px 14px; min-height: 38px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-deep); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--grey-soft); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #a92b31; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #17805a; }
.icon-btn {
  border: 0; background: transparent; font-size: 24px; line-height: 1;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--grey-soft); }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px; min-height: 38px;
  width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
input:disabled { background: var(--grey-soft); color: var(--text-2); }
input[type='checkbox'] { width: 17px; height: 17px; min-height: 0; accent-color: var(--blue); cursor: pointer; }
input[type='range'] { padding: 0; border: 0; accent-color: var(--blue); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-weight: 600; font-size: 13.5px; color: var(--text); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-error { font-size: 12.5px; color: var(--red); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.input-with-button { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------------ panels & tables */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-alert { border-color: var(--amber); box-shadow: inset 4px 0 0 var(--amber); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; font-weight: 700; }
.panel-head-pad { padding: 18px 22px 0; }
.pad-x { padding: 0 22px 12px; }
.narrow-panel { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-2 > .panel { margin-bottom: 20px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--text-2);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfd;
  white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f7f9fd; }
.table tr.selected td { background: var(--blue-soft); }
.table.is-loading tbody { opacity: 0.55; }
.table-compact td, .table-compact th { padding: 8px 14px; }
.table .num, .table th.num { text-align: right; }
.table .center { text-align: center; }
.col-check { width: 44px; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn + .btn { margin-left: 4px; }
.cell-main { display: block; font-weight: 600; color: var(--text); }
.cell-sub { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.id { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.link-cell {
  background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; color: inherit;
}
.link-cell:hover .cell-main { color: var(--blue); }
.link-cell:disabled { cursor: default; }
.reason-cell { max-width: 280px; color: var(--text-2); font-size: 13px; }
.detail-row td { background: #fafbfd; }
.detail-row pre { margin: 0; white-space: pre-wrap; font-size: 12px; }
.tick { color: var(--green); font-weight: 800; }
.matrix th button { font-weight: 600; font-size: 13px; color: var(--blue); }
.matrix th button:disabled { color: var(--text-2); }
.you {
  margin-left: 6px; font-size: 11.5px; font-weight: 600; color: var(--blue);
  background: var(--blue-soft); padding: 1px 6px; border-radius: 999px;
}

.pager {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13.5px;
}
.pager-buttons { display: flex; align-items: center; gap: 6px; }
.pager-page { padding: 0 6px; }

/* ------------------------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 5px 9px 5px 8px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-amber { color: var(--amber); background: var(--amber-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-blue { color: var(--blue); background: var(--blue-soft); }
.badge-grey { color: var(--text-2); background: var(--grey-soft); }

/* ------------------------------------------------------------------ the population bar (signature) */

.population {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px 18px;
  margin-bottom: 20px;
}
.population-bar {
  display: flex; gap: 3px; height: 18px; border-radius: 6px; overflow: hidden;
  margin-bottom: 16px;
}
.seg { display: block; min-width: 6px; transition: opacity 0.2s, flex-grow 0.5s ease; }
.seg.dim { opacity: 0.22; }
.seg-active { background: var(--green); }
.seg-inactive { background: var(--amber); }
.seg-disabled { background: var(--red); }
.seg-pending_deletion { background: repeating-linear-gradient(135deg, var(--red) 0 5px, #e26b70 5px 10px); }
.seg-empty { background: var(--grey-soft); }
.population-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pop-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
a.pop-item:hover { text-decoration: none; background: var(--paper); }
button.pop-item:hover { background: var(--paper); }
.pop-item.on { border-color: var(--line-strong); background: var(--paper); }
.pop-count { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.pop-count small { font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.pop-label { font-weight: 600; color: var(--text); font-size: 14px; }
.pop-hint { font-size: 12.5px; color: var(--text-3); }
.pop-all .pop-count { color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-active { background: var(--green); }
.dot-inactive { background: var(--amber); }
.dot-disabled { background: var(--red); }
.dot-pending_deletion { background: var(--red); box-shadow: inset 0 0 0 2px #f5b7ba; }
.population-total { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13.5px; }

/* ------------------------------------------------------------------ stats */

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-row .stat { padding: 16px 20px; border-left: 1px solid var(--line); }
.stat-row .stat:first-child { border-left: 0; }
.stat-row-flat { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0 -22px 16px; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }
.stat-note { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 20px; margin: 4px 0 16px; }
.kv-grid > div { display: flex; flex-direction: column; gap: 2px; }
.kv-grid span { font-size: 12.5px; color: var(--text-3); }
.kv-grid b { font-weight: 600; font-size: 15px; }
.kv-grid b small { font-weight: 500; color: var(--text-3); font-size: 12px; }
.kv-grid .warn b { color: var(--red); }
.kv-grid-4 { grid-template-columns: repeat(4, 1fr); }

.split-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.split-row { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 5px; }
.split-row small { color: var(--text-3); font-weight: 500; }
.meter { height: 8px; background: var(--grey-soft); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.meter .meter-ios { background: var(--ink); }
.meter .meter-android { background: var(--green); }

/* ------------------------------------------------------------------ chart */

.chart svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; min-height: 20px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-readout { margin-left: auto; color: var(--text); font-weight: 600; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.heat { background: rgba(31, 157, 107, calc(var(--heat) * 0.35)); }

/* ------------------------------------------------------------------ toolbar, segmented */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar > select, .toolbar > input { width: auto; }
.toolbar .search { flex: 1 1 280px; max-width: 420px; }
.toolbar .narrow { width: 150px; }
.toolbar-note { flex: 1; }
.toolbar-end { justify-content: flex-end; }
.date-range { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.date-range input { width: auto; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--grey-soft); border-radius: 9px; margin-bottom: 16px; }
.segmented button {
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  background: transparent; border: 0; padding: 6px 13px; border-radius: 7px; cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(14, 26, 54, 0.12); }

.bulk-bar {
  position: sticky; top: 12px; z-index: 5;
  display: flex; gap: 10px; align-items: center;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 8px 10px 8px 16px; margin-bottom: 12px;
}
.bulk-bar span { margin-right: auto; }
.bulk-bar .btn-ghost { color: var(--ink-text); }
.bulk-bar .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ------------------------------------------------------------------ feature list */

.flag-list { list-style: none; margin: 0; padding: 0; }
.flag-list li { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.flag-list li:last-child { border-bottom: 0; }
.flag-main { flex: 1; min-width: 0; }
.flag-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.toggle {
  position: relative; width: 42px; height: 24px; flex: none;
  border-radius: 99px; border: 0; background: var(--line-strong); cursor: pointer;
  transition: background-color 0.15s;
}
.toggle.on { background: var(--green); }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.toggle-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s;
}
.toggle.on .toggle-knob { transform: translateX(18px); }
.toggle-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; font-weight: 600; }

.version-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 16px; }
.version-grid h3 { font-size: 15px; margin-bottom: 10px; }
.json-setting { margin-bottom: 18px; }

/* ------------------------------------------------------------------ overlays */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(14, 26, 54, 0.45);
  display: grid; place-items: center; padding: 16px;
  animation: fade 0.12s ease-out;
}
.modal {
  background: var(--surface); border-radius: 12px; width: min(560px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(14, 26, 54, 0.3);
}
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 8px; }
.modal-head h2 { font-size: 19px; font-weight: 700; }
.modal-body { padding: 8px 20px 12px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.dialog-message { color: var(--text-2); margin-bottom: 14px; }

.overlay-drawer { place-items: stretch end; padding: 0; }
.drawer {
  background: var(--surface); width: min(560px, 100vw); height: 100vh;
  display: flex; flex-direction: column;
  animation: slide-in 0.18s ease-out;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-title h2 { font-size: 20px; font-weight: 800; word-break: break-all; }
.drawer-sub { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.drawer-body { padding: 18px 22px 40px; overflow-y: auto; }
.drawer-h { font-size: 15px; font-weight: 700; margin: 22px 0 8px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.device-list, .plain-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.device-list li, .plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.device-list li:last-child, .plain-list li:last-child { border-bottom: 0; }
.device-list li.revoked { opacity: 0.6; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline p { display: flex; gap: 8px; align-items: center; }
.timeline-reason { color: var(--text-2); font-size: 13.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  font: inherit; font-size: 13px; padding: 4px 11px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--text-3); }
.chip-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.check-list { display: grid; gap: 4px; margin-bottom: 14px; }
.check-list-2 { grid-template-columns: 1fr 1fr; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.check-item:hover { background: var(--paper); }
.check-item input { margin-top: 2px; }
.check-item b { font-weight: 600; font-size: 14px; }

.notice { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.notice-red { background: var(--red-soft); color: #8e2227; }
.notice-amber { background: var(--amber-soft); color: #7a4c08; }
.notes { white-space: pre-wrap; background: var(--paper); padding: 12px 14px; border-radius: var(--radius-sm); color: var(--text-2); margin-bottom: 14px; }
.consent { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.consent h3 { font-size: 16px; margin-bottom: 6px; }
.consent .muted { margin-bottom: 12px; }
.secret-box { display: flex; gap: 10px; align-items: center; background: var(--paper); border: 1px dashed var(--line-strong); padding: 12px 14px; border-radius: var(--radius-sm); margin: 12px 0; }
.secret-box code { font-size: 17px; flex: 1; word-break: break-all; }
.perm-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.perm-list li code { background: var(--grey-soft); padding: 3px 8px; border-radius: 6px; }

.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 14px; max-width: 420px;
  box-shadow: 0 8px 24px rgba(14, 26, 54, 0.25); animation: rise 0.18s ease-out;
}
.toast-error { background: var(--red); }

.loading { display: flex; align-items: center; gap: 10px; color: var(--text-3); padding: 28px 22px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.error-box {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--red-soft); color: #8e2227; padding: 10px 14px; border-radius: var(--radius-sm);
  margin: 0 0 14px; font-size: 14px;
}
.panel-flush > .error-box { margin: 14px; }
.empty { padding: 44px 22px; text-align: center; }
.empty-title { font-weight: 700; font-size: 16px; }
.empty-body { color: var(--text-3); margin-top: 6px; }

/* ------------------------------------------------------------------ auth */

.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 10% -10%, #1d2f63 0%, transparent 60%),
    var(--ink);
}
.auth-shell > .loading { color: var(--ink-text); }
.auth-card { background: var(--surface); border-radius: 14px; padding: 30px 30px 26px; width: min(420px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 26px; }
.auth-brand b { color: var(--blue); font-weight: 800; }
.auth-card h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.auth-sub, .auth-text { color: var(--text-2); margin: 6px 0 20px; }
.auth-notice { background: var(--amber-soft); color: #7a4c08; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 4px; }
.auth-form .btn { margin-top: 6px; }
.code-input { font-size: 24px; letter-spacing: 0.3em; text-align: center; font-family: var(--mono); }
.enrol-steps { margin: 0 0 10px; padding-left: 20px; color: var(--text-2); }
.enrol-steps li { margin-bottom: 4px; }
.qr-wrap { display: grid; place-items: center; padding: 8px 0 10px; }
.qr { border: 1px solid var(--line); border-radius: 8px; }
.secret { margin-bottom: 14px; font-size: 13.5px; color: var(--text-2); }
.secret summary { cursor: pointer; color: var(--blue); }
.secret code { display: block; margin-top: 8px; font-size: 15px; background: var(--paper); padding: 8px 10px; border-radius: 6px; word-break: break-all; }

/* ------------------------------------------------------------------ motion */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.4; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row .stat:nth-child(3) { border-left: 0; }
  .stat-row .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 50; transform: translateX(-100%); transition: transform 0.2s; }
  .menu-open .sidebar { transform: none; }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(14, 26, 54, 0.45); z-index: 45; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar-title { font-weight: 700; }
  .content { padding: 20px 16px 48px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 24px; }
  .version-grid { grid-template-columns: 1fr; }
  .version-grid h3 { display: none; }
  .check-list-2 { grid-template-columns: 1fr; }
  .kv-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .flag-list li { flex-wrap: wrap; }
  .toolbar > select, .toolbar > input, .toolbar .search { width: 100%; max-width: none; }
}
@media (max-width: 520px) {
  .stat-row { grid-template-columns: 1fr; }
  .stat-row .stat { border-left: 0 !important; border-top: 1px solid var(--line); }
  .stat-row .stat:first-child { border-top: 0; }
  .population-legend { grid-template-columns: 1fr 1fr; }
}

/* App versions & force update (one card per platform) */
.platform-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.platform-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.platform-card.is-forced { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
.platform-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.platform-card-head h3 { font-size: 16px; margin: 0; }
.platform-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.platform-card textarea, .platform-card input { width: 100%; }
@media (max-width: 900px) { .platform-cards { grid-template-columns: 1fr; } }
