/* Larkspur Ward · design tokens and shared components
   Navy + sky blue with Liahona gold. Crimson Pro for headings, Poppins for UI. */

@font-face { font-family: 'Crimson Pro'; src: url('../fonts/crimson-pro-400.woff') format('woff'); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Crimson Pro'; src: url('../fonts/crimson-pro-700.woff') format('woff'); font-weight: 600 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Crimson Pro'; src: url('../fonts/crimson-pro-400-italic.woff') format('woff'); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-300.woff') format('woff'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-400.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-500.woff') format('woff'); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('../fonts/poppins-700.woff') format('woff'); font-weight: 700 900; font-style: normal; font-display: swap; }

:root {
  /* palette */
  --navy-950: #061426; --navy-900: #0A1F3C; --navy-800: #0F2D55; --navy-700: #143F78;
  --blue-600: #1B56A3; --blue-500: #2A6FCB; --blue-400: #4F8FE6; --blue-300: #8DB8F2;
  --sky-200: #C6DCF8; --sky-100: #E3EEFC; --sky-50: #F3F7FE;
  --gold-700: #9C7A16; --gold-600: #C9A227; --gold-500: #DDB84A; --gold-300: #EBD08A; --gold-100: #FAF1D6;
  --green-600: #1F9D6B; --green-100: #DDF3EA; --orange-600: #D9912A; --orange-100: #FBEBD3;
  --red-600: #D2475B; --red-100: #F9E0E4; --violet-600: #7B5CD6; --violet-100: #ECE6FB; --teal-600: #1F9D8B;

  /* semantic (light) */
  --bg: #F5F8FD;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(79, 143, 230, .10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(221, 184, 74, .08), transparent 60%);
  --surface: #FFFFFF;
  --surface-2: #F3F7FE;
  --surface-3: #E9F0FB;
  --text: #0E1B2C;
  --text-2: #4A5B73;
  --text-3: #7A8BA3;
  --border: #DCE5F2;
  --border-2: #C9D6EA;
  --primary: var(--blue-600);
  --primary-2: var(--blue-500);
  --primary-soft: var(--sky-100);
  --accent: var(--gold-600);
  --focus: rgba(42, 111, 203, .45);
  --overlay: rgba(6, 20, 38, .55);

  --font-display: 'Crimson Pro', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-ui: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --radius-xs: 6px; --radius-sm: 10px; --radius: 16px; --radius-lg: 22px; --radius-xl: 30px;
  --shadow-1: 0 1px 2px rgba(10, 31, 60, .06), 0 1px 1px rgba(10, 31, 60, .03);
  --shadow-2: 0 6px 18px -8px rgba(10, 31, 60, .16), 0 2px 5px rgba(10, 31, 60, .05);
  --shadow-3: 0 22px 48px -18px rgba(10, 31, 60, .32), 0 8px 18px -8px rgba(10, 31, 60, .12);
  --shadow-gold: 0 10px 30px -10px rgba(201, 162, 39, .55);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: .16s; --t: .32s; --t-slow: .6s;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #07111F;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(42, 111, 203, .16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(201, 162, 39, .08), transparent 60%);
  --surface: #0C1A2E;
  --surface-2: #10223B;
  --surface-3: #152B49;
  --text: #E6EEF9;
  --text-2: #A9BAD3;
  --text-3: #7488A5;
  --border: #1C3252;
  --border-2: #26406A;
  --primary: #4F8FE6;
  --primary-2: #6BA3EE;
  --primary-soft: rgba(79, 143, 230, .14);
  --focus: rgba(107, 163, 238, .55);
  --overlay: rgba(2, 8, 16, .7);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 22px -10px rgba(0, 0, 0, .55);
  --shadow-3: 0 26px 56px -18px rgba(0, 0, 0, .7);
  --green-100: rgba(31, 157, 107, .16); --orange-100: rgba(217, 145, 42, .16); --red-100: rgba(210, 71, 91, .16);
  --violet-100: rgba(123, 92, 214, .18); --gold-100: rgba(201, 162, 39, .16); --sky-100: rgba(79, 143, 230, .16);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) {
    --bg: #07111F;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(42, 111, 203, .16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(201, 162, 39, .08), transparent 60%);
    --surface: #0C1A2E; --surface-2: #10223B; --surface-3: #152B49;
    --text: #E6EEF9; --text-2: #A9BAD3; --text-3: #7488A5; --border: #1C3252; --border-2: #26406A;
    --primary: #4F8FE6; --primary-2: #6BA3EE; --primary-soft: rgba(79, 143, 230, .14); --focus: rgba(107, 163, 238, .55); --overlay: rgba(2, 8, 16, .7);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35); --shadow-2: 0 8px 22px -10px rgba(0, 0, 0, .55); --shadow-3: 0 26px 56px -18px rgba(0, 0, 0, .7);
    --green-100: rgba(31, 157, 107, .16); --orange-100: rgba(217, 145, 42, .16); --red-100: rgba(210, 71, 91, .16);
    --violet-100: rgba(123, 92, 214, .18); --gold-100: rgba(201, 162, 39, .16); --sky-100: rgba(79, 143, 230, .16);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font-ui); font-size: 15px; line-height: 1.55; color: var(--text);
  background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.005em; color: var(--text); }
