/* ═══════════════════════════════════════════════════════════════════════════
   agent2hire.ai — design system
   ───────────────────────────────────────────────────────────────────────────
   Single source of truth for colour, type, spacing, radius and elevation.

   THEMING
   Every colour is a token, and every token is redefined under
   [data-theme="dark"]. Nothing else in the app needs to know a theme exists:
   a template that reads var(--surface) is already dark-mode correct. The
   corollary is the rule to follow when editing any template — never write a
   raw hex for a surface, a border or body text. Reach for the token.

   Theme resolution, in order:
     1. data-theme on <html>, written by the toggle (persisted, see theme.js)
     2. the OS preference, via prefers-color-scheme
     3. light

   BRAND (fixed by the logo package — do not drift)
     ink        #0F1720
     teal       #0E9384 on light  ·  #2AC0AD on dark
     grey       #8593A0
   The teal genuinely changes value between themes: #0E9384 is too dark to
   read on an ink field and #2AC0AD is too light to read on white. That is why
   --accent is a token and not a constant.

   Load order in every template:
     1. fonts
     2. design-system.css   <- this file
     3. page-specific <style>
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* ── Brand constants — identical in both themes ────────────────────────── */
  --ink:            #0F1720;
  --brand-grey:     #8593A0;

  /* Mark. The tile is ink on light, but on a dark page an ink tile vanishes
     into the background — the supplied reversed lockup lifts it, so it is a
     token, not a constant. The nodes follow the same rule as --accent. */
  --mark-tile:      #0F1720;
  --mark-face:      #FFFFFF;
  --mark-node:      #2AC0AD;

  /* ── Field ─────────────────────────────────────────────────────────────── */
  --bg:             #F5F7F8;   /* page background */
  --surface:        #FFFFFF;   /* cards, inputs, menus */
  --surface-sunk:   #EDF1F3;   /* wells, table stripes, disabled */
  --surface-raised: #FFFFFF;   /* popovers — separates from --surface on dark */
  --panel:          #0F1720;   /* the ink nav rail, both themes */

  /* ── Text ──────────────────────────────────────────────────────────────── */
  --text:           #0F1720;
  --text-2:         #55636E;
  --text-3:         #8593A0;
  --text-on-dark:   #E9EFF2;
  --text-on-dark-2: #A6B4BE;

  /* ── Lines ─────────────────────────────────────────────────────────────── */
  --line:           #E3E9EB;
  --line-strong:    #CBD5D8;
  --line-dark:      rgba(255, 255, 255, 0.10);

  /* ── Teal signal. Primary action and active state ONLY. ────────────────── */
  --accent:         #0E9384;
  --accent-deep:    #0B7A6E;   /* hover / pressed */
  --accent-wash:    rgba(14, 147, 132, 0.10);
  --accent-line:    rgba(14, 147, 132, 0.32);
  --on-accent:      #FFFFFF;   /* text ON a filled accent surface */

  /* ── Semantic. Distinct from teal so status never reads as a CTA. ──────── */
  --ok:             #15803D;  --ok-wash:     #DCFCE7;  --ok-line:     #86EFAC;
  --warn:           #B45309;  --warn-wash:   #FEF3C7;  --warn-line:   #FDE68A;
  --danger:         #B91C1C;  --danger-wash: #FEE2E2;  --danger-line: #FECACA;
  --info:           #1D4ED8;  --info-wash:   #DBEAFE;  --info-line:   #BFDBFE;

  /* ── Type ──────────────────────────────────────────────────────────────── */
  /* Poppins because the wordmark is Poppins SemiBold — headings and logo then
     share one voice. Inter for body and data: Poppins' wide geometric forms
     hurt legibility in dense dashboard tables, which is most of this app. */
  --font-display: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --t-eyebrow:  0.6875rem;  --t-xs:   0.75rem;    --t-sm:  0.8125rem;
  --t-base:     0.9375rem;  --t-md:   1.0625rem;  --t-lg:  1.375rem;
  --t-xl:       1.875rem;   --t-2xl:  2.5rem;     --t-3xl: 3.25rem;

  /* ── Spacing: 4px base ─────────────────────────────────────────────────── */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 64px;  --s-9: 96px;

  /* ── Radius ────────────────────────────────────────────────────────────── */
  --r-sm: 6px;  --r-md: 10px;  --r-lg: 16px;  --r-xl: 24px;  --r-pill: 999px;

  /* ── Elevation. Ink-tinted, not neutral grey. ──────────────────────────── */
  --sh-1: 0 1px 2px rgba(15, 23, 32, 0.06);
  --sh-2: 0 2px 8px rgba(15, 23, 32, 0.08);
  --sh-3: 0 8px 24px rgba(15, 23, 32, 0.10);
  --sh-4: 0 20px 48px rgba(15, 23, 32, 0.16);

  --focus: 0 0 0 3px rgba(14, 147, 132, 0.35);
  --ease:  cubic-bezier(0.22, 0.61, 0.36, 1);

  /* ── Compatibility aliases ─────────────────────────────────────────────── */
  /* Templates written before this file existed read these names. They are
     kept so nothing has to be touched twice, and they resolve to the tokens
     above — which means those templates theme correctly for free. */
  --paper: var(--bg);
  --navy: var(--panel);          --navy-d: #060C12;
  --slate: #1B2734;              --slate-soft: #2A3846;
  --border: var(--line);         --light: var(--surface-sunk);
  --muted: var(--text-2);        --d: var(--text);
  --orange: var(--accent);       --orange-d: var(--accent-deep);
  --gm-navy: var(--panel);       --gm-navy-d: #060C12;
  --gm-orange: var(--accent);    --gm-orange-d: var(--accent-deep);
  --gm-bg: var(--bg);            --gm-border: var(--line);
  --gm-text: var(--text);        --gm-muted: var(--text-2);
  --gm-light: var(--surface-sunk);
  --sh: var(--sh-2);             --r: var(--r-md);
  --h: var(--font-display);      --t: var(--font-body);
}

