/* Cornerstone Asset Recovery — shared brand stylesheet ("Foundation", adopted 2026-10-14).
   Source of truth: design-system/cornerstone-asset-recovery/MASTER.md
   Fonts: load in <head> (one request) —
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Sora:wght@500;600;700&display=swap">
   White-label: a partner org overrides only the "brand" tokens (--navy*, --gold*, --on-gold)
   plus --logo-url; every component reads tokens, so nothing else changes. */

/* ===== tokens: light (default) ===== */
:root {
  /* brand — identical in both themes */
  --navy:        #22315A;
  --navy-deep:   #16203A;
  --navy-light:  #2E4275;
  --gold:        #D9AC33;
  --gold-light:  #E6BE55;
  --logo-navy:   #132847;   /* logo artwork / print only */
  --logo-gold:   #C6A245;   /* logo artwork / print only */
  --on-navy:     #FFFFFF;
  --on-gold:     #16203A;   /* navy-deep on gold is 7.6:1; white on gold fails (2.1:1) */
  --gold-deep:   #A8871F;   /* gold as LARGE text (24px+) on light grounds: 3.4:1 on white */

  /* semantic — redefined for dark */
  --bg:          #F6F8FC;
  --bg-alt:      #EEF2FA;
  --surface:     #FFFFFF;
  --ink:         #0D141A;
  --muted:       #56585E;
  --border:      #DDE3EE;
  --heading:     #16203A;
  --link:        #22315A;
  --gold-ink:    #806512;   /* gold as small text on light grounds — 4.9:1+ on bg/surface/bg-alt */
  --focus:       #22315A;
  --success:     #16A34A;
  --warning:     #D97706;
  --danger:      #DC2626;

  /* type */
  --font-display: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui:      "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tracking-display: -0.045em;   /* Sora needs tight tracking at large sizes */
  --tracking-heading: -0.03em;

  /* space (name = px) */
  --space-4: 4px;  --space-8: 8px;   --space-16: 16px; --space-24: 24px;
  --space-32: 32px; --space-40: 40px; --space-64: 64px; --space-100: 100px;

  /* radius */
  --radius-field: 8px;
  --radius-input: 10px;
  --radius-card:  12px;
  --radius-pill:  999px;

  /* shadow */
  --shadow:      0 4px 24px rgba(34, 49, 90, 0.10);
  --shadow-lg:   0 12px 48px rgba(34, 49, 90, 0.16);
  --shadow-gold: 0 6px 20px rgba(217, 172, 51, 0.35);

  --logo-url: url("/logo.png?v=2");

  /* legacy aliases used by existing portal/*.html pages */
  --navy-d:   var(--navy-deep);
  --navy-l:   var(--navy-light);
  --gold-l:   var(--gold-light);
  --bg2:      var(--bg-alt);
  --light-bg: var(--bg);
  --light:    var(--bg);
  --footer:   var(--navy-deep);
  --text:     var(--ink);
  --white:    #FFFFFF;
  --font-h:   var(--font-display);
  --font-b:   var(--font-body);
  --radius:   var(--radius-card);
}

