/* =====================================================================
   FAMS design system
   Type: Space Grotesk (display, figures) + Inter (body)
   Signature: ink-navy sidebar, gold hairline on stat cards,
   tabular numerals everywhere money appears.
   ===================================================================== */

:root {
  --ink: #10192e;
  --ink-2: #1a2742;
  --paper: #f3f5f9;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #17203a;
  --text-2: #5b6780;
  --accent: #2456e6;
  --accent-soft: #e8eefc;
  --gold: #c9a24b;
  --gain: #0e9f6e;
  --gain-soft: #e2f5ee;
  --loss: #d6455d;
  --loss-soft: #fbe7ec;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --shadow-sm: 0 1px 2px rgba(16, 25, 46, .04);
  --shadow: 0 1px 2px rgba(16, 25, 46, .05), 0 8px 24px rgba(16, 25, 46, .06);
  --shadow-lg: 0 4px 10px rgba(16, 25, 46, .06), 0 20px 48px rgba(16, 25, 46, .10);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 248px;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --paper: #0b1120;
  --card: rgba(21, 30, 51, .92);
  --line: #24304d;
  --text: #e8edf7;
  --text-2: #93a0bc;
  --accent: #5b83f0;
  --accent-soft: rgba(91, 131, 240, .14);
  --gold: #d8b566;
  --gain: #34c493;
  --gain-soft: rgba(52, 196, 147, .14);
  --loss: #f06880;
  --loss-soft: rgba(240, 104, 128, .14);
  --warn: #e2a83d;
  --warn-soft: rgba(226, 168, 61, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, .35), 0 24px 56px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body, .sidebar, .topbar, .card, .stat-card, .panel, .btn, .icon-btn, .modal, .dropdown-menu {
  transition: background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), color .2s var(--ease);
}
body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(900px 420px at 100% -8%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%),
    var(--paper);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; margin: 0 0 .5rem; }
a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { text-decoration: underline; }
.muted { color: var(--text-2); }
.num, .stat-value, td.money, .money { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; padding: 24px 28px; max-width: 1440px; width: 100%; margin: 0 auto; animation: content-in .28s var(--ease); }
@keyframes content-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.app-footer {
  display: flex; justify-content: space-between; padding: 14px 28px;
  border-top: 1px solid var(--line); font-size: .82rem; color: var(--text-2);
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #cfd8ea; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 18px;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), #9a7527); color: #131b2d;
  box-shadow: 0 2px 8px rgba(201, 162, 75, .35);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border: 2px solid transparent; }
