/* Wimbi design system (November 2026 redesign).
   Loaded after styles.css: design tokens, light and dark themes, and every shared component.
   Page-specific styles live in /theme/<area>.css and use only these tokens.
   Older page rules in styles.css read the legacy names (--card, --input, --on, ...),
   which are mapped onto the new tokens below, so every page follows the theme. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap');

/* ---------- Tokens ---------- */

:root, :root[data-theme="light"] {
  color-scheme: light;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Poppins', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', Consolas, monospace;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f0f3f7;
  --side-bg: #fbfcfd;
  --border: #e4e9f0;
  --border-strong: #d2dae5;
  --text: #0f1b2d;
  --text-2: #3a4859;
  --muted: #64748b;
  --faint: #94a3b8;

  --accent: #115ea6;
  --accent-hover: #0c4f8e;
  --accent-soft: #eaf2fb;
  --accent-text: #0f5aa0;
  --accent-ring: rgba(17, 94, 166, 0.2);
  --btn-bg: #115ea6;
  --btn-bg-hover: #0c4f8e;
  --brand-green: #8bc53f;
  --brand-green-text: #4f8a14;

  --success: #15803d;
  --success-soft: #e8f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e2;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --danger-btn: #c62828;
  --violet: #6d4ae0;
  --violet-soft: #f0ecfd;
  --teal: #0f766e;
  --teal-soft: #e3f4f2;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 27, 45, 0.05);
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06), 0 1px 3px rgba(15, 27, 45, 0.05);
  --shadow-md: 0 6px 16px -4px rgba(15, 27, 45, 0.1), 0 2px 4px -2px rgba(15, 27, 45, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(15, 27, 45, 0.25), 0 6px 16px -6px rgba(15, 27, 45, 0.1);
  --scrim: rgba(12, 20, 32, 0.45);

  --control-h: 34px;
  --control-h-sm: 28px;
  --side-w: 232px;
  --side-w-collapsed: 64px;
  --topbar-h: 54px;
  --tabbar-h: 60px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Legacy names used by page styles in styles.css */
  --card: var(--surface);
  --input: var(--surface-2);
  --grid: #e9eef4;
  --accent-deep: var(--accent-hover);
  --on: var(--success);
  --off: var(--danger);
  --mid: #d08a0b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f15;
  --surface: #121821;
  --surface-2: #161d27;
  --surface-3: #1c2531;
  --side-bg: #0e131a;
  --border: #222c39;
  --border-strong: #2e3a4a;
  --text: #e8edf4;
  --text-2: #c3cdd9;
  --muted: #8a97a9;
  --faint: #5e6b7d;
  --accent: #5aa3ea;
  --accent-hover: #7ab6f0;
  --accent-soft: rgba(90, 163, 234, 0.14);
  --accent-text: #7ab6f0;
  --accent-ring: rgba(90, 163, 234, 0.32);
  --btn-bg: #2a73c0;
  --btn-bg-hover: #3584d6;
  --brand-green: #9fd35a;
  --brand-green-text: #9fd35a;
  --success: #4ccb7f;
  --success-soft: rgba(76, 203, 127, 0.13);
  --warning: #f2b44b;
  --warning-soft: rgba(242, 180, 75, 0.13);
  --danger: #f2706b;
  --danger-soft: rgba(242, 112, 107, 0.13);
  --danger-btn: #c9413b;
  --violet: #a48bf5;
  --violet-soft: rgba(164, 139, 245, 0.14);
  --teal: #45c4b8;
  --teal-soft: rgba(69, 196, 184, 0.13);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.65);
  --scrim: rgba(2, 6, 12, 0.6);
  --grid: #1f2833;
  --mid: var(--warning);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f15;
    --surface: #121821;
    --surface-2: #161d27;
    --surface-3: #1c2531;
    --side-bg: #0e131a;
    --border: #222c39;
    --border-strong: #2e3a4a;
    --text: #e8edf4;
    --text-2: #c3cdd9;
    --muted: #8a97a9;
    --faint: #5e6b7d;
    --accent: #5aa3ea;
    --accent-hover: #7ab6f0;
    --accent-soft: rgba(90, 163, 234, 0.14);
    --accent-text: #7ab6f0;
    --accent-ring: rgba(90, 163, 234, 0.32);
    --btn-bg: #2a73c0;
    --btn-bg-hover: #3584d6;
    --brand-green: #9fd35a;
    --brand-green-text: #9fd35a;
    --success: #4ccb7f;
    --success-soft: rgba(76, 203, 127, 0.13);
    --warning: #f2b44b;
    --warning-soft: rgba(242, 180, 75, 0.13);
    --danger: #f2706b;
    --danger-soft: rgba(242, 112, 107, 0.13);
    --danger-btn: #c9413b;
    --violet: #a48bf5;
    --violet-soft: rgba(164, 139, 245, 0.14);
    --teal: #45c4b8;
    --teal-soft: rgba(69, 196, 184, 0.13);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.65);
    --scrim: rgba(2, 6, 12, 0.6);
    --grid: #1f2833;
    --mid: var(--warning);
  }
}