/* ===== tokens: dark (app surfaces; opt in with data-theme="dark" or follow the OS) ===== */
@media (prefers-color-scheme: dark) {
  :root[data-theme-auto]:not([data-theme="light"]) {
    --bg: #0B1222; --bg-alt: #111A2E; --surface: #16203A;
    --ink: #EEF2FA; --muted: #A9B4CA; --border: #2A3A63;
    --heading: #F1F4FA; --link: #E6BE55; --gold-ink: #E6BE55; --gold-deep: #E6BE55; --focus: #E6BE55;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.40); --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.50);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1222; --bg-alt: #111A2E; --surface: #16203A;
  --ink: #EEF2FA; --muted: #A9B4CA; --border: #2A3A63;
  --heading: #F1F4FA; --link: #E6BE55; --gold-ink: #E6BE55; --gold-deep: #E6BE55; --focus: #E6BE55;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.40); --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.50);
  color-scheme: dark;
}

/* === components === */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.cs-base, body.cs-base {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.cs-ui { font-family: var(--font-ui); font-size: 14px; line-height: 1.45; }
.cs-ui .num, .num { font-variant-numeric: tabular-nums; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- section header: eyebrow + title + sub --- */
.eyebrow {
  display: inline-block; font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--gold-ink); margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display); font-size: 42px; line-height: 1.1; font-weight: 600;
  letter-spacing: var(--tracking-display); color: var(--heading); margin: 0 0 16px; text-wrap: balance;
}
.section-title em { font-style: normal; color: var(--gold-deep); }
.section-sub { font-size: 18px; line-height: 1.6; font-weight: 400; color: var(--muted); max-width: 580px; margin: 0; }

/* --- buttons (pill) --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 28px; border-radius: var(--radius-pill); border: 1.5px solid transparent;
  font-family: var(--font-body); font-size: 15px; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 10px 20px; font-size: 14px; }
.btn-gold { background: var(--gold); color: var(--on-gold); box-shadow: var(--shadow-gold); }
.btn-gold:hover { background: var(--gold-light); }
.btn-primary { background: var(--navy); color: var(--on-navy); }
.btn-primary:hover { background: var(--navy-light); }
.btn-outline { background: transparent; color: var(--heading); border-color: var(--heading); }
.btn-outline:hover { background: var(--bg-alt); }
.btn-ghost { background: transparent; color: #FFFFFF; border-color: rgba(255, 255, 255, 0.55); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.08); }
@media (prefers-reduced-motion: reduce) { .btn, .card { transition: none; } .btn:hover, .card:hover { transform: none; } }

/* --- cards --- */
.card {
  background: var(--surface); border-radius: var(--radius-card); padding: 36px 32px;
  border: 1px solid var(--border);
  transition: border-color .25s, transform .25s, box-shadow .25s;
}
.card-link:hover { border-color: var(--gold); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--heading); margin: 0 0 8px; }
.card-desc { font-size: 15.5px; line-height: 1.65; color: var(--muted); margin: 0; }

/* stat card (dashboard) */
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px 18px; font-family: var(--font-ui);
}
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--heading); font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* --- form field --- */
.field { display: grid; gap: 6px; font-family: var(--font-ui); }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-field);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(34, 49, 90, 0.15);
}
.field .hint { font-size: 12.5px; color: var(--muted); }
.field.error input { border-color: var(--danger); }
.field.error .hint { color: var(--danger); }

/* --- table --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: 14px; }
.table th {
  background: var(--navy); color: var(--on-navy); text-align: left; padding: 12px 16px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.table td { padding: 12px 16px; border-top: 1px solid var(--border); color: var(--ink); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover td { background: var(--bg-alt); }

/* --- badge (status pill: dot + label; color never carries meaning alone) --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; line-height: 1.5;
  color: var(--ink); background: var(--surface); border: 1px solid var(--border); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge-success::before { background: var(--success); }
.badge-warning::before { background: var(--warning); }
.badge-danger::before  { background: var(--danger); }
.badge-gold::before    { background: var(--gold); }
.badge-navy::before    { background: var(--navy-light); }

/* --- nav (sticky, frosted) --- */
.nav {
  position: sticky; top: 0; z-index: 50; height: 72px; display: flex; align-items: center;
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav-logo img { height: 44px; width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 28px; font-weight: 500; }
.nav-links a { color: var(--muted); font-size: 15px; text-decoration: none; transition: color .2s; }
.nav-links a:hover { color: var(--heading); }
.nav-links a.btn-gold, .nav-links a.btn-gold:hover { color: var(--on-gold); }
@media (max-width: 768px) { .nav-inner { padding: 0 16px; } .nav-links a:not(.btn) { display: none; } }

/* --- layout helpers --- */
.container { max-width: 1100px; margin: 0 auto; padding-inline: 40px; }
@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  .section-title { font-size: 32px; }
  .card { padding: 26px 22px; }
}
