/* ═══════════════════════════════════════════════════════════
   InterVentis — portal (admin, client, sign-in)
   The operations console: an ink sidebar, a paper desk, white
   working surfaces. Newsreader for page titles and figures,
   IBM Plex Sans for the work, Plex Mono for references, dates
   and labels. The bracket [ ] marks the active place.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0B1219;
  --ink-2: #111B26;
  --ink-3: #17222F;
  --navy: #172433;
  --paper: #F3F0E9;
  --paper-2: #EAE5DA;
  --sheet: #FFFEFB;
  --brass: #A8873F;
  --brass-ink: #7A6127;
  --brass-hi: #CDAE6A;
  --brass-wash: rgba(168, 135, 63, 0.1);
  --brass-faint: rgba(168, 135, 63, 0.055);
  --signal: #C8432A;

  --text: #161C23;
  --text-mid: #434B55;
  --text-light: #646A71;
  --border: #DDD6C8;
  --border-soft: #EAE5DB;
  --on-dark: #EDE8DE;
  --on-dark-2: rgba(237, 232, 222, 0.66);
  --on-dark-3: rgba(237, 232, 222, 0.42);
  --rule-dark: rgba(237, 232, 222, 0.09);

  --success: #2F6B3E; --success-bg: #E5EFE4; --success-line: #BFD6BF;
  --warning: #8A5A12; --warning-bg: #F7ECD5; --warning-line: #E7CF9E;
  --danger: #A8321D;  --danger-bg: #F8E4DD;  --danger-line: #EDBFB2;
  --info: #2A4E78;    --info-bg: #E2EAF3;

  /* legacy aliases used by older views */
  --gold: var(--brass); --gold-light: var(--brass-hi); --gold-dim: var(--brass-wash); --gold-faint: var(--brass-faint);
  --off-white: var(--paper); --warm-gray: var(--paper-2); --white: var(--sheet);

  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 6px;
  --shadow: 0 1px 0 rgba(22, 28, 35, 0.04), 0 1px 3px rgba(22, 28, 35, 0.05);
  --shadow-md: 0 2px 4px rgba(22, 28, 35, 0.04), 0 8px 20px rgba(22, 28, 35, 0.07);
  --shadow-lg: 0 18px 50px -12px rgba(11, 18, 25, 0.28);
  --sidebar-w: 264px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-size: 14.5px; line-height: 1.55;
  color: var(--text); background: var(--paper);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; color: var(--text); letter-spacing: -0.01em; }