.nav-label {
  display: block; padding: 14px 12px 6px; font-size: .68rem;
  letter-spacing: .12em; text-transform: uppercase; color: #7686a5;
}
.sidebar-nav a, .sidebar-foot a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 9px; color: #cfd8ea; font-size: .92rem; margin-bottom: 2px;
  transition: background-color .15s var(--ease), color .15s var(--ease), padding-left .15s var(--ease);
}
.sidebar-nav a i { width: 18px; text-align: center; opacity: .8; }
.sidebar-nav a:hover, .sidebar-foot a:hover { background: rgba(255,255,255,.07); text-decoration: none; padding-left: 15px; }
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(201,162,75,.16), rgba(255,255,255,.06)); color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-nav a.active i { opacity: 1; color: var(--gold); }
.sidebar-foot { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-backdrop { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; background: color-mix(in srgb, var(--card) 88%, transparent);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 1px 0 rgba(16,25,46,.02);
}
.icon-btn {
  position: relative; border: 1px solid var(--line); background: var(--card);
  color: var(--text); width: 38px; height: 38px; border-radius: 10px;
  cursor: pointer; font-size: .95rem;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.badge-dot {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--loss); color: #fff; font-size: .68rem;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}
.sidebar-toggle { display: none; }

.global-search { position: relative; flex: 1; max-width: 480px; }
.global-search i { position: absolute; left: 13px; top: 12px; color: var(--text-2); }
.global-search input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper); color: var(--text);
  font-family: var(--font-body); font-size: .9rem;
}
.global-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 380px; overflow-y: auto; z-index: 60;
}
.search-results a {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px;
  color: var(--text); border-bottom: 1px solid var(--line); font-size: .88rem;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .sr-type { font-size: .7rem; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  cursor: pointer; color: var(--text);
}
.avatar {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink);
  color: var(--gold); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.user-name { font-size: .85rem; font-weight: 600; }
.user-role { font-size: .72rem; color: var(--text-2); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 70; overflow: hidden;
}
.dropdown-menu a {
  display: flex; gap: 10px; align-items: center; padding: 11px 15px;
  color: var(--text); font-size: .88rem;
}
.dropdown-menu a:hover { background: var(--accent-soft); text-decoration: none; }
.dropdown-menu a.danger { color: var(--loss); }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.dropdown-foot { display: block; text-align: center; padding: 10px; border-top: 1px solid var(--line); font-size: .84rem; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: .8rem; }
.notif-menu { width: 340px; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { padding: 11px 15px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .nt { font-weight: 600; }
.notif-item .nb { color: var(--text-2); font-size: .8rem; margin-top: 2px; }
.pad { padding: 14px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head .sub { color: var(--text-2); font-size: .88rem; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Stat cards (signature: gold hairline) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--gold) 35%, var(--line)); }
.stat-card::before {
  content: ""; position: absolute; inset: 0 auto auto 0; height: 3px; width: 44px;
  background: linear-gradient(90deg, var(--gold), transparent);
  transition: width .25s var(--ease);
}
.stat-card:hover::before { width: 100%; }
.stat-label { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: 6px; }
.stat-sub { font-size: .78rem; margin-top: 4px; color: var(--text-2); }
.delta-up { color: var(--gain); font-weight: 600; }
.delta-down { color: var(--loss); font-weight: 600; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 20px;
  transition: box-shadow .2s var(--ease);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 340px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-body); font-size: .88rem; font-weight: 600; line-height: 1.2;
  transition: transform .12s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}
.btn:hover { text-decoration: none; filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(0); filter: brightness(.97); }
.btn-primary {
  background: linear-gradient(155deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent) 60%);
  color: #fff; box-shadow: 0 1px 2px rgba(16,25,46,.08), 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn-primary:hover { box-shadow: 0 2px 4px rgba(16,25,46,.1), 0 10px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-danger { background: var(--loss); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); transform: none; }
.btn-sm { padding: 6px 10px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none !important; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.dataTable, .table {
  width: 100% !important; border-collapse: collapse; font-size: .88rem;
}
.table th, table.dataTable th {
  text-align: left; padding: 10px 12px; color: var(--text-2);
  font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td, table.dataTable td {
  padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.table tbody tr:hover, table.dataTable tbody tr:hover { background: var(--accent-soft); }
td.money { text-align: right; white-space: nowrap; }
th.money { text-align: right; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  background: var(--paper); color: var(--text); margin-left: 6px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important; border: 1px solid var(--line) !important;
  background: var(--card) !important; color: var(--text) !important; margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important;
}
.dataTables_wrapper { color: var(--text-2); font-size: .84rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--gain-soft); color: var(--gain); border: 1px solid color-mix(in srgb, var(--gain) 22%, transparent); }
.badge-red { background: var(--loss-soft); color: var(--loss); border: 1px solid color-mix(in srgb, var(--loss) 22%, transparent); }
.badge-amber { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-blue { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.badge-grey { background: var(--paper); color: var(--text-2); border: 1px solid var(--line); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .form-control {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--text); font-family: var(--font-body); font-size: .9rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input:not([type="checkbox"]):not([type="radio"]):hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.field textarea { min-height: 84px; resize: vertical; }
.check input[type="checkbox"], .check input[type="radio"] {
  width: 16px; height: 16px; flex-shrink: 0; margin: 0;
  accent-color: var(--accent); cursor: pointer;
}
.check input[type="checkbox"]:focus-visible, .check input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; cursor: pointer; }
.help { font-size: .76rem; color: var(--text-2); margin-top: 4px; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters-bar .field { margin-bottom: 0; min-width: 160px; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
  font-size: .88rem; border: 1px solid transparent;
}
.alert-success { background: var(--gain-soft); color: var(--gain); }
.alert-danger { background: var(--loss-soft); color: var(--loss); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--accent-soft); color: var(--accent); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(9, 14, 26, .55); z-index: 90;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px;
  backdrop-filter: blur(3px);
}
.modal-backdrop { animation: backdrop-in .15s var(--ease); }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); animation: modal-in .2s var(--ease);
}
.modal-lg { max-width: 760px; }
@keyframes modal-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-shrink: 0; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; }

/* ---------- Goal cards ---------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.goal-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.goal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

/* ---------- Empty & skeleton ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-state i { color: var(--gold); margin-bottom: 12px; }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--line), var(--paper), var(--line)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: 14px; padding: 34px 20px;
  text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.dragover, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Auth screens ---------- */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 520px at 18% -12%, rgba(201,162,75,.16) 0%, transparent 55%),
    radial-gradient(900px 520px at 88% 108%, rgba(36,86,230,.20) 0%, transparent 55%),
    radial-gradient(1400px 700px at 50% -20%, #1c2c50 0%, var(--ink) 55%, #0a1020 100%);
  padding: 24px;
}
.auth-body::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(700px 500px at 50% 30%, #000 0%, transparent 75%);
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 18px;
  padding: 34px 32px; box-shadow: 0 24px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04);
  position: relative; animation: auth-in .35s var(--ease) both;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 46px; height: 46px; font-size: 1.15rem; margin-bottom: 12px; box-shadow: 0 4px 16px rgba(201,162,75,.4); }