@media (pointer: coarse) {
  :root, :root[data-theme="light"], :root[data-theme="dark"] { --control-h: 40px; --control-h-sm: 34px; }
}

/* ---------- Base ---------- */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  letter-spacing: -0.006em;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

h1 { font: 650 1.375rem/1.25 var(--font); letter-spacing: -0.022em; color: var(--text); margin: 0; }
h2 { font: 600 0.9375rem/1.35 var(--font); letter-spacing: -0.01em; text-transform: none; color: var(--text); margin: 0 0 12px; }
.card > h2::before, .page-head + .card > h2::before { content: none; }
h3 { font: 600 0.875rem/1.4 var(--font); letter-spacing: -0.005em; color: var(--text); margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
code { font: 0.85em var(--font-mono); background: var(--surface-3); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; }
kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: 500 11px/1 var(--font); color: var(--muted);
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- Buttons ---------- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: #fff;
  font: 550 0.84375rem/1.2 var(--font);
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 27, 45, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
}
button:hover:not(:disabled), .button:hover { background: var(--btn-bg-hover); text-decoration: none; }
button:active:not(:disabled), .button:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

button.ghost, .button.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  padding: 0 12px;
}
button.ghost:hover:not(:disabled), .button.ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }

button.link, .button.link {
  min-height: 0;
  padding: 2px 4px;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: none;
}
button.link:hover:not(:disabled) { background: none; text-decoration: underline; text-underline-offset: 2px; }
button.link.danger, button.link.today-lost { color: var(--danger); }

button.small, .button.small { min-height: var(--control-h-sm); padding: 0 10px; font-size: 0.8125rem; border-radius: 7px; }
button.link.small { min-height: 0; padding: 2px 4px; }

