/* Frontline CDL recruiter desk.
   Direction: calm, precise work queue. Cool neutrals, one accent, status colors only for status.
   Shape rule: containers 12px, controls and chips 8px. Weights: 400, 500, 600.
   Type: system stack on purpose (no font download); swap --font-sans to change the voice. */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eff1f4;
  --line: #e2e5ea;
  --line-strong: #c9ced6;
  --ink: #14171c;
  --ink-2: #444c59;
  --ink-3: #636b79;

  --accent: #2457d6;
  --on-accent: #ffffff;
  --accent-tint: #e8eefc;
  --accent-text: #1b44a8;

  --danger-text: #b42318;
  --danger-tint: #fdecea;
  --danger-line: #f4c7c2;
  --warn-text: #7a4f00;
  --warn-tint: #fff2d1;
  --calm-text: #475063;
  --calm-tint: #e9ecf1;

  --r-lg: 12px;
  --r-md: 8px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #151a21;
    --surface-2: #1c222b;
    --line: #262d38;
    --line-strong: #394252;
    --ink: #e8ebf0;
    --ink-2: #b0b8c5;
    --ink-3: #8c95a4;

    --accent: #86a2f6;
    --on-accent: #0b1220;
    --accent-tint: #1b2a4d;
    --accent-text: #adc0fa;

    --danger-text: #ff9a90;
    --danger-tint: #3a1d1d;
    --danger-line: #5a2b2b;
    --warn-text: #f5c86a;
    --warn-tint: #3a2f14;
    --calm-text: #aab3c2;
    --calm-tint: #232a35;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 30;
  background: var(--surface); padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
}
.skip-link:focus { top: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color 150ms var(--ease), transform 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { cursor: progress; opacity: 0.6; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; letter-spacing: -0.01em; text-decoration: none; display: inline-flex; align-items: baseline; gap: 10px; }
.brand-sub { font-weight: 400; color: var(--ink-3); font-size: 14px; }
.who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }

/* Page */
.page { max-width: 1080px; margin: 0 auto; padding: 36px 24px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; }
.page-sub { color: var(--ink-3); font-size: 14px; margin-top: 6px; }
.updated { color: var(--ink-3); font-size: 13px; white-space: nowrap; }