h1 { font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + .9vw, 1.9rem); }
h3 { font-size: 1.28rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 .9em; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img, svg { vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(221, 184, 74, .35); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
code, kbd { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .08em .38em; }
kbd { box-shadow: inset 0 -1px 0 var(--border-2); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.i { width: 1.2em; height: 1.2em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.lg { width: 1.5em; height: 1.5em; }
.i.xl { width: 2.2em; height: 2.2em; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ------------------------------------------------------------------ layout helpers */
.row { display: flex; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack.sm { gap: .4rem; }
.stack.lg { gap: 1.25rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: .84rem; }
.tiny { font-size: .75rem; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-display); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 900px) { .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid.two, .grid.three, .grid.four { grid-template-columns: minmax(0, 1fr); } }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ buttons */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border-2);
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 40px; padding: .55rem 1.05rem; border-radius: 12px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font-weight: 500; font-size: .92rem; line-height: 1.1; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t) var(--ease-out), background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  box-shadow: var(--shadow-1); text-decoration: none !important; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--primary-2); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }
.btn.primary { --b-bg: linear-gradient(135deg, #2A6FCB 0%, #1B56A3 55%, #143F78 100%); --b-fg: #fff; --b-bd: transparent; background: var(--b-bg); box-shadow: 0 8px 20px -8px rgba(27, 86, 163, .7), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { box-shadow: 0 12px 28px -10px rgba(27, 86, 163, .85), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.gold { background: linear-gradient(135deg, #EBD08A 0%, #DDB84A 45%, #C9A227 100%); color: #2C2104; border-color: transparent; box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn.soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; box-shadow: none; }
.btn.danger { color: var(--red-600); border-color: color-mix(in srgb, var(--red-600) 35%, transparent); }
.btn.danger.solid { background: var(--red-600); color: #fff; }
.btn.sm { min-height: 32px; padding: .35rem .7rem; font-size: .82rem; border-radius: 10px; }
.btn.lg { min-height: 50px; padding: .8rem 1.5rem; font-size: 1rem; border-radius: 14px; }
.btn.icon { padding: 0; width: 40px; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
/* moving sheen on primary / gold */
.btn.primary::after, .btn.gold::after {
  content: ''; position: absolute; inset: -40% auto -40% -60%; width: 40%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent); transform: skewX(-20deg); transition: left .7s var(--ease-out);
}
.btn.primary:hover::after, .btn.gold:hover::after { left: 130%; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .22; pointer-events: none; animation: ripple .6s var(--ease-out) forwards; }
@keyframes ripple { to { transform: scale(2.8); opacity: 0; } }
.btn .spin { animation: spin 1s linear infinite; }

/* ------------------------------------------------------------------ cards */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: 1.15rem 1.25rem;
}
.card.lift { transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), border-color var(--t); }
.card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); border-color: var(--border-2); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.card-h h3, .card-h h2 { margin: 0; }
.card-t { font-family: var(--font-ui); font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); font-weight: 500; margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.glass { background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
.divider { height: 1px; background: var(--border); margin: .9rem 0; }

/* ------------------------------------------------------------------ badges, chips, dots */
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 500;
  background: var(--surface-3); color: var(--text-2); line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.badge.blue { background: var(--sky-100); color: var(--blue-600); }
.badge.gold { background: var(--gold-100); color: var(--gold-700); }
.badge.green { background: var(--green-100); color: var(--green-600); }
.badge.orange { background: var(--orange-100); color: #A96A12; }
.badge.red { background: var(--red-100); color: var(--red-600); }
.badge.violet { background: var(--violet-100); color: var(--violet-600); }
.badge.outline { background: transparent; border-color: var(--border-2); }
:root[data-theme='dark'] .badge.blue { color: #8DB8F2; }
:root[data-theme='dark'] .badge.gold { color: #EBD08A; }
:root[data-theme='dark'] .badge.orange { color: #F2B866; }
:root[data-theme='dark'] .badge.violet { color: #B7A3F2; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .38rem .8rem; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); font-size: .82rem; font-weight: 500; cursor: pointer; transition: all var(--t-fast);
}
.chip:hover { border-color: var(--primary-2); color: var(--text); }
.chip.on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; box-shadow: 0 6px 14px -8px rgba(10, 31, 60, .6); }
:root[data-theme='dark'] .chip.on { background: var(--blue-500); border-color: var(--blue-500); }
.chip .n { font-size: .72rem; opacity: .75; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.dot.green { background: var(--green-600); } .dot.orange { background: var(--orange-600); } .dot.red { background: var(--red-600); }
.dot.blue { background: var(--blue-500); } .dot.gold { background: var(--gold-500); } .dot.violet { background: var(--violet-600); }
.dot.pulse { position: relative; }
.dot.pulse::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; background: inherit; opacity: .45; animation: pulse 1.8s var(--ease-out) infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .55; } 100% { transform: scale(2.2); opacity: 0; } }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: .7rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; background: var(--gold-500); color: #2C2104;
}

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span, .field > label, .label { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: .75rem; color: var(--text-3); }
.input, .select, .textarea, input[type='text'].input, input[type='email'], input[type='password'], input[type='search'], input[type='date'], input[type='time'], input[type='number'], input[type='url'], input[type='tel'], input[type='datetime-local'], select, textarea {
  width: 100%; min-height: 42px; padding: .55rem .8rem; border-radius: 11px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A8BA3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px; }
input:hover, select:hover, textarea:hover { border-color: var(--blue-300); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 4px var(--focus); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type='checkbox'], input[type='radio'] { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border-2); position: relative; transition: background var(--t); flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform var(--t) var(--ease-spring); }
.switch input:checked + .track { background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--focus); }
.seg { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; position: relative; }
.seg button { white-space: nowrap; border: 0; background: transparent; padding: .42rem .85rem; border-radius: 9px; font-size: .84rem; font-weight: 500; color: var(--text-2); transition: all var(--t-fast); display: inline-flex; gap: .35rem; align-items: center; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------------ tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-3); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; padding: .6rem .75rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl td { padding: .7rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow: auto; border-radius: var(--radius); }

/* ------------------------------------------------------------------ skeletons, empty states */
.skel { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 10px; min-height: 14px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.3s infinite; }
:root[data-theme='dark'] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--text-2); }
.empty .i { width: 42px; height: 42px; color: var(--blue-300); margin-bottom: .6rem; }
.empty h4 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: .25rem; }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 90; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: .7rem; min-width: 260px; max-width: 420px; padding: .85rem 1rem;
  border-radius: 14px; background: var(--navy-900); color: #EAF1FC; box-shadow: var(--shadow-3); border: 1px solid rgba(255, 255, 255, .08);
  animation: toastIn .45s var(--ease-spring);
}
.toast.out { animation: toastOut .3s var(--ease-out) forwards; }
.toast .i { color: var(--gold-300); margin-top: 1px; }
.toast.error { background: #3A0F18; }
.toast.error .i { color: #FF9AAA; }
.toast.success .i { color: #7BE0B5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ------------------------------------------------------------------ modals & drawers */
.backdrop { position: fixed; inset: 0; z-index: 70; background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fadeIn .25s ease; }
.backdrop.out { animation: fadeOut .22s ease forwards; }
.modal {
  position: fixed; z-index: 71; left: 50%; top: 50%; width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow: auto;
  transform: translate(-50%, -50%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  border: 1px solid var(--border); animation: modalIn .42s var(--ease-spring);
}
.modal.wide { width: min(920px, calc(100vw - 28px)); }
.modal.out { animation: modalOut .22s var(--ease-out) forwards; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.35rem .5rem; }
.modal-h h3 { margin: 0; font-size: 1.4rem; }
.modal-b { padding: .6rem 1.35rem 1.2rem; }
.modal-f { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.35rem 1.2rem; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
@keyframes modalOut { to { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
.drawer {
  position: fixed; z-index: 71; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-3);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; animation: drawerIn .45s var(--ease-out);
}
.drawer.out { animation: drawerOut .25s var(--ease-in-out) forwards; }
.drawer-h { padding: 1.1rem 1.3rem .8rem; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.drawer-b { padding: 1.1rem 1.3rem 2rem; overflow: auto; flex: 1; }
@keyframes drawerIn { from { transform: translateX(100%); } }
@keyframes drawerOut { to { transform: translateX(100%); } }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); position: relative; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: .7rem .9rem; font-weight: 500; font-size: .9rem; color: var(--text-2); position: relative; display: inline-flex; gap: .45rem; align-items: center; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); }
.tabs .ink { position: absolute; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--blue-500), var(--gold-500)); transition: left var(--t) var(--ease-out), width var(--t) var(--ease-out); }

/* ------------------------------------------------------------------ tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 40;
  background: var(--navy-900); color: #fff; font-size: .74rem; font-weight: 400; line-height: 1.35; padding: .4rem .6rem; border-radius: 8px;
  white-space: nowrap; max-width: 280px; box-shadow: var(--shadow-2); animation: tipIn .18s var(--ease-out); pointer-events: none;
}
@keyframes tipIn { from { opacity: 0; transform: translate(-50%, 4px); } }

/* ------------------------------------------------------------------ progress, rings, meters */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-500), var(--blue-400)); width: 0; transition: width 1.1s var(--ease-out); }
.meter.gold > i { background: linear-gradient(90deg, var(--gold-600), var(--gold-300)); }
.meter.green > i { background: linear-gradient(90deg, #1F9D6B, #45C491); }
.ring { --size: 76px; width: var(--size); height: var(--size); position: relative; display: inline-grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease-out); }
.ring b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ animations */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes glow { 0%, 100% { filter: drop-shadow(0 0 10px rgba(235, 208, 138, .35)); } 50% { filter: drop-shadow(0 0 22px rgba(235, 208, 138, .7)); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.anim-in { animation: fadeUp .6s var(--ease-out) both; }
.stagger > * { animation: fadeUp .6s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .07s; } .stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; } .stagger > *:nth-child(5) { animation-delay: .22s; } .stagger > *:nth-child(6) { animation-delay: .27s; }
.stagger > *:nth-child(7) { animation-delay: .32s; } .stagger > *:nth-child(8) { animation-delay: .37s; } .stagger > *:nth-child(9) { animation-delay: .42s; }
.stagger > *:nth-child(n+10) { animation-delay: .46s; }
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
.burst { position: fixed; z-index: 95; pointer-events: none; width: 8px; height: 8px; border-radius: 2px; animation: burst .9s var(--ease-out) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ print */
@media print {
  body { background: #fff !important; color: #000; font-size: 12pt; }
  .no-print, .toasts, .backdrop { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
}