button.danger:not(.link), .button.danger, button.backup-danger:not(:disabled) { background: var(--danger-btn); color: #fff; border-color: transparent; }
button.danger:not(.link):hover:not(:disabled), button.backup-danger:not(:disabled):hover { background: color-mix(in srgb, var(--danger-btn) 86%, #000); filter: none; }

.icon-btn, button.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  box-shadow: none;
}
.icon-btn:hover:not(:disabled), button.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
button svg, .button svg { width: 16px; height: 16px; flex: none; }
button.small svg { width: 14px; height: 14px; }

/* Chip-like buttons */
.chip-btn, button.chip-btn {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  box-shadow: none;
  font-size: 0.78125rem;
  font-weight: 500;
  max-width: 100%;
  height: auto;
  padding-block: 3px;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}
button.chip-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Card-like buttons keep their own layout */
.tile-button, .camp-design, .pv-chip, .deal { align-items: stretch; justify-content: flex-start; text-align: left; box-shadow: none; white-space: normal; }
button.tile-button { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 400; white-space: normal; min-height: 0; }
button.tile-button:hover:not(:disabled) { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
button.camp-design:hover:not(:disabled) { background: var(--surface); }
button.pv-chip:hover:not(:disabled) { background: var(--surface); }

/* Segmented tabs: <div class="actions tabs"> with aria-pressed buttons */
.tabs, .actions.tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  margin-bottom: 16px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tabs > button, .tabs > button.ghost, .tabs > button.small {
  min-height: 28px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
  font-weight: 550;
  border-radius: 7px;
}
.actions .tabs, .map-tools .tabs { margin-bottom: 0; }
.tabs > button:hover:not(:disabled) { background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--text); }
.tabs > button[aria-pressed="true"], .tabs > button[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* ---------- Forms ---------- */

form label, .form label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-2); margin-bottom: 12px; }
input:not([type="checkbox"]), select, textarea {
  display: block;
  width: 100%;
  min-height: var(--control-h);
  margin-top: 5px;
  padding: 0 10px;
  font: 400 0.875rem/1.4 var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
textarea { padding: 8px 10px; line-height: 1.5; resize: vertical; min-height: 72px; }
input:not([type="checkbox"]):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
input:not([type="checkbox"]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
input:focus-visible, button:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
input[type="radio"] { display: inline-block; width: 16px; min-height: 0; height: 16px; margin: 0; padding: 0; box-shadow: none; accent-color: var(--accent); vertical-align: middle; }
input[type="range"] { padding: 0; border: 0; box-shadow: none; background: none; accent-color: var(--accent); }
input[type="color"] { padding: 2px; width: 48px; }
input[type="file"] { padding: 6px; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
  cursor: pointer;
}
select[multiple] { background-image: none; padding: 6px; }
.inline-form input:not([type="checkbox"]), .inline-form select, .inline-form textarea,
.filters input:not([type="checkbox"]), .filters select { margin-top: 0; }
/* Compact selects in tables keep room for the arrow */
.import-map select, .price-table select, .plan-table select, .quote-items select, .tender-status-select { padding-right: 28px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }
.form-grid > label.check { align-self: end; min-height: var(--control-h); margin-bottom: 12px; }
label.check input { width: 16px; height: 16px; margin: 0; }
.error { color: var(--danger); font-size: 0.8125rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 14px 6px; }
legend { font-size: 0.8125rem; font-weight: 600; padding: 0 4px; }
details > summary { cursor: pointer; }

/* ---------- Layout pieces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.card.flush { padding: 0; overflow: hidden; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}
.page-head h1, .page-head h1 { font-size: 1.375rem; }
.page-head .muted { margin-top: 3px; font-size: 0.875rem; }
.page-head + .tabs { margin-top: -4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page > .muted { margin-bottom: 10px; font-size: 0.875rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.tile-label { font-size: 0.78125rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.tile strong { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .muted { font-size: 0.78125rem; }

.list li { padding: 10px 0; border-top-color: var(--border); }
.list li.clickable { border-radius: 6px; }
.list li.clickable:hover strong { color: var(--accent-text); }

.notice {
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.84375rem;
  margin: 10px 0;
}
.notice.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.notice.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); }
.notice.danger, .notice.backup-warn { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.preview, .rp-preview { background: var(--surface-2); border-color: var(--border); border-radius: var(--radius); }

/* Badges: stage pills, chips, scores */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0;
  background: var(--surface-3);
  color: var(--text-2);
  margin-right: 4px;
  white-space: nowrap;
}
.pill[data-stage]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill[data-stage="new"] { background: var(--surface-3); color: var(--muted); }
.pill[data-stage="contacted"] { background: var(--accent-soft); color: var(--accent-text); }
.pill[data-stage="interested"] { background: var(--warning-soft); color: var(--warning); }
.pill[data-stage="meeting"] { background: var(--teal-soft); color: var(--teal); }
.pill[data-stage="proposal"] { background: var(--violet-soft); color: var(--violet); }
.pill[data-stage="won"] { background: var(--success-soft); color: var(--success); }
.pill[data-stage="lost"] { background: var(--danger-soft); color: var(--danger); }
.track span[data-stage="meeting"] { background: var(--teal); }
.track span[data-stage="proposal"] { background: var(--violet); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  font-size: 0.75rem;
  font-weight: 550;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
a.chip:hover { text-decoration: none; border-color: var(--border-strong); }
.chip[data-kind="on"] { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chip[data-kind="off"] { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip[data-kind="warn"] { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.chip[data-kind="idle"] { color: var(--muted); background: var(--surface-3); border-color: transparent; }
.chip[data-kind]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.score { height: 22px; min-width: 30px; border-radius: 6px; font-size: 0.75rem; font-weight: 650; background: var(--surface-3); color: var(--muted); }
.score[data-level="high"] { background: var(--success-soft); color: var(--success); }
.score[data-level="mid"] { background: var(--warning-soft); color: var(--warning); }

.due { color: var(--muted); font-size: 0.8125rem; }
.due.overdue { color: var(--danger); font-weight: 600; }

/* Progress */
.bar, .track, .tm-bar, .rp-track, .tender-meter { background: var(--grid); }
.bar { height: 8px; }

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84375rem; }
.table thead th { position: sticky; top: 0; z-index: 1; }
.table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 550;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  background: var(--surface-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
/* Row headers (th scope="row") read like cells, not like the column header */
.table tbody th { position: static; z-index: auto; background: none; padding: 10px 12px; font-size: inherit; font-weight: 600; color: var(--text); white-space: normal; vertical-align: top; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable:hover { background: var(--accent-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.card > .table-wrap:first-child .table th:first-child, .card.flush .table th:first-child { padding-left: 16px; }
.card.flush .table td:first-child { padding-left: 16px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 16px; }
.table-wrap { overflow-x: auto; }

/* ---------- Modal ---------- */

.modal {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 22px 24px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.modal.medium { width: min(760px, calc(100vw - 24px)); }
.modal.wide { width: min(1080px, calc(100vw - 24px)); }
.modal[open] { animation: ui-pop 0.2s var(--ease); }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.modal[open]::backdrop { animation: ui-fade 0.2s ease; }
.modal-title { font: 650 1.125rem/1.3 var(--font); letter-spacing: -0.015em; color: var(--text); text-transform: none; margin: 0 0 14px; padding-right: 40px; }
.modal-head { padding-right: 40px; }
.modal-head .modal-title { color: var(--text); padding-right: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
@keyframes ui-pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes ui-fade { from { opacity: 0; } }
@keyframes ui-slide-up { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 640px) {
  .modal, .modal.wide, .modal.medium {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .modal[open] { animation: ui-sheet 0.25s var(--ease); }
  @keyframes ui-sheet { from { transform: translateY(30%); opacity: 0.6; } }
}

/* ---------- App shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.side-collapsed .shell { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }

.side {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  height: 100vh;
  height: 100dvh;
  padding: 14px 10px 10px;
  background: var(--side-bg);
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--text);
  overflow: hidden;
  flex-wrap: nowrap;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 10px 4px; }
.side-brand, .side .side-brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; color: var(--text); text-decoration: none; font: 650 1.0625rem/1.1 var(--font-brand); letter-spacing: -0.01em; }
.side-brand:hover { text-decoration: none; }
.side-brand img { width: 30px; height: 30px; flex: none; border-radius: 8px; }
.side-name, .side .side-name { display: grid; gap: 1px; line-height: 1.1; color: var(--text); white-space: nowrap; }
.side-name small, .side .side-name small { font: 600 0.625rem/1.2 var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-green-text); }

.side-search {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  margin: 0 0 10px;
  padding: 0 8px 0 10px;
  background: var(--surface);
  color: var(--faint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  font-weight: 400;
}
.side-search:hover:not(:disabled) { background: var(--surface); color: var(--muted); border-color: var(--border-strong); }
.side-search svg { width: 15px; height: 15px; }
.side-search span { flex: 1; text-align: left; }
.side-search kbd { font-size: 10.5px; }
@media (pointer: coarse) { .side-search kbd, .palette-foot { display: none; } }

.nav, .side .nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -4px;
  padding: 0 4px 8px;
  order: 0;
  flex-basis: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a, .side .nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--text-2);
  background: transparent;
  font-size: 0.84375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
  transition: background-color 0.12s, color 0.12s;
}
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--muted); transition: color 0.12s; }
.nav a:hover, .side .nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a:hover svg { color: var(--text-2); }
.nav a.active, .side .nav a.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; font-weight: 600; }
.nav a.active svg { color: var(--accent-text); }
.nav a .nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav a .nav-ext { width: 13px; height: 13px; opacity: 0.6; }
.nav-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.nav-badge[data-tone="hot"] { background: var(--danger); color: #fff; }
.nav-badge[data-tone="accent"] { background: var(--accent); color: #fff; }
.nav-label, .side .nav-label {
  display: block;
  padding: 14px 10px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  border: 0;
  white-space: nowrap;
}

.side-foot, .side .side-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.side-foot-row { display: flex; align-items: center; gap: 4px; }
.side-foot .chip, .side .chip { justify-content: flex-start; text-align: left; }
.side-collapse svg { transition: transform 0.2s var(--ease); }
.side-collapsed .side-collapse svg { transform: rotate(180deg); }

/* Collapsed rail (desktop) */
@media (min-width: 900px) {
  .side-collapsed .side { padding-left: 8px; padding-right: 8px; }
  .side-collapsed .side-name,
  .side-collapsed .nav-text,
  .side-collapsed .nav-badge,
  .side-collapsed .nav-ext,
  .side-collapsed .side-search span,
  .side-collapsed .side-search kbd,
  .side-collapsed .side-foot .chip-text,
  .side-collapsed .side-foot .btn-text { display: none; }
  .side-collapsed .side-top { flex-direction: column; padding: 0 0 10px; }
  .side-collapsed .nav-label { height: 1px; padding: 0; margin: 10px 8px; background: var(--border); font-size: 0; }
  .side-collapsed .nav a { justify-content: center; padding: 0; }
  .side-collapsed .side-search { justify-content: center; padding: 0; }
  .side-collapsed .side-foot-row { flex-direction: column; }
  .side-collapsed .nav a .nav-dot { position: absolute; top: 6px; right: 10px; }
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 0.84375rem; color: var(--muted); }
.crumbs strong { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar .menu-btn, .topbar .search-btn-mobile { display: none; }
.topbar .chip { margin-right: 4px; }

.content, .main .content { flex: 1; padding: 24px 28px 56px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; }
.page.wide { max-width: none; }
.page.narrow { max-width: 760px; }
.page:not([hidden]) { animation: ui-fade 0.18s ease; }

/* Mobile: drawer sidebar + bottom tab bar */
.scrim { position: fixed; inset: 0; z-index: 25; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.tabbar { display: none; }
@media (max-width: 899px) {
  .shell, .side-collapsed .shell { display: block; }
  .side, .side-collapsed .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100dvh;
    padding: max(14px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    transform: translateX(-102%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
  }
  .drawer-open .side { transform: none; }
  .drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .side-collapse { display: none !important; }
  .side .nav a { min-height: 40px; font-size: 0.9375rem; border-radius: 9px; background: transparent; padding: 0 10px; }
  .side .nav-label { display: block; }
  .topbar { padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar .menu-btn, .topbar .search-btn-mobile { display: inline-grid; }
  .topbar .crumbs .crumb-group, .topbar .crumbs .crumb-sep { display: none; }
  .topbar .chip .chip-text { display: none; }
  .content, .main .content { padding: 16px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 22;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tabbar a, .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
    color: var(--muted);
    font: 500 0.6875rem/1 var(--font);
    text-decoration: none;
    position: relative;
  }
  .tabbar a:hover, .tabbar button:hover:not(:disabled) { background: none; text-decoration: none; color: var(--text); }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--accent-text); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tabbar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); height: 16px; min-width: 16px; padding: 0 4px; font-size: 0.625rem; }
  .page-head h1 { font-size: 1.25rem; }
  .page-head { margin-bottom: 14px; }
  .card { padding: 14px; border-radius: 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile strong { font-size: 1.25rem; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs > button { flex: none; }
  table { display: table; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}

/* ---------- Auth screens ---------- */

#view-auth, #view-blocked { min-height: 100dvh; }
.auth, main.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 1fr);
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-art {
  position: relative;
  overflow: hidden;
  background: #0d2c4f url('/brand/products/wimbi-30-yellow.jpg') center / cover no-repeat;
}
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 24, 44, 0.05) 30%, rgba(8, 24, 44, 0.78)); }
.auth-art-text { position: absolute; z-index: 1; left: 40px; right: 40px; bottom: 36px; color: #fff; display: grid; gap: 6px; }
.auth-art-text strong { font: 600 1.6rem/1.2 var(--font-brand); letter-spacing: -0.01em; }
.auth-art-text span { opacity: 0.85; font-size: 0.9375rem; }
.auth-panel { display: grid; align-content: center; justify-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: min(380px, 100%); }
.auth .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; margin-bottom: 6px; }
.auth-logo { height: 46px; }
.auth .brand h1 { font: 650 1.5rem/1.2 var(--font); letter-spacing: -0.02em; color: var(--text); text-transform: none; }
.auth #auth-intro, .auth .auth-intro { margin: 4px 0 22px; color: var(--muted); }
.auth form.card, .auth .card { padding: 22px; border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }
.auth #auth-form button[type="submit"] { width: 100%; min-height: 40px; margin-top: 4px; }
.auth-foot { margin-top: 18px; font-size: 0.78125rem; color: var(--faint); text-align: center; }
@media (max-width: 860px) {
  .auth, main.auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 30vh; }
  .auth-art-text { left: 20px; right: 20px; bottom: 18px; }
  .auth-art-text strong { font-size: 1.2rem; }
  .auth-panel { align-content: start; padding: 24px 16px 32px; }
}

/* ---------- Toasts ---------- */

.toast { display: none; }
.toasts {
  position: fixed;
  inset: auto 20px 20px auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  pointer-events: none;
}
.toasts:popover-open { inset: auto 20px 20px auto; }
.toast-item {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 12px 12px 12px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.84375rem;
  position: relative;
  overflow: hidden;
  animation: ui-toast-in 0.28s var(--ease);
}
.toast-item.leaving { animation: ui-toast-out 0.2s ease forwards; }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes ui-toast-out { to { opacity: 0; transform: translateX(16px); } }
.toast-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; background: var(--success); margin-top: -1px; }
.toast-icon svg { width: 13px; height: 13px; stroke-width: 3; }
.toast-item[data-kind="error"] .toast-icon { background: var(--danger); }
.toast-item[data-kind="warn"] .toast-icon { background: var(--warning); }
.toast-item[data-kind="info"] .toast-icon { background: var(--accent); }
.toast-text { line-height: 1.45; padding-top: 1px; overflow-wrap: anywhere; }
.toast-action { margin-top: 6px; }
.toast-close { width: 24px; min-width: 24px; height: 24px; min-height: 24px; margin: -3px -3px 0 0; }
.toast-close svg { width: 14px; height: 14px; }
.toast-progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: 0.15; transform-origin: left; animation: ui-toast-timer linear forwards; }
.toast-item:hover .toast-progress { animation-play-state: paused; }
@keyframes ui-toast-timer { to { transform: scaleX(0); } }
@media (max-width: 899px) {
  .toasts, .toasts:popover-open { inset: auto 12px calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)) 12px; width: auto; align-items: stretch; }
}

/* ---------- Dialogs (confirm / alert / prompt) ---------- */

.swal {
  width: min(420px, calc(100vw - 32px));
  padding: 28px 24px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.swal[open] { animation: ui-swal 0.3s var(--ease); }
.swal::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
.swal[open]::backdrop { animation: ui-fade 0.2s ease; }
@keyframes ui-swal { 0% { opacity: 0; transform: scale(0.9); } 60% { transform: scale(1.015); } }
.swal-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}
.swal-icon::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: 0.18; animation: ui-ring 0.6s var(--ease); }
@keyframes ui-ring { from { transform: scale(0.6); opacity: 0; } }
.swal-icon svg { width: 28px; height: 28px; stroke-width: 2.2; }
.swal-icon[data-icon="warning"] { color: var(--warning); background: var(--warning-soft); }
.swal-icon[data-icon="danger"], .swal-icon[data-icon="error"] { color: var(--danger); background: var(--danger-soft); }
.swal-icon[data-icon="success"] { color: var(--success); background: var(--success-soft); }
.swal-icon[data-icon="success"] svg path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: ui-draw 0.45s 0.15s var(--ease) forwards; }
@keyframes ui-draw { to { stroke-dashoffset: 0; } }
.swal-title { font: 650 1.125rem/1.35 var(--font); letter-spacing: -0.015em; margin: 0 0 6px; color: var(--text); }
.swal-text { color: var(--muted); font-size: 0.875rem; line-height: 1.55; white-space: pre-line; margin: 0; }
.swal-field { margin: 14px 0 0; text-align: left; }
.swal-field label { margin: 0; }
.swal-error { color: var(--danger); font-size: 0.8125rem; margin-top: 6px; text-align: left; }
.swal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.swal-actions button { flex: 1; min-height: 38px; }
@media (prefers-reduced-motion: reduce) {
  .swal[open], .swal-icon::before, .swal-icon[data-icon="success"] svg path, .modal[open], .toast-item, .page:not([hidden]) { animation: none; }
  .swal-icon[data-icon="success"] svg path { stroke-dashoffset: 0; }
}

/* ---------- Command palette ---------- */

.palette {
  width: min(640px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 120px));
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; animation: ui-pop 0.16s var(--ease); }
.palette::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.palette-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-search input, .palette-search input:focus {
  margin: 0;
  min-height: 52px;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  font-size: 1rem;
}
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.palette-group { padding: 10px 10px 4px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.palette-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.palette-item svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.palette-item .pi-text { display: grid; min-width: 0; flex: 1; }
.palette-item .pi-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-text span { font-size: 0.78125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-hint { font-size: 0.75rem; color: var(--faint); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); }
.palette-item[aria-selected="true"] svg, .palette-item[aria-selected="true"] .pi-text strong { color: var(--accent-text); }
.palette-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 0.75rem; color: var(--muted); }
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 640px) { .palette { margin-top: 8px; max-height: calc(100dvh - 16px); } .palette-foot { display: none; } }

/* ---------- Shared page patterns (for /theme/<area>.css and feature scripts) ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}
.empty > svg { width: 36px; height: 36px; color: var(--faint); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head .pill, .card-head .tabs { margin: 0; }
.empty strong { color: var(--text); font-weight: 600; font-size: 0.9375rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.section-title h2 { margin: 0; }
.kpi-delta { font-size: 0.75rem; font-weight: 600; }
.kpi-delta[data-dir="up"] { color: var(--success); }
.kpi-delta[data-dir="down"] { color: var(--danger); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: ui-shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes ui-shimmer { to { background-position: -200% 0; } }

/* Loading splash */
.splash { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.splash img { border-radius: 12px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); animation: ui-spin 0.8s linear infinite; }
@keyframes ui-spin { to { transform: rotate(360deg); } }

/* ---------- PC status page ---------- */

.state { display: flex; align-items: center; gap: 14px; }
.state strong { font-size: 1.0625rem; }
.dot { width: 12px; height: 12px; }
.big { font-size: 2rem; font-weight: 650; letter-spacing: -0.02em; }
.stats dt { color: var(--muted); }
.stats dd { font-weight: 600; }
.top { margin-bottom: 20px; }
.events li { border-top-color: var(--border); font-size: 0.875rem; }

/* Leaflet maps follow the app font and theme */
.leaflet-container { font-family: var(--font); }
.leaflet-bar a, .leaflet-bar a:hover { background-color: var(--surface); color: var(--text); border-bottom-color: var(--border); }
.leaflet-bar a:hover { background-color: var(--surface-3); }
.leaflet-touch .leaflet-bar, .leaflet-bar { border-color: var(--border); box-shadow: var(--shadow-sm); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--accent-text); }

/* Email tests and previews (w.email.testBar / previewFrame): composer, templates, campaigns, team */
.test-bar { flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; }
.test-bar > span { display: inline-flex; align-items: center; gap: 4px; }
.test-bar input { flex: 1 1 200px; min-width: 0; }
.composer-test { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 8px; }
.composer-test .test-bar, .camp-preview-actions .test-bar { flex: 1 1 320px; }
.mail-preview { margin: 4px 0 8px; }
.mail-preview .camp-size { margin-bottom: 8px; }
.mail-preview .camp-frame-wrap { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius); }
.mail-preview .camp-frame { height: min(62vh, 760px); }
@media (max-width: 560px) {
  .test-bar { flex-wrap: wrap; }
}

@media print {
  .side, .topbar, .tabbar, .scrim, .toasts { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
}
