/* CareerBridge design system — "well-lit control room, midday".
   Bright instrument panel, navy-blue chronometer glow, one amber telltale.
   Single family (Archivo, variable), OKLCH tokens, restrained color strategy:
   cool near-white surfaces (a whisper of cool blue, never warm cream),
   deep navy for actions/selection, amber only as a rare status telltale.
   Loaded by base.html and injected into legacy pages. */

:root {
  /* Surfaces — cool near-neutrals tinted a whisper toward steel-blue (hue 240).
     Page is a light grey so the white panels read as raised instruments. */
  --bg: oklch(0.968 0.006 240);
  --surface: oklch(0.995 0.002 240);
  --surface-2: oklch(0.935 0.009 240);   /* press / hover fills, active nav */
  --border: oklch(0.90 0.008 240);
  --border-strong: oklch(0.83 0.012 240);

  /* Ink — deep cool slate, not pure black. */
  --ink: oklch(0.27 0.028 250);
  --muted: oklch(0.47 0.03 250);
  --faint: oklch(0.545 0.027 250);

  /* Navy blue — actions, selection, links. White text on fills (≥13:1). */
  --primary: oklch(0.31 0.115 258);        /* deep navy ≈ #002d69 */
  --primary-hover: oklch(0.38 0.12 258);   /* lifts (lightens) on hover */
  --primary-text: oklch(0.45 0.15 255);    /* links / active states on light */
  --primary-dim: oklch(0.45 0.15 255 / 0.12);

  /* Amber telltale — scores, highlights, one per view at most. Dark text on fills. */
  --accent: oklch(0.82 0.145 78);
  --accent-ink: oklch(0.32 0.06 66);

  /* Status */
  --ok: oklch(0.55 0.13 155);
  --danger: oklch(0.53 0.20 27);
  --danger-fill: oklch(0.55 0.21 27);

  --font: "Archivo", "Segoe UI", system-ui, sans-serif;

  --radius: 8px;
  --radius-lg: 14px;
  --nav-h: 56px;
  --shadow: 0 4px 16px oklch(0.45 0.03 245 / 0.10), 0 1px 3px oklch(0.45 0.03 245 / 0.08);

  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px oklch(0.45 0.15 255 / 0.55);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { text-wrap: balance; }

a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:is(a, button, input, select, textarea, summary):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius);
}

::selection { background: var(--primary); color: white; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Top nav ──────────────────────────────────────────────────────────────── */

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(16px, 4vw, 32px);
  background: oklch(0.99 0.004 240 / 0.80);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.nav-brand:hover { text-decoration: none; }
.nav-brand svg { display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 8px;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

.nav-spacer { flex: 1; }

/* Legacy pages: their body has `padding: 24px 16px` (often a centered flex
   column). Pull the injected nav back to full-bleed. */
.nav-flush {
  margin: -24px -16px 24px;
  align-self: stretch;
  width: calc(100% + 32px);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}
.nav-user .who { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.nav-user .role-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary-text);
}
.nav-user form { margin: 0; display: flex; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 600 14px/1.2 var(--font);
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary-text); color: var(--primary-text); }

.btn-quiet { background: transparent; color: var(--muted); padding: 9px 12px; }
.btn-quiet:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); }

.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font: 400 14px/1.4 var(--font);
  transition: border-color 160ms ease-out;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary-text);
}

.field .hint { font-size: 12.5px; color: var(--faint); }

/* Styled file picker — hides the native input behind an on-palette button and a
   filename readout. Markup: <label class="file-input"> input[type=file] +
   .file-input__btn + .file-input__name. Wired by /static/js/file-input.js. */
.file-input {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  max-width: 100%;
}
.file-input input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}
.file-input__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 600 13.5px/1 var(--font);
  white-space: nowrap;
  transition: border-color 160ms ease-out, color 160ms ease-out, background 160ms ease-out;
}
.file-input:hover .file-input__btn { border-color: var(--primary-text); color: var(--primary-text); }
.file-input input:focus-visible + .file-input__btn { box-shadow: var(--focus-ring); }
.file-input__btn svg { width: 15px; height: 15px; flex: none; }
.file-input__name {
  font-size: 13px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-input.has-file .file-input__name { color: var(--ink); font-weight: 500; }

.form-error {
  display: none;
  padding: 10px 12px;
  border: 1px solid oklch(0.53 0.20 27 / 0.35);
  border-radius: var(--radius);
  background: oklch(0.53 0.20 27 / 0.07);
  color: var(--danger);
  font-size: 13.5px;
  margin-bottom: 16px;
}
.form-error.show { display: block; }

/* ── Cards / panels ───────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* Data (scores, counts): lining tabular figures, no mono costume. */
.num { font-variant-numeric: tabular-nums lining-nums; }

/* ── Auth pages ───────────────────────────────────────────────────────────── */

.auth-shell {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

.auth-card { width: 100%; max-width: 400px; }

.auth-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}

.auth-card .sub { color: var(--muted); font-size: 14.5px; margin: 0 0 26px; }

.auth-alt {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* Role choice — two selectable cards. */
.role-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.role-choice input { position: absolute; opacity: 0; pointer-events: none; }
.role-choice label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}
.role-choice label:hover { border-color: var(--primary-text); }
.role-choice input:checked + label {
  border-color: var(--primary-text);
  background: var(--primary-dim);
}
.role-choice input:focus-visible + label { box-shadow: var(--focus-ring); }
.role-choice .role-name { font-weight: 650; font-size: 14.5px; color: var(--ink); }
.role-choice .role-desc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }

@media (max-width: 560px) {
  .nav { gap: 12px; }
  .nav-links { display: none; }
  .role-choice { grid-template-columns: 1fr; }
}