/* ═══ Dark theme ══════════════════════════════════════════════════════════ */
/* Surfaces step UP from the page, the way they do on paper: --bg is the
   darkest, cards sit above it. Inverting the light ramp instead (making cards
   darker than the page) is the usual mistake and it flattens the hierarchy. */

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:             #0B1219;
  --surface:        #141D26;
  --surface-sunk:   #0F1720;
  --surface-raised: #1B2530;
  --panel:          #0F1720;

  --text:           #E9EFF2;
  --text-2:         #A6B4BE;
  --text-3:         #8593A0;

  --line:           rgba(255, 255, 255, 0.10);
  --line-strong:    rgba(255, 255, 255, 0.18);

  --mark-tile:      #232E3A;
  --mark-face:      #FFFFFF;
  --mark-node:      #2AC0AD;

  --accent:         #2AC0AD;
  --accent-deep:    #4FD3C2;
  --accent-wash:    rgba(42, 192, 173, 0.14);
  --accent-line:    rgba(42, 192, 173, 0.38);
  /* Ink on bright teal, not white: white on #2AC0AD is about 2.4:1 and fails
     WCAG AA for text at every size. */
  --on-accent:      #06231F;

  --ok:     #4ADE80;  --ok-wash:     rgba(74, 222, 128, 0.14);  --ok-line:     rgba(74, 222, 128, 0.34);
  --warn:   #FBBF24;  --warn-wash:   rgba(251, 191, 36, 0.14);  --warn-line:   rgba(251, 191, 36, 0.34);
  --danger: #F87171;  --danger-wash: rgba(248, 113, 113, 0.14); --danger-line: rgba(248, 113, 113, 0.34);
  --info:   #60A5FA;  --info-wash:   rgba(96, 165, 250, 0.14);  --info-line:   rgba(96, 165, 250, 0.34);

  /* Shadows barely read on a dark field; lean on borders instead. */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.40);
  --sh-2: 0 2px 8px rgba(0, 0, 0, 0.45);
  --sh-3: 0 8px 24px rgba(0, 0, 0, 0.50);
  --sh-4: 0 20px 48px rgba(0, 0, 0, 0.60);

  --focus: 0 0 0 3px rgba(42, 192, 173, 0.45);

  --navy-d: #060C12;
  --slate: #1B2530;  --slate-soft: #263241;
  --gm-navy-d: #060C12;
}