.auth-brand h1 { font-size: 1.3rem; margin: 0; }
.auth-brand p.muted { letter-spacing: .04em; }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: .84rem; }
.auth-links { text-align: center; margin-top: 16px; font-size: .86rem; }
.totp-input { text-align: center; font-size: 1.5rem; letter-spacing: .4em; font-family: var(--font-display); }

/* ---------- Detail lists ---------- */
.detail-list { display: grid; grid-template-columns: 160px 1fr; row-gap: 10px; font-size: .9rem; }
.detail-list dt { color: var(--text-2); }
.detail-list dd { margin: 0; }

/* ---------- Focus visibility & reduced motion ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(9,14,26,.5); z-index: 95; }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 18px 16px; }
  .topbar { padding: 10px 16px; }
  .user-meta { display: none; }
  .global-search { max-width: none; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: 1.25rem; }
  .detail-list { grid-template-columns: 1fr; }
}

/* =====================================================================
   Public corporate website
   Extends the same design system: ink navy, sovereign blue, signature
   gold hairline, Space Grotesk display over Inter body. Scoped under
   .site-* classes so the portal shell is untouched.
   ===================================================================== */

.site-body { display: block; background: var(--paper); }
.site-container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 10px;
  transition: top .15s var(--ease);
}
.skip-link:focus { top: 0; text-decoration: none; outline: 2px solid var(--gold); }