a { color: var(--brass-ink); text-decoration: none; }
a:hover { color: var(--text); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }
code { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--brass-hi); color: var(--ink); }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ── Utilities ─────────────────────────────────────── */
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.75rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-light { color: var(--text-light); }
.text-sm { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.label {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-light);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--sheet); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-bottom: 1.15rem; padding-bottom: 0.95rem; border-bottom: 1px solid var(--border-soft);
}
.card-header h3, .card > h3 { margin: 0; font-size: 1.28rem; line-height: 1.2; }
.card > h3 { margin-bottom: 1rem; }
.card-header h3 + .text-sm, .card-header > .text-sm { font-family: var(--mono); font-size: 0.72rem; }
.card-title { font-size: 1.15rem; margin-bottom: 1rem; }
.card > .table-wrap { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-header, .card[style*="padding:0"] > .card-header { margin: 0; padding: 1rem 1.25rem; }
.card-kicker { display: block; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-light); margin-bottom: 0.3rem; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 38px; padding: 0 1rem; border-radius: 4px; font-size: 0.84rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--sheet); color: var(--text);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  text-decoration: none; font-family: var(--sans); line-height: 1.2; white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { border-color: var(--text-light); color: var(--text); background: #fff; }
.btn-primary { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-3); border-color: var(--ink-3); color: #fff; }
.btn-brass { background: var(--brass-hi); border-color: var(--brass-hi); color: var(--ink); }
.btn-brass:hover { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--brass-ink); border-color: var(--brass); }
.btn-ghost:hover { background: var(--brass-wash); color: var(--brass-ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-mid); }
.btn-quiet:hover { background: var(--paper-2); border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #8E2814; border-color: #8E2814; color: #fff; }
.btn-danger-quiet { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn-danger-quiet:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 0.75rem; font-size: 0.78rem; }
.btn-lg { min-height: 48px; padding: 0 1.6rem; font-size: 0.92rem; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; min-height: 34px; padding: 0; }

/* ── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.15rem; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 1rem; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--text); margin-bottom: 0.4rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%; min-height: 40px; padding: 0.55rem 0.8rem; border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.9rem; font-family: var(--sans);
  background: #fff; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: #C9C0AE; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(168, 135, 63, 0.16);
}
.form-input:disabled { background: var(--paper); color: var(--text-light); }
.form-input[type="file"] { padding: 0.45rem 0.6rem; font-size: 0.82rem; }
.form-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%237A6127' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.2rem; cursor: pointer;
}
.form-select:disabled { cursor: not-allowed; opacity: 0.6; }
.form-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: 0.76rem; color: var(--text-light); margin-top: 0.35rem; }
.check-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.8rem 0.9rem; margin-bottom: 0.5rem; cursor: pointer;
  border: 1px solid var(--border-soft); border-radius: 4px; background: #fff;
  transition: border-color 0.15s, background 0.15s; font-size: 0.88rem;
}
.check-row:hover { border-color: var(--brass); background: var(--brass-faint); }
.check-row input[type="checkbox"] { margin-top: 0.2rem; accent-color: var(--ink); width: 15px; height: 15px; }
.check-row strong { display: block; color: var(--text); font-weight: 600; }
.check-hint { display: block; font-size: 0.78rem; color: var(--text-light); margin-top: 0.15rem; }
input[type="checkbox"] { accent-color: var(--ink); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.7rem; cursor: pointer; font-size: 0.86rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 22px; background: #CFC7B7; transition: background 0.2s; flex-shrink: 0; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.2s var(--ease); }
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.16rem 0.45rem;
  border-radius: 3px; font-family: var(--mono); font-size: 0.64rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.5; vertical-align: middle; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-primary, .badge-new, .badge-client { background: var(--brass-wash); color: var(--brass-ink); border-color: rgba(168, 135, 63, 0.25); }
.badge-success, .badge-responded, .badge-active { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge-warning, .badge-urgent { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge-danger, .badge-crisis, .badge-inactive { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-muted, .badge-read, .badge-archived, .badge-general { background: var(--paper); color: var(--text-light); border-color: var(--border-soft); }
.badge-admin { background: var(--ink); color: var(--brass-hi); }
.badge-in { background: var(--info-bg); color: var(--info); }
.badge-out { background: var(--warning-bg); color: var(--warning); }
.badge-plain::before { content: none; }

/* ── Tables ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.table th {
  text-align: left; padding: 0.65rem 1.25rem; font-family: var(--mono); font-size: 0.64rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-light);
  border-bottom: 1px solid var(--border); font-weight: 500; background: #FAF8F3; white-space: nowrap;
}
.table td { padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover td { background: var(--brass-faint); }
.table a { color: var(--text); font-weight: 500; }
.table a:hover { color: var(--brass-ink); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Stat cards — serif ledger numerals ────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  position: relative; display: flex; flex-direction: column; gap: 0.35rem;
  background: var(--sheet); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.1rem; box-shadow: var(--shadow); color: inherit; text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
a.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #CDBF9F; color: inherit; }
.stat-card-label {
  order: -1; font-family: var(--mono); font-size: 0.64rem; color: var(--text-light);
  letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500;
}
.stat-card-value {
  font-family: var(--serif); font-size: 2.5rem; color: var(--text); font-weight: 300;
  line-height: 1; letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums;
}
.stat-card-sub { font-size: 0.78rem; color: var(--text-light); }
.stat-card-accent::after { content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: var(--radius) 0 0 var(--radius); background: var(--brass); }
.stat-card .stat-attn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); margin-left: 0.5rem; vertical-align: 0.9rem; }
.stat-card-alert::after { background: var(--signal); }
a.stat-card .stat-go { position: absolute; right: 1rem; top: 1rem; color: var(--text-light); opacity: 0; transition: opacity 0.2s, transform 0.2s; }
a.stat-card:hover .stat-go { opacity: 1; transform: translateX(2px); }

/* ── Alerts ────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.8rem 1rem; border-radius: 4px; font-size: 0.87rem;
  margin-bottom: 1.25rem; border: 1px solid; border-left-width: 3px; transition: opacity 0.3s;
}
.alert-success { background: var(--success-bg); color: #1F4A2A; border-color: var(--success-line); border-left-color: var(--success); }
.alert-error { background: var(--danger-bg); color: #6E1F10; border-color: var(--danger-line); border-left-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #5E3D0A; border-color: var(--warning-line); border-left-color: var(--warning); }
.alert-info { background: var(--info-bg); color: #1C3757; border-color: #C3D2E4; border-left-color: var(--info); }

/* ── Portal shell ──────────────────────────────────── */
.portal { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--ink); color: var(--on-dark);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
  border-right: 1px solid var(--rule-dark);
}
.sidebar::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background: radial-gradient(120% 40% at 0% 0%, rgba(205, 174, 106, 0.07), transparent 60%);
}
.sidebar > * { position: relative; }
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 1.35rem 1.25rem 1.2rem 1.4rem; border-bottom: 1px solid var(--rule-dark);
}
.sidebar-brand img { height: 19px; width: auto; }
.sidebar-env,
.sidebar-brand .bracket-tag,
.sidebar-brand-sub {
  font-family: var(--mono); font-size: 0.58rem; color: var(--brass-hi); letter-spacing: 0.14em;
  text-transform: uppercase; border: 1px solid rgba(205, 174, 106, 0.32); padding: 0.18rem 0.4rem; border-radius: 3px; white-space: nowrap;
}
.sidebar-close { display: none; color: var(--on-dark-2); background: none; border: 0; cursor: pointer; padding: 0.25rem; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem 1.25rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(237,232,222,0.15) transparent; }
.sidebar-nav .nav-group { margin-bottom: 1.35rem; }
.sidebar-nav .nav-group-label {
  padding: 0 0.75rem; font-family: var(--mono); font-size: 0.58rem; text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--on-dark-3); margin-bottom: 0.4rem; font-weight: 500;
}
.nav-divider { height: 1px; background: var(--rule-dark); margin: 1rem 0.75rem; }
.sidebar-nav .nav-link,
.sidebar-nav > a {
  position: relative; display: flex; align-items: center; gap: 0.7rem;
  min-height: 36px; padding: 0 0.75rem; border-radius: 4px; color: var(--on-dark-2);
  font-size: 0.86rem; transition: color 0.15s, background 0.15s; text-decoration: none;
}
.sidebar-nav .nav-link .icon { width: 17px; height: 17px; opacity: 0.75; }
.sidebar-nav .nav-link:hover, .sidebar-nav > a:hover { color: var(--on-dark); background: rgba(237, 232, 222, 0.05); }
.sidebar-nav .nav-link.active, .sidebar-nav > a.active { color: #fff; background: rgba(205, 174, 106, 0.1); }
.sidebar-nav .nav-link.active .icon { opacity: 1; color: var(--brass-hi); }
.sidebar-nav .nav-link.active::before, .sidebar-nav > a.active::before {
  content: ''; position: absolute; left: -0.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--brass-hi);
}
.sidebar-nav .nav-link .badge, .sidebar-nav > a .badge {
  margin-left: auto; font-size: 0.6rem; padding: 0.05rem 0.4rem; min-width: 1.4rem; justify-content: center;
  background: rgba(205, 174, 106, 0.16); color: var(--brass-hi); border: 0; letter-spacing: 0.02em;
}
.sidebar-nav .nav-link .badge::before { content: none; }
.sidebar-nav .nav-link .badge-alert { background: var(--signal); color: #fff; }
.sidebar-nav .nav-link .ext { margin-left: auto; width: 14px; height: 14px; opacity: 0.45; }

.sidebar-footer {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.9rem 0.9rem 0.9rem 1.1rem;
  border-top: 1px solid var(--rule-dark); font-size: 0.75rem;
}
.sidebar-footer .avatar, .sidebar-footer img.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  background: var(--navy); border: 1px solid rgba(205, 174, 106, 0.35);
  color: var(--brass-hi); font-family: var(--serif); font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-footer .who { min-width: 0; flex: 1; }
.sidebar-footer .user-name { color: var(--on-dark); font-weight: 500; font-size: 0.83rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-info { color: var(--on-dark-3); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .signout { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 4px; color: var(--on-dark-3); }
.sidebar-footer .signout:hover { color: var(--on-dark); background: rgba(237, 232, 222, 0.06); }
.sidebar-scrim { display: none; }

.portal-content {
  flex: 1; min-width: 0; margin-left: var(--sidebar-w);
  min-height: 100vh; background: var(--paper); display: flex; flex-direction: column;
}

.portal-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.95rem 2.25rem; min-height: 76px;
  background: rgba(243, 240, 233, 0.9);
  -webkit-backdrop-filter: saturate(140%) blur(10px); backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.sidebar-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 4px; border: 1px solid var(--border); background: var(--sheet); color: var(--text); cursor: pointer; flex-shrink: 0; }
.portal-heading { min-width: 0; }
.portal-crumb { display: flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-light); margin-bottom: 0.15rem; }
.portal-crumb .sep { opacity: 0.5; }
.portal-header h1 { font-size: 1.65rem; font-weight: 400; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-header h1::before { content: '[ '; color: var(--brass); font-weight: 300; }
.portal-header h1::after { content: ' ]'; color: var(--brass); font-weight: 300; }
.portal-header-meta { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.portal-clock { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.72rem; color: var(--text-light); font-variant-numeric: tabular-nums; padding: 0 0.6rem; white-space: nowrap; }
.portal-clock .icon { width: 14px; height: 14px; }
.portal-clock b { color: var(--text); font-weight: 500; }
.portal-header-date { font-family: var(--mono); font-size: 0.68rem; color: var(--text-light); letter-spacing: 0.08em; text-transform: uppercase; }
.portal-header-user { font-family: var(--serif); font-size: 0.95rem; }

.crisis-bar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 2.25rem;
  background: var(--signal); color: #fff; font-size: 0.86rem;
}
.crisis-bar .icon { width: 17px; height: 17px; }
.crisis-bar a { margin-left: auto; color: #fff; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.5); white-space: nowrap; }
.crisis-bar a:hover { color: #fff; border-color: #fff; }

.portal-body { width: 100%; max-width: 1480px; padding: 1.75rem 2.25rem 3.5rem; }
.portal-content > .alert { margin: 1.5rem 2.25rem 0; }

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.9rem; font-weight: 400; line-height: 1.15; }
.page-header p { font-size: 0.88rem; color: var(--text-light); margin-top: 0.3rem; }
.page-header .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-light); }
.back-link:hover { color: var(--text); }

/* ── Auth ──────────────────────────────────────────── */
.auth-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-panel {
  position: relative; overflow: hidden; background: var(--ink); color: var(--on-dark);
  display: flex; flex-direction: column; justify-content: space-between; padding: 2.5rem 3rem; isolation: isolate;
}
.auth-panel::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(70% 60% at 85% 30%, rgba(205, 174, 106, 0.1), transparent 70%);
}
.auth-lines { position: absolute; inset: 0; z-index: -1; display: grid; grid-template-columns: repeat(6, 1fr); padding: 0 3rem; pointer-events: none; }
.auth-lines span { border-left: 1px solid rgba(237, 232, 222, 0.045); }
.auth-panel-top img { height: 22px; width: auto; }
.auth-panel-inner { position: relative; max-width: 30rem; }
.auth-panel-tagline { font-family: var(--serif); font-weight: 300; font-size: clamp(3rem, 6vw, 5.5rem); line-height: 0.9; letter-spacing: -0.04em; color: var(--on-dark); margin-bottom: 2rem; }
.auth-panel-tagline em { color: var(--brass-hi); }
.auth-panel-quote p { font-family: var(--serif); font-style: italic; font-weight: 300; font-size: 1.15rem; line-height: 1.5; color: var(--on-dark-2); max-width: 24rem; }
.auth-panel-foot { display: flex; align-items: center; gap: 0.7rem; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-dark-3); }
.auth-panel-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); }
.auth-form-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--paper); }
.auth-form-wrapper { width: 100%; max-width: 400px; }
.auth-form-wrapper h2 { font-size: 2.4rem; font-weight: 300; letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 0.5rem; }
.auth-form-wrapper h2 em { color: var(--brass-ink); }
.auth-form-wrapper .subtitle { color: var(--text-light); font-size: 0.92rem; margin-bottom: 2rem; }
.auth-form-wrapper .form-input { min-height: 46px; background: var(--sheet); }
.auth-form-card h2 { margin-bottom: 0.25rem; }
.auth-alt { text-align: center; margin-top: 1.5rem; color: var(--text-light); font-size: 0.88rem; }
.auth-alt a { font-weight: 500; }
.auth-note { font-size: 0.88rem; color: var(--text-mid); margin-top: 1rem; }
.auth-back { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); text-align: center; }
.auth-back a { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-light); }
.auth-back a:hover { color: var(--text); }