/* Follow the OS when the user has not chosen. The block is a copy of the
   above rather than a shared selector list because :root:not([data-theme])
   inside a media query is the only form that lets an explicit light choice
   win over a dark OS setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0B1219;  --surface: #141D26;  --surface-sunk: #0F1720;
    --surface-raised: #1B2530;  --panel: #0F1720;
    --text: #E9EFF2;  --text-2: #A6B4BE;  --text-3: #8593A0;
    --line: rgba(255,255,255,0.10);  --line-strong: rgba(255,255,255,0.18);
    --mark-tile: #232E3A;
    --accent: #2AC0AD;  --accent-deep: #4FD3C2;
    --accent-wash: rgba(42,192,173,0.14);  --accent-line: rgba(42,192,173,0.38);
    --on-accent: #06231F;
    --ok: #4ADE80;  --ok-wash: rgba(74,222,128,0.14);  --ok-line: rgba(74,222,128,0.34);
    --warn: #FBBF24;  --warn-wash: rgba(251,191,36,0.14);  --warn-line: rgba(251,191,36,0.34);
    --danger: #F87171;  --danger-wash: rgba(248,113,113,0.14); --danger-line: rgba(248,113,113,0.34);
    --info: #60A5FA;  --info-wash: rgba(96,165,250,0.14);  --info-line: rgba(96,165,250,0.34);
    --sh-1: 0 1px 2px rgba(0,0,0,0.40);   --sh-2: 0 2px 8px rgba(0,0,0,0.45);
    --sh-3: 0 8px 24px rgba(0,0,0,0.50);  --sh-4: 0 20px 48px rgba(0,0,0,0.60);
    --focus: 0 0 0 3px rgba(42,192,173,0.45);
    --navy-d: #060C12;  --slate: #1B2530;  --slate-soft: #263241;
    --gm-navy-d: #060C12;
  }
}

/* ═══ Base ════════════════════════════════════════════════════════════════ */

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

html { background: var(--bg); }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

a { color: var(--accent); }

/* Form controls do not inherit the page font, and on dark they render with a
   white OS default background unless told otherwise. */
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* Keyboard focus is always visible. Mouse clicks don't get the ring. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-wash); color: var(--text); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid var(--bg);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

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

/* ═══ Brand lockup ════════════════════════════════════════════════════════ */
/* The mark is an <img> of mark.svg; the wordmark is live text so it stays
   crisp, selectable and translatable, and needs no second asset per theme. */

.a2h-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.a2h-lockup img,
.a2h-lockup .a2h-mark { display: block; flex-shrink: 0; }
.a2h-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;      /* per the brand sheet */
  text-transform: lowercase;
  color: var(--text);
  white-space: nowrap;
  line-height: 1;
}
.a2h-wordmark .n { color: var(--accent); }     /* the "2" */
/* On the ink nav rail the wordmark is always light, whatever the theme. */
.a2h-lockup.on-dark .a2h-wordmark { color: #FFFFFF; }
.a2h-lockup.on-dark .a2h-wordmark .n { color: #2AC0AD; }

/* ═══ Theme toggle ════════════════════════════════════════════════════════ */

.a2h-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease),
              background .18s var(--ease);
}
.a2h-theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-wash);
}
.a2h-theme-toggle.on-dark {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.16);
  color: #E9EFF2;
}
.a2h-theme-toggle.on-dark:hover {
  background: rgba(42,192,173,.18);
  border-color: rgba(42,192,173,.45);
  color: #2AC0AD;
}
/* One glyph per theme, swapped in CSS so the button needs no JS to redraw. */
.a2h-theme-toggle .i-sun  { display: none; }
.a2h-theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .a2h-theme-toggle .i-sun  { display: block; }
:root[data-theme="dark"] .a2h-theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .a2h-theme-toggle .i-sun  { display: block; }
  :root:not([data-theme="light"]):not([data-theme="dark"]) .a2h-theme-toggle .i-moon { display: none; }
}

/* ═══ Eyebrow — tracked caps label ════════════════════════════════════════ */