/* ---------- Header / navigation ---------- */
.site-header {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 74px; }
.site-brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.site-brand:hover { text-decoration: none; }
.site-logo-img { max-height: 44px; max-width: 190px; display: block; }
.site-logo-mark {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: var(--gold); font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold) 65%, transparent);
}
.site-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.site-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem; letter-spacing: -.01em; }
.site-brand-tag { font-size: .72rem; color: var(--text-2); letter-spacing: .04em; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a:not(.btn) {
  padding: 9px 13px; border-radius: 9px; color: var(--text); font-size: .93rem; font-weight: 500;
}
.site-nav a:not(.btn):hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.site-nav a.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 9px 9px 0 0; }
.site-nav a:focus-visible, .site-footer a:focus-visible, .site-inline-link:focus-visible, .site-card-more:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
.site-nav-login { margin-left: 10px; }
.site-nav-toggle {
  display: none; flex-direction: column; gap: 5px; padding: 10px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.site-nav-toggle-bar { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s var(--ease), opacity .2s var(--ease); }
.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bar:nth-child(2) { transform: translateY(7px) rotate(45deg); }
.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bar:nth-child(3) { opacity: 0; }
.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bar:nth-child(4) { transform: translateY(-7px) rotate(-45deg); }
.site-nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons (public accents, reusing .btn base) ---------- */
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #9a7527); color: #131b2d;
  font-weight: 600; box-shadow: 0 2px 8px rgba(201, 162, 75, .35);
}
.btn-gold:hover { box-shadow: 0 4px 14px rgba(201, 162, 75, .45); }
.btn-hero-outline { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-hero-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-outline-navy { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline-navy:hover { background: var(--ink); color: #fff; }

/* ---------- Hero ---------- */
.site-hero {
  color: #e8edf7; padding: 96px 0 104px; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 520px at 18% -12%, rgba(201,162,75,.16) 0%, transparent 55%),
    radial-gradient(900px 520px at 88% 108%, rgba(36,86,230,.20) 0%, transparent 55%),
    radial-gradient(1400px 700px at 50% -20%, #1c2c50 0%, var(--ink) 55%, #0a1020 100%);
}
.site-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(900px 600px at 50% 20%, #000 0%, transparent 75%);
}
.site-hero-inner { position: relative; max-width: 760px; }
.site-eyebrow {
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin: 0 0 14px;
}
.site-hero .site-eyebrow { color: #d8b566; }
.site-hero-heading {
  font-family: var(--font-display); font-size: clamp(1.9rem, 4.4vw, 3rem);
  line-height: 1.12; letter-spacing: -.02em; margin: 0 0 18px; color: #fff;
}
.site-hero-lead { font-size: 1.08rem; line-height: 1.7; color: #b9c4dc; max-width: 620px; margin: 0 0 30px; }
.site-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.site-section { padding: 72px 0; }
.site-section-alt { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.site-section-head { max-width: 680px; margin-bottom: 36px; }
.site-section-head h2, .site-two-col h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.site-section-lead { color: var(--text-2); line-height: 1.7; }
.site-section-foot { margin-top: 32px; }
.site-two-col { display: grid; grid-template-columns: 1fr 1.6fr; gap: 48px; align-items: start; }
.site-prose p { line-height: 1.75; margin: 0 0 1.1em; }
.site-prose-narrow { max-width: 720px; }
.site-prose-center { max-width: 760px; margin: 0 auto; font-size: 1.04rem; }
.site-prose h2 { margin-top: 2.2em; font-size: 1.35rem; }
.site-prose h2:first-child { margin-top: 0; }
.site-inline-link { font-weight: 600; }

/* ---------- Cards ---------- */
.site-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.site-service-card, .site-insight-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm); position: relative;
  border-top: 3px solid var(--gold);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.site-service-card:hover, .site-insight-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.site-service-card h3, .site-insight-card h3 { font-size: 1.06rem; margin: 0 0 8px; line-height: 1.35; }
.site-service-card h3 a, .site-insight-card h3 a { color: var(--text); }
.site-service-card p, .site-insight-card p { color: var(--text-2); line-height: 1.65; font-size: .93rem; margin: 0 0 14px; }
.site-card-more { font-size: .87rem; font-weight: 600; }
.site-insight-date { display: block; font-size: .78rem; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }

/* ---------- Page header band / breadcrumb ---------- */
.site-page-header {
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #e8edf7; padding: 52px 0 56px; border-bottom: 3px solid var(--gold);
}
.site-page-header h1 { color: #fff; font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 0 0 10px; }
.site-page-lead { color: #b9c4dc; line-height: 1.7; max-width: 640px; margin: 0; }
.site-breadcrumb { margin-bottom: 18px; font-size: .82rem; }
.site-breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.site-breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--text-2); }
.site-page-header .site-breadcrumb a { color: #9fb0d4; }
.site-page-header .site-breadcrumb span[aria-current] { color: #e8edf7; }
.site-breadcrumb a { color: var(--text-2); }
.site-breadcrumb span[aria-current] { color: var(--text); font-weight: 500; }

/* ---------- Services page ---------- */
.site-services-layout, .site-legal-layout { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: start; }
.site-services-toc { position: sticky; top: 96px; }
.site-services-toc ul { list-style: none; margin: 0; padding: 0; }
.site-services-toc a {
  display: block; padding: 7px 10px; border-left: 2px solid var(--line);
  color: var(--text-2); font-size: .88rem;
}
.site-services-toc a:hover { color: var(--accent); border-left-color: var(--gold); text-decoration: none; }
.site-service-section { padding: 8px 0 34px; border-bottom: 1px solid var(--line); margin-bottom: 34px; scroll-margin-top: 96px; }
.site-service-section:last-child { border-bottom: 0; margin-bottom: 0; }
.site-service-section h2 { font-size: 1.35rem; margin-bottom: 14px; }
.site-service-section p { line-height: 1.75; margin: 0 0 1.05em; }

/* ---------- CTA panel ---------- */
.site-cta {
  padding: 56px 0;
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  border-top: 3px solid var(--gold);
}
.site-cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.site-cta h2 { color: #fff; margin: 0 0 8px; font-size: 1.45rem; }
.site-cta p { color: #b9c4dc; line-height: 1.65; max-width: 620px; margin: 0; }

/* ---------- Insights ---------- */
.site-insight-grid { align-items: stretch; }
.site-pagination { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 40px; font-size: .92rem; color: var(--text-2); }
.site-empty { text-align: center; color: var(--text-2); padding: 40px 0; }
.site-article { max-width: 760px; }
.site-article-head { margin: 18px 0 26px; }
.site-article-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.2; }
.site-article-meta { color: var(--text-2); font-size: .88rem; }
.site-article-image { width: 100%; border-radius: var(--radius); margin-bottom: 26px; }
.site-article-summary { font-size: 1.08rem; color: var(--text-2); border-left: 3px solid var(--gold); padding-left: 16px; }
.site-article-foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.site-article-disclaimer { font-size: .8rem; color: var(--text-2); line-height: 1.6; }

/* ---------- Contact ---------- */
.site-contact-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 48px; align-items: start; }
.site-form-note { color: var(--text-2); margin-bottom: 20px; }
.req { color: var(--loss); }
.field-error { display: block; margin-top: 5px; font-size: .8rem; color: var(--loss); }
.site-form-privacy { font-size: .8rem; color: var(--text-2); margin-top: 14px; line-height: 1.6; }
.site-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.site-contact-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 3px solid var(--gold); padding: 26px; box-shadow: var(--shadow-sm);
}
.site-contact-panel h2 { font-size: 1.15rem; margin-bottom: 16px; }
.site-contact-list { margin: 0 0 22px; }
.site-contact-list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.site-contact-list > div:last-child { border-bottom: 0; }
.site-contact-list dt { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 3px; }
.site-contact-list dd { margin: 0; font-size: .95rem; }
.site-map-placeholder {
  border: 1px dashed var(--line); border-radius: var(--radius-sm); text-align: center;
  padding: 34px 18px; color: var(--text-2); background: var(--paper);
}
.site-map-placeholder span { font-family: var(--font-display); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; display: block; margin-bottom: 6px; }
.site-map-placeholder p { margin: 0; font-size: .82rem; }

/* ---------- Legal ---------- */
.site-legal-note { line-height: 1.6; }
.site-placeholder-flag { font-size: .7rem; vertical-align: middle; color: var(--warn); background: var(--warn-soft); padding: 3px 8px; border-radius: 999px; letter-spacing: .04em; margin-left: 8px; font-family: var(--font-body); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #9fb0d4; padding: 56px 0 28px; }
.site-footer a { color: #cfd8ea; }
.site-footer a:hover { color: var(--gold); }
.site-footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr; gap: 40px; padding-bottom: 34px; border-bottom: 1px solid rgba(255,255,255,.1); }
.site-footer-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: #fff; margin: 0 0 6px; }
.site-footer-tag { font-size: .86rem; margin: 0 0 16px; }
.site-footer-heading { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #7686a5; font-weight: 600; margin: 0 0 12px; }
.site-footer-links, .site-footer-contact, .site-footer-social { list-style: none; margin: 0; padding: 0; }
.site-footer-links li, .site-footer-contact li { margin-bottom: 9px; font-size: .9rem; line-height: 1.5; }
.site-footer-social { display: flex; gap: 16px; }
.site-footer-social a { font-size: .86rem; }
.site-footer-disclaimer { font-size: .76rem; line-height: 1.65; color: #7686a5; margin: 24px 0 0; }
.site-footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 22px; font-size: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .site-card-grid { grid-template-columns: repeat(2, 1fr); }
  .site-two-col, .site-contact-layout { grid-template-columns: 1fr; gap: 24px; }
  .site-services-layout, .site-legal-layout { grid-template-columns: 1fr; }
  .site-services-toc { position: static; margin-bottom: 8px; }
  .site-footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .site-hero { padding: 64px 0 72px; }
  .site-section { padding: 52px 0; }
  .site-card-grid { grid-template-columns: 1fr; }
  .site-footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .site-nav-toggle { display: flex; }
  .site-nav {
    display: flex; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 12px 18px 18px; box-shadow: var(--shadow);
    /* Animated open/close: kept in the layout but hidden, so the panel
       can slide and fade. visibility keeps it out of the tab order. */
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease), visibility 0s linear .22s;
  }
  .site-nav.open {
    visibility: visible; opacity: 1; transform: none; pointer-events: auto;
    transition: opacity .22s var(--ease), transform .22s var(--ease), visibility 0s;
  }
  .site-nav a:not(.btn) { padding: 12px 10px; }
  .site-nav a.active { box-shadow: inset 3px 0 0 var(--gold); border-radius: 9px; }
  .site-nav-login { margin: 10px 0 0; justify-content: center; }
  .site-brand-tag { display: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .site-body *, .site-body *::before, .site-body *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .site-service-card:hover, .site-insight-card:hover { transform: none; }
}

/* ---------- Role permission editor ---------- */
.perm-groups {
  max-height: 44vh; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 12px; padding: 6px 14px 12px; background: var(--paper);
}
.perm-group { border: 0; margin: 8px 0 0; padding: 0 0 10px; border-bottom: 1px solid var(--line); }
.perm-group:last-child { border-bottom: 0; padding-bottom: 2px; }
.perm-group legend { padding: 8px 0 4px; width: 100%; }
.perm-group-toggle strong { font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text); }
.perm-item { display: flex; padding: 5px 0 5px 24px; line-height: 1.4; }
.perm-item input { margin-top: 1px; }
@media (max-width: 720px) {
  .perm-groups { max-height: 50vh; padding: 4px 10px 10px; }
  .perm-item { padding-left: 16px; }
  .modal-lg { max-width: 100%; }
}

/* ---------- Uploaded logo sizing per context (fallback marks unchanged) ---------- */
.sidebar-logo-img { max-height: 34px; max-width: 158px; display: block; object-fit: contain; }
.auth-logo-img { max-height: 48px; max-width: 210px; display: block; margin: 0 auto 12px; object-fit: contain; }
.report-logo-img { max-height: 40px; max-width: 170px; object-fit: contain; }

/* ==================================================================
   Public site — editorial imagery (plates, splits, featured layouts)
   ================================================================== */

/* The plate: one consistent frame for every public image or etching. */
.plate {
  position: relative; margin: 0; border: 1px solid var(--line);
  border-radius: 4px; overflow: visible; background: var(--card);
}
.plate::after {                     /* offset gold corner rule */
  content: ""; position: absolute; right: -10px; bottom: -10px;
  width: 58px; height: 58px; pointer-events: none;
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
}
.plate > img, .plate > .plate-art-svg {
  display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: 3px;
}
.plate-43  { aspect-ratio: 4 / 3; }
.plate-32  { aspect-ratio: 3 / 2; }
.plate-169 { aspect-ratio: 16 / 9; }
.plate-45  { aspect-ratio: 4 / 5; }
.plate-etching {
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px),
    radial-gradient(120% 130% at 20% 0%, #1c2c50 0%, var(--ink) 58%, #0a1020 100%);
  background-size: 34px 34px, 34px 34px, cover;
  border-color: #232f4e;
}
.plate-etching .plate-art-svg { object-fit: contain; padding: 6%; }

/* Split hero: statement left, plate breaking out of the band right. */
.site-hero-split .site-hero-inner {
  max-width: none; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 56px; align-items: center;
}
.site-hero-split { padding-bottom: 64px; overflow: visible; }
.site-hero-media { position: relative; margin-bottom: -120px; }
.site-hero-media .plate { box-shadow: 0 24px 60px rgba(6, 10, 22, .45); }
.site-hero-media .plate-etching { border-color: rgba(201,162,75,.35); }
.site-hero-offset { padding-top: 132px; }   /* section that receives the overlap */

/* Editorial split sections (text beside a plate, alternating). */
.site-split {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 64px; align-items: center;
}
.site-split-rev > :first-child { order: 2; }
.site-split-rev > :last-child  { order: 1; }
.site-split .site-prose p:last-child { margin-bottom: 0; }

/* Deep-navy legacy band. */
.site-band {
  background:
    radial-gradient(900px 420px at 85% 110%, rgba(36,86,230,.18) 0%, transparent 60%),
    linear-gradient(170deg, #16244a 0%, var(--ink) 60%, #0b1224 100%);
  color: #dfe6f5; padding: 84px 0;
}
.site-band h2 { color: #fff; }
.site-band .site-prose p { color: #b9c4dc; }
.site-band .plate { border-color: #2a3760; background: transparent; }
.site-band .site-eyebrow { color: #d8b566; }

/* Services page: image beside each principal service. */
.site-service-split {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 48px; align-items: start;
}
.site-service-split .plate { position: sticky; top: 96px; }

/* Insights: featured article + card plates. */
.site-featured-insight {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 56px; align-items: center; margin-bottom: 56px;
  padding-bottom: 56px; border-bottom: 1px solid var(--line);
}
.site-featured-label {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin: 0 0 12px;
}
.site-featured-insight h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); margin: 0 0 14px; line-height: 1.2; }
.site-featured-insight h2 a { color: var(--ink); text-decoration: none; }
.site-featured-insight h2 a:hover { color: var(--accent); }
.site-insight-card .plate { margin-bottom: 18px; }
.site-insight-card .plate::after { width: 34px; height: 34px; right: -7px; bottom: -7px; }

/* Contact: form beside a quiet plate + details column. */
.site-contact-aside .plate { margin-bottom: 26px; }

@media (max-width: 900px) {
  .site-hero-split .site-hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .site-hero-media { margin-bottom: -84px; max-width: 480px; }
  .site-hero-offset { padding-top: 116px; }
  .site-split, .site-featured-insight, .site-service-split { grid-template-columns: 1fr; gap: 34px; }
  .site-split-rev > :first-child { order: 0; }
  .site-split-rev > :last-child  { order: 0; }
  .site-split .plate, .site-featured-insight .plate { max-width: 560px; }
  .site-service-split .plate { position: static; max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-hero-media .plate, .plate, .site-card, .btn { transition: none !important; }
}

/* Footer logo: natural aspect ratio, never forced square, responsive. */
.site-footer-logo { display: block; max-height: 42px; max-width: 210px; width: auto; height: auto; margin: 0 0 12px; }

/* ==================================================================
   Public site — motion system
   Calm, brief, and entirely optional: entrances run only when the
   visitor allows motion; scroll reveals activate only when JS adds
   .reveal-ready to <html> (no JS → everything simply visible).
   Only transform/opacity/filter/box-shadow are animated.
   ================================================================== */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* --- Page load: hero settles in with a quiet stagger (CSS only) --- */
  @keyframes site-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
  .site-hero .site-eyebrow,
  .site-hero-heading,
  .site-hero-lead,
  .site-hero-actions,
  .site-hero-media { animation: site-rise .6s var(--ease) backwards; }
  .site-hero-heading { animation-delay: .07s; }
  .site-hero-lead    { animation-delay: .14s; }
  .site-hero-actions { animation-delay: .21s; }
  .site-hero-media   { animation-delay: .16s; animation-duration: .75s; }

  .site-page-header h1, .site-page-header .site-eyebrow,
  .site-page-header .site-page-lead, .site-page-header .site-breadcrumb {
    animation: site-rise .55s var(--ease) backwards;
  }
  .site-page-header h1 { animation-delay: .06s; }
  .site-page-header .site-page-lead { animation-delay: .12s; }

  /* --- Scroll reveal (activated by public.js) --- */
  html.reveal-ready [data-reveal] {
    opacity: 0; transform: translateY(16px);
    transition: opacity .55s var(--ease), transform .55s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
    will-change: opacity, transform;
  }
  html.reveal-ready [data-reveal].in-view { opacity: 1; transform: none; will-change: auto; }

  /* --- Images: plates lift gently inside links; photos brighten --- */
  .plate { transition: transform .28s var(--ease), box-shadow .28s var(--ease); }
  .plate > img { transition: filter .45s var(--ease); }
  a:hover > .plate, a:focus-visible > .plate {
    transform: translateY(-3px); box-shadow: 0 14px 30px rgba(16, 25, 46, .14);
  }
  a:hover > .plate > img { filter: brightness(1.05) saturate(1.04); }

  /* --- Cards & links --- */
  .site-card-more span[aria-hidden] { display: inline-block; transition: transform .2s var(--ease); }
  .site-insight-card:hover .site-card-more span[aria-hidden],
  .site-service-card:hover .site-card-more span[aria-hidden],
  .site-card-more:hover span[aria-hidden] { transform: translateX(4px); }
  .site-insight-card:hover h3 a, .site-service-card:hover h3 a { color: var(--accent); }

  /* --- Footer links: gold underline slides in --- */
  .site-footer-links a, .site-footer-social a {
    position: relative; transition: color .2s var(--ease);
  }
  .site-footer-links a::after, .site-footer-social a::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
    height: 1px; background: var(--gold);
    transition: right .25s var(--ease);
  }
  .site-footer-links a:hover::after, .site-footer-social a:hover::after,
  .site-footer-links a:focus-visible::after, .site-footer-social a:focus-visible::after { right: 0; }
}

/* --- Header: quiet state change once the page has scrolled --- */
.site-header { transition: box-shadow .25s var(--ease); }
.site-header.is-scrolled { box-shadow: 0 6px 24px rgba(16, 25, 46, .1); }

/* --- Forms: sending state on the contact form (visible feedback) --- */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: btn-spin .7s linear infinite;
}
.btn-gold.is-loading::after { border-color: rgba(19,27,45,.3); border-top-color: #131b2d; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.site-alert-in { animation: site-alert-in .3s var(--ease) backwards; }
@keyframes site-alert-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .site-alert-in { animation: none; }
  /* The sending spinner is essential feedback; slow it right down. */
  .btn.is-loading::after { animation-duration: 2s; }
}

/* ---------- Editorial copy patterns: pull quotes & principles ---------- */
.site-pullquote {
  margin: 0; padding: 8px 0 8px 28px; border-left: 3px solid var(--gold);
  font-family: var(--font-display); font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 500; line-height: 1.45; color: var(--ink); max-width: 720px;
}
.site-pullquote footer { margin-top: 10px; font-family: var(--font-body); font-size: .82rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.site-band .site-pullquote { color: #fff; border-left-color: var(--gold); }
.site-hero-support { color: rgba(233,238,248,.78); line-height: 1.75; max-width: 560px; margin: 14px 0 0; font-size: .97rem; }
.site-principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 40px; margin-top: 38px; }
.site-principle h3 {
  font-size: .98rem; margin: 0 0 8px; padding-top: 12px; position: relative;
}
.site-principle h3::before {
  content: ""; position: absolute; top: 0; left: 0; width: 30px; height: 2px; background: var(--gold);
}
.site-principle p { color: var(--text-2); line-height: 1.7; font-size: .93rem; margin: 0; }
.site-lede { font-size: 1.06rem; line-height: 1.8; color: var(--text); }
@media (max-width: 720px) {
  .site-principles { grid-template-columns: 1fr; gap: 22px; }
  .site-pullquote { padding-left: 20px; }
}

/* ---------- Insights: category labels & filter ---------- */
.site-insight-category {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}
.site-insight-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 34px; }
.site-insight-filters a {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: .84rem; font-weight: 500; color: var(--text);
  transition: border-color .2s var(--ease), color .2s var(--ease), background-color .2s var(--ease);
}
.site-insight-filters a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.site-insight-filters a.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Document request status badges (badge-muted completes the existing set) */
.badge-muted { background: var(--paper); color: var(--text-2); border: 1px solid var(--line); }

/* ---------- Onboarding checklist ---------- */
.onboarding-progress {
  height: 6px; border-radius: 999px; background: var(--paper);
  border: 1px solid var(--line); overflow: hidden; margin: 4px 0 18px;
}
.onboarding-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent)); border-radius: 999px; transition: width .4s var(--ease); }
.onboarding-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.onboarding-list li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.onboarding-list li:last-child { border-bottom: 0; }
.onboarding-mark { margin-top: 2px; }
.onboarding-list .is-done .onboarding-mark { color: var(--gain); }
.onboarding-list .is-open .onboarding-mark { color: var(--line); }
.onboarding-list .is-done .onboarding-text strong { color: var(--text-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-2) 45%, transparent); }
.onboarding-text { flex: 1; display: grid; gap: 2px; }
.onboarding-text .muted { font-size: .85rem; font-weight: 400; }
.onboarding-list .btn { flex-shrink: 0; }

/* Notifications: per-item read control alignment */
.notif-row { display: flex; align-items: flex-start; gap: 10px; }
.notif-main { flex: 1; min-width: 0; }
.notif-item .js-mark-read { flex-shrink: 0; color: var(--text-2); }
.notif-item .js-mark-read:hover { color: var(--gain); }

/* ---------- Resources library ---------- */
.site-resource-card { position: relative; display: flex; flex-direction: column; }
.site-resource-card .site-resource-action { margin: auto 0 0; padding-top: 14px; }
.site-resource-card.is-featured { border-color: var(--gold); }
.site-resource-flag {
  position: absolute; top: -1px; right: 18px; background: var(--gold); color: #131b2d;
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 0 0 8px 8px;
}
.site-resource-action .muted { font-size: .78rem; margin-left: 4px; }

/* ---------- Client journey (numbered process) ---------- */
.site-process { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 26px; }
.site-process li { counter-increment: step; position: relative; padding-left: 62px; }
.site-process li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 0;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--gold);
}
.site-process li::after {
  content: ""; position: absolute; left: 14px; top: 38px; bottom: -20px; width: 1px; background: var(--line);
}
.site-process li:last-child::after { display: none; }
.site-process h3 { margin: 0 0 6px; font-size: 1.02rem; }
.site-process p { margin: 0; color: var(--text-2); line-height: 1.7; font-size: .94rem; }