/* ── List / message items ──────────────────────────── */
.message-item {
  display: block; padding: 0.95rem 1.25rem; border-bottom: 1px solid var(--border-soft);
  border-left: 3px solid transparent; text-decoration: none; color: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.message-item:last-child { border-bottom: none; }
.message-item:hover { background: var(--brass-faint); color: inherit; }
.message-item.unread { border-left-color: var(--brass); background: rgba(168, 135, 63, 0.04); }
.message-item-header, .message-meta { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.3rem; flex-wrap: wrap; }
.message-item-subject, .message-subject { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.message-item-preview, .message-preview { font-size: 0.84rem; color: var(--text-light); line-height: 1.5; }
.message-item-date, .message-date { font-family: var(--mono); font-size: 0.68rem; color: var(--text-light); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }

.thread-bubble, .message-bubble { padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 0.9rem; max-width: 80%; line-height: 1.65; font-size: 0.9rem; }
.thread-bubble.outgoing, .message-bubble.outgoing { background: var(--ink); color: var(--on-dark); margin-left: auto; border-bottom-right-radius: 2px; }
.thread-bubble.outgoing .thread-bubble-meta, .message-bubble.outgoing .message-bubble-meta { color: var(--on-dark-3); }
.thread-bubble.incoming, .message-bubble.incoming { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.thread-bubble-meta, .message-bubble-meta { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--text-light); margin-top: 0.5rem; }

/* ── Empty state — anchored by the house brackets ──── */
.empty-state { text-align: center; padding: 3rem 2rem; color: var(--text-light); }
.empty-state::before { content: '[ ]'; display: block; font-family: var(--serif); font-size: 2.2rem; font-weight: 300; color: var(--brass); opacity: 0.55; margin-bottom: 0.6rem; letter-spacing: 0.15em; }
.empty-state-icon { display: none; }
.empty-state p { font-size: 0.88rem; max-width: 380px; margin: 0 auto; }

/* ── Search & filters ──────────────────────────────── */
.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.search-bar .form-input { flex: 1; max-width: 360px; }
.filter-tabs { display: flex; gap: 0.35rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-tab {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 32px; padding: 0 0.8rem;
  border-radius: 4px; font-size: 0.8rem; border: 1px solid var(--border); background: var(--sheet);
  color: var(--text-mid); text-decoration: none; transition: all 0.15s;
}
.filter-tab:hover { border-color: var(--text-light); color: var(--text); }
.filter-tab.active { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.filter-tab.active .filter-count { color: var(--brass-hi); }
.filter-count { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; color: var(--text-light); font-variant-numeric: tabular-nums; }

/* ── Cases ─────────────────────────────────────────── */
.case-ref { font-family: var(--mono); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
a.case-ref:hover { color: var(--brass-ink); }
.case-ref-line { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.case-ref-line .case-ref { font-size: 0.8rem; color: var(--brass-ink); }
.case-head { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-start; border-top: 3px solid var(--ink); flex-wrap: wrap; }
.case-title { font-size: 1.8rem; font-weight: 400; line-height: 1.15; margin-bottom: 0.45rem; letter-spacing: -0.015em; }
.case-head-meta { text-align: right; font-size: 0.85rem; flex-shrink: 0; display: grid; gap: 0.35rem; align-content: start; }
.meta-label { display: inline-block; font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-light); margin-right: 0.5rem; font-weight: 500; }
.case-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }

/* ── Timeline ──────────────────────────────────────── */
.timeline-entry { position: relative; display: flex; gap: 1rem; padding-bottom: 1.35rem; }
.timeline-entry::before { content: ''; position: absolute; left: 5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline-entry:last-child { padding-bottom: 0; }
.timeline-entry:last-child::before { display: none; }
.timeline-marker { flex-shrink: 0; width: 11px; height: 11px; transform: rotate(45deg); border: 1.5px solid var(--brass); background: var(--sheet); margin-top: 5px; position: relative; z-index: 1; }
.kind-milestone .timeline-marker { background: var(--brass); }
.kind-status .timeline-marker { border-color: #BDB4A2; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.timeline-date { font-family: var(--mono); font-size: 0.68rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.timeline-text { font-size: 0.9rem; line-height: 1.65; }
.kind-status .timeline-text { color: var(--text-light); font-size: 0.85rem; }

/* ── Documents ─────────────────────────────────────── */
.doc-list { display: grid; gap: 0.45rem; }
.doc-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.85rem; border: 1px solid var(--border-soft); border-radius: 4px; background: #FAF8F3; }
.doc-icon { font-family: var(--serif); color: var(--brass); font-size: 1rem; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 0.87rem; font-weight: 500; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-name:hover { color: var(--brass-ink); }
.doc-meta { font-family: var(--mono); font-size: 0.66rem; color: var(--text-light); }

/* ── Messages inbox ────────────────────────────────── */
.msg-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.message-item.selected { background: var(--brass-wash); border-left-color: var(--ink); }
.msg-thread-scroll { max-height: 55vh; overflow-y: auto; padding: 0.25rem 0 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border-soft); }

.event-code { font-family: var(--mono); font-size: 0.72rem; background: var(--paper); border: 1px solid var(--border-soft); padding: 0.08rem 0.4rem; border-radius: 3px; color: var(--text); }

/* ── Developer console ─────────────────────────────── */
.dev-actions { display: grid; gap: 0.75rem; }
.dev-actions form { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.dev-actions form .btn { min-width: 190px; justify-content: flex-start; }
.dev-actions form span { flex: 1; min-width: 200px; }

/* ── Analytics ─────────────────────────────────────── */
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 0.5rem; border-bottom: 1px solid var(--border); }
.chart-col { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; cursor: default; }
.chart-bar { width: 100%; background: var(--ink); border-radius: 2px 2px 0 0; min-height: 2px; transition: background 0.15s; }
.chart-col:hover .chart-bar { background: var(--brass); }
.chart-col::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--on-dark); font-family: var(--mono); font-size: 0.66rem; padding: 0.3rem 0.55rem;
  border-radius: 3px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 5;
}
.chart-col:hover::after { opacity: 1; }
.chart-x { display: flex; justify-content: space-between; margin-top: 0.5rem; font-family: var(--mono); font-size: 0.66rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.inline-bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; min-width: 60px; flex: 1; }
.inline-bar span { display: block; height: 100%; background: var(--brass); border-radius: 3px; }
.split-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.4rem 0; }
.split-row > .text-sm:first-child { width: 4.5rem; flex-shrink: 0; }
.split-divider { height: 1px; background: var(--border-soft); margin: 1rem 0; }

.seo-item { display: flex; align-items: center; gap: 0.9rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border-soft); font-size: 0.87rem; }
.seo-item:last-child { border-bottom: none; }
.seo-mark { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; }
.seo-mark.pass { background: var(--success-bg); color: var(--success); }
.seo-mark.fail { background: var(--danger-bg); color: var(--danger); }
.seo-label { font-weight: 500; color: var(--text); }
.seo-detail { font-size: 0.75rem; color: var(--text-light); }

/* ── Dashboard ─────────────────────────────────────── */
.dash-greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dash-greeting h2 { font-size: 2.1rem; font-weight: 300; letter-spacing: -0.025em; line-height: 1.05; }
.dash-greeting h2 em { color: var(--brass-ink); }
.dash-greeting p { color: var(--text-light); margin-top: 0.35rem; font-size: 0.9rem; }
.dash-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.dash-col { display: grid; gap: 1.25rem; min-width: 0; }
.status-stack { display: flex; height: 10px; border-radius: 2px; overflow: hidden; background: var(--paper-2); margin: 0.25rem 0 1rem; }
.status-stack span { display: block; height: 100%; }
.status-legend { display: grid; gap: 0.45rem; }
.status-legend a { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-size: 0.86rem; padding: 0.25rem 0; }
.status-legend a:hover { color: var(--brass-ink); }
.status-legend i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.status-legend b { margin-left: auto; font-family: var(--mono); font-weight: 500; font-size: 0.78rem; }
.quick-links { display: grid; gap: 0.4rem; }
.quick-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border-soft); border-radius: 4px; color: var(--text); background: #FAF8F3; transition: border-color 0.15s, background 0.15s; }
.quick-link:hover { border-color: var(--brass); background: #fff; color: var(--text); }
.quick-link .icon { color: var(--brass-ink); }
.quick-link span { flex: 1; font-size: 0.87rem; font-weight: 500; }
.quick-link small { display: block; font-weight: 400; font-size: 0.76rem; color: var(--text-light); }
.quick-link .go { width: 15px; height: 15px; color: var(--text-light); }

/* ── Site content editor ───────────────────────────── */
.content-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  background: var(--ink); color: var(--on-dark); border-radius: var(--radius); padding: 1.6rem 1.75rem; margin-bottom: 1.5rem;
}
.content-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 120% at 100% 0%, rgba(205, 174, 106, 0.14), transparent 60%); pointer-events: none; }
.content-hero > * { position: relative; }
.content-hero h2 { color: var(--on-dark); font-size: 1.7rem; font-weight: 300; line-height: 1.15; }
.content-hero h2 em { color: var(--brass-hi); }
.content-hero p { color: var(--on-dark-2); font-size: 0.9rem; margin-top: 0.35rem; max-width: 40rem; }
.content-hero .btn-line { background: transparent; color: var(--on-dark); border-color: rgba(237, 232, 222, 0.25); }
.content-hero .btn-line:hover { border-color: var(--brass-hi); color: var(--brass-hi); background: transparent; }
.content-group { margin-bottom: 1.75rem; }
.content-group-head { display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 0.65rem; }
.content-group-head h3 { font-size: 1.35rem; }
.content-group-head .label { margin-left: auto; }
.section-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.75rem; }
.section-tile {
  position: relative; display: flex; flex-direction: column; gap: 0.35rem; min-height: 142px;
  padding: 1rem 1.1rem 0.9rem; background: var(--sheet); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); box-shadow: var(--shadow); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.section-tile:hover { border-color: #CDBF9F; box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--text); }
.section-tile-top { display: flex; align-items: center; gap: 0.5rem; }
.section-tile h4 { font-size: 1.15rem; font-weight: 400; line-height: 1.2; }
.section-tile p { font-size: 0.8rem; color: var(--text-light); line-height: 1.45; flex: 1; }
.section-tile-foot { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.6rem; border-top: 1px solid var(--border-soft); font-family: var(--mono); font-size: 0.64rem; color: var(--text-light); letter-spacing: 0.04em; }
.section-tile-foot .go { margin-left: auto; width: 15px; height: 15px; color: var(--brass-ink); transition: transform 0.15s; }
.section-tile:hover .go { transform: translateX(3px); }
.meter { display: inline-flex; gap: 2px; }
.meter i { width: 4px; height: 10px; border-radius: 1px; background: var(--paper-2); }
.meter i.on { background: var(--brass); }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.editor-side { position: sticky; top: 96px; display: grid; gap: 1rem; }
.editor-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.editor-intro p { color: var(--text-mid); max-width: 44rem; }
.markup-hint { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-size: 0.78rem; color: var(--text-light); padding: 0.7rem 0.9rem; background: #FAF8F3; border: 1px dashed var(--border); border-radius: 4px; margin-bottom: 1.25rem; }
.markup-hint code { font-size: 0.72rem; color: var(--text); background: #fff; border: 1px solid var(--border-soft); padding: 0 0.3rem; border-radius: 3px; }
.field-card { padding: 1.15rem 1.25rem 1.2rem; }
.field-card + .field-card { margin-top: 0.75rem; }
.field-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.field-head .form-label { margin: 0; font-size: 0.86rem; }
.field-head .field-key { font-family: var(--mono); font-size: 0.62rem; color: var(--text-light); letter-spacing: 0.02em; }
.field-head .field-tools { margin-left: auto; display: flex; gap: 0.35rem; align-items: center; }
.field-reset { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-light); background: none; border: 0; cursor: pointer; padding: 0.2rem 0.3rem; display: inline-flex; align-items: center; gap: 0.3rem; }
.field-reset:hover { color: var(--brass-ink); }
.field-reset .icon { width: 13px; height: 13px; }
.field-card .form-textarea { min-height: 84px; }
.field-count { font-family: var(--mono); font-size: 0.66rem; color: var(--text-light); text-align: right; margin-top: 0.3rem; }
.field-count.over { color: var(--danger); }
.field-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.repeater { display: grid; gap: 0.6rem; margin-top: 0.4rem; }
.rep-item { border: 1px solid var(--border); border-radius: 4px; background: #FCFBF8; }
.rep-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.5rem 0.5rem 0.85rem; border-bottom: 1px solid var(--border-soft); }
.rep-num { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass-ink); white-space: nowrap; }
.rep-preview { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-actions { display: flex; gap: 0.2rem; }
.rep-actions button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 4px; border: 1px solid transparent; background: none; color: var(--text-light); cursor: pointer; }
.rep-actions button:hover { background: #fff; border-color: var(--border); color: var(--text); }
.rep-actions button.rep-remove:hover { color: var(--danger); border-color: var(--danger-line); }
.rep-actions button:disabled { opacity: 0.3; cursor: default; background: none; border-color: transparent; }
.rep-actions .icon { width: 15px; height: 15px; }
.rep-fields { padding: 0.8rem 0.85rem 0.2rem; }
.rep-fields .form-group { margin-bottom: 0.75rem; }
.rep-fields .form-label { font-size: 0.74rem; color: var(--text-mid); }
.rep-add { justify-self: start; }
.rep-item.collapsed .rep-fields { display: none; }

.history { display: grid; }
.history-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border-soft); }
.history-item:first-child { padding-top: 0; }
.history-item:last-child { border-bottom: 0; padding-bottom: 0; }
.history-meta { display: flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.64rem; color: var(--text-light); margin-bottom: 0.2rem; }
.history-field { font-size: 0.84rem; font-weight: 500; color: var(--text); }
.history-diff { font-size: 0.78rem; color: var(--text-light); margin-top: 0.15rem; line-height: 1.45; }
.history-diff s { color: #8E8577; }
.history-item form { margin-top: 0.4rem; }
.side-actions { display: grid; gap: 0.5rem; }
.side-nav { display: flex; justify-content: space-between; gap: 0.5rem; }
.side-nav a { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-light); display: inline-flex; align-items: center; gap: 0.3rem; }
.side-nav a:hover { color: var(--text); }
.save-bar {
  position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem;
  margin-top: 1.25rem; padding: 0.8rem 1rem; background: rgba(11, 18, 25, 0.96); color: var(--on-dark);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.save-bar .status { font-size: 0.82rem; color: var(--on-dark-2); }
.save-bar .status.dirty { color: var(--brass-hi); }
.save-bar .btn { margin-left: auto; }

/* ── Responsive portal ─────────────────────────────── */
@media (max-width: 1200px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s var(--ease); box-shadow: none; }
  .sidebar-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.45); }
  .sidebar-close { display: inline-flex; }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(11, 18, 25, 0.45); }
  .sidebar-open .sidebar-scrim { display: block; }
  .portal-content { margin-left: 0; }
  .sidebar-toggle { display: inline-flex; }
  .portal-header { padding: 0.75rem 1.25rem; min-height: 64px; }
  .crisis-bar { padding: 0.6rem 1.25rem; }
  .portal-body { padding: 1.25rem 1.25rem 3rem; }
  .portal-content > .alert { margin: 1rem 1.25rem 0; }
  .grid-2, .grid-3, .case-layout, .msg-layout { grid-template-columns: minmax(0, 1fr); }
  .case-head-meta { text-align: left; }
  .auth-layout { grid-template-columns: minmax(0, 1fr); }
  .auth-panel { min-height: 0; padding: 1.75rem 1.5rem 2rem; gap: 2rem; }
  .auth-panel-tagline { font-size: 3rem; margin-bottom: 1rem; }
  .auth-panel-quote, .auth-panel-foot { display: none; }
}
@media (max-width: 680px) {
  .portal-header h1 { font-size: 1.3rem; }
  .portal-clock, .portal-header-meta .btn-text { display: none; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
  .stat-card { padding: 0.9rem 1rem; }
  .stat-card-value { font-size: 2rem; }
  .chart-col::after { display: none; }
  .dev-actions form .btn { min-width: 0; width: 100%; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .table th, .table td { padding-left: 0.9rem; padding-right: 0.9rem; }
  .thread-bubble, .message-bubble { max-width: 92%; }
  .auth-form-panel { padding: 2rem 1.25rem 3rem; }
  .auth-form-wrapper h2 { font-size: 2rem; }
}