.ds-eyebrow {
  font-family: var(--font-display);
  font-size: var(--t-eyebrow);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ds-eyebrow-accent { color: var(--accent); }

/* ═══ Card ════════════════════════════════════════════════════════════════ */

.ds-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.ds-card-pad { padding: var(--s-5); }
.ds-dark {
  background: var(--panel);
  color: var(--text-on-dark);
  border-color: var(--line-dark);
}

/* ═══ Buttons ═════════════════════════════════════════════════════════════ */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  text-decoration: none;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), transform .18s var(--ease);
}
.ds-btn:active { transform: translateY(1px); }
.ds-btn:disabled, .ds-btn[disabled] {
  opacity: .55; cursor: not-allowed; transform: none;
}
.ds-btn-primary { background: var(--accent); color: var(--on-accent); }
.ds-btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.ds-btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--line-strong);
}
.ds-btn-secondary:hover:not(:disabled) {
  border-color: var(--accent-line); color: var(--accent); background: var(--accent-wash);
}
.ds-btn-ghost { background: transparent; color: var(--text-2); }
.ds-btn-ghost:hover:not(:disabled) { background: var(--surface-sunk); color: var(--text); }
.ds-btn-danger { background: var(--danger); color: #FFFFFF; }
.ds-btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.ds-btn-block { width: 100%; }

/* ═══ Fields ══════════════════════════════════════════════════════════════ */

.ds-field { display: block; margin-bottom: var(--s-4); }
.ds-label {
  display: block;
  margin-bottom: var(--s-2);
  font-family: var(--font-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text-2);
}
.ds-input {
  width: 100%;
  padding: 11px 14px;
  font-size: var(--t-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.ds-input::placeholder { color: var(--text-3); }
.ds-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}
.ds-input:disabled { background: var(--surface-sunk); color: var(--text-3); }
.ds-input-group { position: relative; }
.ds-input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.ds-input-group .ds-input-icon ~ .ds-input { padding-left: 40px; }
.ds-input-action {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 6px;
  color: var(--text-3); cursor: pointer;
}
.ds-input-action:hover { color: var(--accent); }

/* ═══ Badges ══════════════════════════════════════════════════════════════ */

.ds-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-display);
  font-size: var(--t-xs);
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.ds-badge-ok      { background: var(--ok-wash);     color: var(--ok);     border-color: var(--ok-line); }
.ds-badge-warn    { background: var(--warn-wash);   color: var(--warn);   border-color: var(--warn-line); }
.ds-badge-danger  { background: var(--danger-wash); color: var(--danger); border-color: var(--danger-line); }
.ds-badge-neutral { background: var(--surface-sunk); color: var(--text-2); border-color: var(--line); }

/* ═══ Messages ════════════════════════════════════════════════════════════ */

/* Hidden until something is actually said. login.html renders empty success
   and error boxes up front and reveals them with .show — dropping this rule in
   the rebrand left both banners on screen, permanently, with no text in them. */
.ds-msg {
  display: none;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--t-sm);
}
.ds-msg.show { display: flex; }
.ds-msg-success { background: var(--ok-wash);     color: var(--ok);     border-color: var(--ok-line); }
.ds-msg-warn    { background: var(--warn-wash);   color: var(--warn);   border-color: var(--warn-line); }
.ds-msg-error   { background: var(--danger-wash); color: var(--danger); border-color: var(--danger-line); }
.ds-msg-info    { background: var(--info-wash);   color: var(--info);   border-color: var(--info-line); }

/* ═══ Segmented control ═══════════════════════════════════════════════════ */

.ds-segment {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  gap: 2px;
}
.ds-segment-item {
  padding: 7px 16px;
  font-family: var(--font-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--text-2);
  background: none; border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.ds-segment-item[aria-selected="true"],
.ds-segment-item.on,
.ds-segment-item.is-active {
  background: var(--surface); color: var(--accent); box-shadow: var(--sh-1);
}

/* ═══ Utilities ═══════════════════════════════════════════════════════════ */

.ds-muted { color: var(--text-2); }
.ds-dim   { color: var(--text-3); }
.ds-stack-2 > * + * { margin-top: var(--s-2); }
.ds-stack-4 > * + * { margin-top: var(--s-4); }
.ds-stack-6 > * + * { margin-top: var(--s-6); }
.ds-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