/* Summary strip: one container, hairline dividers, no nested cards */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.stat { padding: 18px 22px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-num { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.stat.is-problem .stat-num { color: var(--danger-text); }

/* Sections */
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.count { color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.section-note { color: var(--ink-3); font-size: 14px; margin-left: auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip-danger { background: var(--danger-tint); color: var(--danger-text); }
.chip-warn { background: var(--warn-tint); color: var(--warn-text); }
.chip-calm { background: var(--calm-tint); color: var(--calm-text); }
.chip-accent { background: var(--accent-tint); color: var(--accent-text); }

/* Heat: four bars + a word, so urgency never depends on color alone */
.heat { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.heat i { display: block; width: 3px; border-radius: 1px; background: currentColor; opacity: 0.25; }
.heat i:nth-child(1) { height: 5px; } .heat i:nth-child(2) { height: 8px; }
.heat i:nth-child(3) { height: 10px; } .heat i:nth-child(4) { height: 12px; }
.heat i.on { opacity: 1; }

/* Attention rows */
.attn { display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 16px 20px; }
.attn-name { font-weight: 500; }
.attn-detail { color: var(--ink-2); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.attn-hint { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.attn-when { color: var(--ink-3); font-size: 14px; white-space: nowrap; padding-top: 2px; }

/* Call back rows */
.row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 176px auto; gap: 16px; align-items: center;
  padding: 16px 20px;
  transition: opacity 200ms var(--ease), height 260ms var(--ease), padding 260ms var(--ease), border-width 260ms var(--ease), background-color 150ms var(--ease);
}
.row:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.row.is-leaving, .row.is-entering { opacity: 0; padding-top: 0; padding-bottom: 0; border-top-width: 0; overflow: hidden; pointer-events: none; }
.name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.name { font-weight: 600; letter-spacing: -0.005em; }
.faint { color: var(--ink-3); font-size: 14px; }
.phone { display: inline-block; margin-top: 2px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.phone:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.also { margin-left: 12px; color: var(--ink-3); font-size: 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.facts .k { color: var(--ink-3); margin-right: 5px; }
.note { margin-top: 6px; font-size: 14px; color: var(--ink-2); background: var(--surface-2); padding: 6px 10px; border-radius: var(--r-md); overflow-wrap: anywhere; }
.when-label { color: var(--ink-3); font-size: 13px; }
.when-value { font-weight: 500; font-variant-numeric: tabular-nums; }
.when-value.is-late { color: var(--danger-text); }
.when-value.is-none { color: var(--ink-3); font-weight: 400; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.seg button { min-height: 38px; padding: 0 14px; border: 0; background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color 150ms var(--ease); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { background: var(--surface-2); }
.seg button:active { background: var(--line); }
.seg button[disabled] { cursor: progress; opacity: 0.55; }
.seg button:focus-visible { position: relative; }

/* States */
.empty { padding: 40px 24px; }
.empty-title { font-weight: 600; font-size: 17px; }
.empty-body { color: var(--ink-3); margin-top: 4px; max-width: 46ch; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border: 1px solid var(--danger-line); background: var(--danger-tint); color: var(--danger-text); border-radius: var(--r-lg); margin-bottom: 24px; }
.skeleton { height: 76px; position: relative; overflow: hidden; }
.skeleton + .skeleton { border-top: 1px solid var(--line); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-2) 90%, transparent), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Toast */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 40; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg); padding: 10px 10px 10px 16px; border-radius: var(--r-md); font-size: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); animation: rise 240ms var(--ease); }
.toast .btn { min-height: 32px; background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.toast .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Applicant detail */
.name-link { text-decoration: none; }
.name-link:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.crumb { font-size: 14px; color: var(--ink-3); margin-bottom: 14px; }
.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.detail-sub { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; color: var(--ink-2); font-size: 15px; }
.detail-sub .phone { margin: 0; font-size: 15px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin-top: 28px; align-items: start; }
.side-section + .side-section { border-top: 1px solid var(--line); margin-top: 26px; padding-top: 26px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; min-height: 34px; }
.btn-sm { min-height: 34px; padding: 0 12px; }
.call-row { padding: 16px 20px; }
.call-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.call-when { font-weight: 600; letter-spacing: -0.005em; }
.call-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.call-line { color: var(--ink-2); font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }
.profile { display: grid; }
.pf { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pf:last-child { border-bottom: 0; }
.pf .k { color: var(--ink-3); font-size: 14px; }
.pf .v { overflow-wrap: anywhere; }
.pf .input { min-height: 38px; font-size: 15px; padding: 0 10px; }
.pf select.input { padding-right: 6px; }
.pf-error { grid-column: 2; color: var(--danger-text); font-size: 13px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.help { color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.textarea { width: 100%; min-height: 92px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); resize: vertical; font-size: 15px; line-height: 1.45; }
.textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.seg button[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent-text); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.history li:last-child { border-bottom: 0; }
.history .who-did { color: var(--ink); font-weight: 500; }
.history .when-did { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.not-found { padding: 56px 0; }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 760px) {
  .detail-head { gap: 14px; }
  .detail-head .seg { width: 100%; }
  .call-row { padding: 14px 16px; }
  .pf { grid-template-columns: 96px minmax(0, 1fr); }
  .pf .input, .textarea { font-size: 16px; min-height: 44px; }
  .btn-sm { min-height: 44px; }
}

/* Call summary, recording player and transcript */
.call-summary { margin-top: 10px; color: var(--ink); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.disclose { margin-top: 12px; }
.listen { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.player { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.player .btn { min-width: 72px; }
.range { width: 100%; accent-color: var(--accent); height: 28px; cursor: pointer; }
.clock { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player-note { color: var(--ink-3); font-size: 14px; margin-top: 8px; }
.player-error { color: var(--danger-text); font-size: 14px; margin-top: 8px; }
.transcript { list-style: none; margin: 12px 0 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.tline { display: grid; grid-template-columns: 44px 56px minmax(0, 1fr); gap: 10px; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: transparent; font-size: 14px; line-height: 1.5; cursor: pointer; }
.tline[disabled] { cursor: default; }
.tline:hover:not([disabled]) { background: var(--surface-2); }
.tline.is-now { background: var(--accent-tint); }
.tline .t { color: var(--ink-3); font-family: var(--font-mono); font-size: 12px; padding-top: 2px; }
.tline .who { color: var(--ink-3); font-weight: 500; }
.tline .said { overflow-wrap: anywhere; }
.attn-audio { display: block; width: 100%; max-width: 420px; margin-top: 10px; height: 40px; }
.attn-summary { color: var(--ink-2); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .player { grid-template-columns: auto minmax(0, 1fr) auto; }
  .player .clock { grid-column: 2 / 4; grid-row: 2; }
  .tline { grid-template-columns: 40px minmax(0, 1fr); }
  .tline .who { display: none; }
}

/* Login */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 28px 24px; max-width: 1080px; margin: 0 auto; }
.auth-main { display: flex; align-items: center; }
.auth-card { width: 100%; max-width: 372px; }
.auth h1 { font-size: 34px; }
.auth-lede { color: var(--ink-2); margin-top: 10px; max-width: 34ch; }
.form { margin-top: 32px; display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.input-wrap { position: relative; }
.input { width: 100%; min-height: 46px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.input:hover { border-color: var(--ink-3); }
.input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger-text); }
.reveal { position: absolute; right: 6px; top: 6px; min-height: 34px; padding: 0 10px; font-size: 14px; }
.form-error { color: var(--danger-text); font-size: 14px; min-height: 21px; }
.auth .btn-primary { min-height: 48px; font-size: 16px; }
.auth-foot { color: var(--ink-3); font-size: 14px; }

/* Phone */
@media (max-width: 760px) {
  .topbar-inner, .page { padding-left: 16px; padding-right: 16px; }
  .page { padding-top: 24px; }
  h1 { font-size: 28px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px 16px; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .section-note { display: none; }
  .attn { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 14px 16px; }
  .attn-when { order: 3; padding-top: 0; }
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "heat when" "main main" "act act"; gap: 12px; padding: 16px; }
  .row .c-heat { grid-area: heat; }
  .row .c-when { grid-area: when; text-align: right; }
  .row .c-main { grid-area: main; }
  .row .c-act { grid-area: act; }
  .row .seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .detail-head .seg { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .detail-head .seg button { padding: 0 6px; }
  .seg button { min-height: 46px; }
  .btn, .reveal { min-height: 44px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .brand-sub, .who .mono { display: none; }
  .auth .btn-primary { min-height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
