/* AfterHours console: PREP-inspired surface, compact controls, accessible layouts. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f1f4f8;
  --fg: #192333;
  --muted: #637083;
  --line: #dce2eb;
  --accent: #2458a6;
  --accent-soft: #e9f0ff;
  --accent-contrast: #ffffff;
  --ls: #b42334;
  --em: #a65708;
  --ns: #866317;
  --rt: #16804b;
  --shadow: 0 2px 12px rgba(31, 45, 65, .035);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141a23;
    --surface: #1c2531;
    --surface-alt: #253140;
    --fg: #eef2f7;
    --muted: #abb8c9;
    --line: #354353;
    --accent: #a4c6ff;
    --accent-soft: #253a58;
    --accent-contrast: #142033;
    --ls: #ff8c9b;
    --em: #ffbe79;
    --ns: #f4d486;
    --rt: #82dfad;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--accent); }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--fg); text-decoration: none; font-size: 17px; font-weight: 750; padding: 4px 9px; }
.brand-icon { display: block; flex: none; width: 34px; height: 34px; border-radius: 8px; } /* Apex Flow V1 app icon */
.brand small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; font-weight: 500; }
.nav-label { padding: 0 12px; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .13em; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a { display: flex; align-items: center; gap: 10px; color: var(--muted); text-decoration: none; border-radius: 7px; padding: 10px 12px; font-weight: 550; }
.side-nav a:hover { background: var(--surface-alt); color: var(--fg); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 720; }
.side-nav .nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.side-nav a[aria-current="page"] .nav-dot { background: var(--accent); }
.side-note { border-top: 1px solid var(--line); margin-top: auto; padding: 16px 12px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 12px clamp(16px, 3vw, 34px); min-height: 66px; }
.top-title { font-weight: 720; font-size: 16px; letter-spacing: -.01em; }
.top-title small { display: block; font-size: 11px; color: var(--muted); font-weight: 450; }
.account { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user { font-size: 13px; font-weight: 650; }
.status { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 11px; color: var(--muted); background: var(--surface-alt); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 100%; background: var(--rt); }
.banner { background: var(--accent-soft); border-bottom: 1px solid var(--line); color: var(--fg); padding: 9px clamp(16px,3vw,34px); font-size: 12px; }
main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px clamp(16px,3vw,34px) 60px; flex: 1; }
main > h1 { margin-top: 0; }
h1 { font-size: 25px; line-height: 1.2; letter-spacing: -.035em; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 11px; letter-spacing: -.01em; }
h3 { margin: 12px 0 8px; }
p { margin: 6px 0 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 19px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card p:last-child { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); gap: 18px; }
.grid > * { min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.kpi { padding: 17px; margin: 0; }
.kpi-label { display: block; color: var(--muted); font-weight: 560; font-size: 12px; }
.kpi-value { display: block; font-size: 28px; line-height: 1.25; letter-spacing: -.04em; margin: 7px 0 2px; font-weight: 760; font-variant-numeric: tabular-nums; }
.kpi-caption { color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(270px,.8fr); gap: 16px; }
.dashboard-grid > * { min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 0 0 13px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 12px; }
.quick-link { display: flex; gap: 12px; align-items: center; justify-content: space-between; text-decoration: none; color: var(--fg); padding: 11px 0; border-top: 1px solid var(--line); }
.quick-link span { color: var(--accent); }
.quick-link:hover { color: var(--accent); text-decoration: none; }
.page-intro { color: var(--muted); margin: -4px 0 16px; }
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { text-align: left; padding: 10px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 680; color: var(--muted); white-space: nowrap; font-size: 11px; letter-spacing: .035em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-alt); }
.muted { color: var(--muted); }
.tag { display: inline-block; border: 1px solid currentColor; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 690; white-space: nowrap; }
.LIFE_SAFETY { color: var(--ls); }.EMERGENCY { color: var(--em); }.NEXT_SLOT { color: var(--ns); }.ROUTINE { color: var(--rt); }
.pass { color: var(--rt); }.fail { color: var(--ls); }
form.inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
input, select, textarea { padding: 10px 12px; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; max-width: 100%; }
input[type=text] { flex: 1; min-width: 180px; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 5px; }
label input { margin-top: 5px; }
button { padding: 9px 14px; font: inherit; font-weight: 640; border-radius: 7px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-contrast); cursor: pointer; }
button:hover { filter: brightness(.95); }
button.secondary { border-color: var(--line); background: var(--surface); color: var(--fg); }
button.secondary:hover { background: var(--surface-alt); }
form.signout { margin: 0; }
form.signout button { padding: 6px 10px; }
.msg { padding: 10px 13px; margin: 8px 0; border-radius: 9px; max-width: 94%; overflow-wrap: anywhere; }
.assistant { background: var(--accent-soft); }.caller { margin-left: auto; text-align: right; background: var(--surface-alt); }
pre.msgbody { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 ui-monospace, monospace; }
code { font-size: 12px; overflow-wrap: anywhere; }
footer { padding: 12px clamp(16px,3vw,34px) 20px; color: var(--muted); font-size: 11px; text-align: right; }
footer a { color: var(--muted); }
.login-shell { grid-template-columns: minmax(0,1fr); }
.login-shell .workspace { min-height: 100vh; }
.login-shell main { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 520px; }
.login-shell main > h1 { align-self: stretch; }
.login-shell main > .fail { align-self: stretch; }
.signin-card { width: 100%; padding: 25px; }
.signin-card input { width: 100%; }
.signin-card button[type=submit] { width: 100%; margin-top: 14px; }
.pw-field { display: block; position: relative; }
.pw-field input { box-sizing: border-box; width: 100%; padding-right: 52px; }
.pw-field .pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--muted); border: 0; }
.pw-eye svg { width: 20px; height: 20px; }
.pw-eye .pw-eye-off, .pw-eye[aria-pressed="true"] .pw-eye-on { display: none; }
.pw-eye[aria-pressed="true"] .pw-eye-off { display: block; }
.pw-eye:hover { background: var(--surface-alt); color: var(--fg); filter: none; }
/* REQ-028: voice call look. A call is speech, so every page says so. */
.msg-who { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.voice-note { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; margin: 0 0 16px; }
.mic { flex: none; display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); position: relative; margin-top: 2px; }
.mic::after { content: ""; position: absolute; left: 6px; top: 3px; width: 6px; height: 9px; border-radius: 3px; background: var(--accent-contrast); }
.mic.big { width: 34px; height: 34px; }
.mic.big::after { left: 12px; top: 7px; width: 10px; height: 15px; border-radius: 5px; }
.voice-explainer { display: flex; gap: 14px; align-items: flex-start; border-left: 4px solid var(--accent); }
.demo-pick { display: flex; gap: 14px; text-decoration: none; color: var(--fg); }
.demo-pick > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.demo-pick:hover { border-color: var(--accent); text-decoration: none; }
.call-head { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.live-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--muted); flex: none; }
.voice-demo.playing .live-dot { background: #e5484d; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.6); } 70% { box-shadow: 0 0 0 9px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }
.call-timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.call-route { color: var(--muted); font-size: 12px; margin: 4px 0 12px; }
.voice-stage { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-alt); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.speaker-pill { font-weight: 700; font-size: 12px; border-radius: 999px; padding: 4px 10px; background: var(--surface); border: 1px solid var(--line); min-width: 150px; text-align: center; }
.speaker-pill.ayme { color: var(--accent); border-color: var(--accent); }
.speaker-pill.caller { color: var(--rt); border-color: var(--rt); }
.wave { display: flex; align-items: center; gap: 3px; height: 34px; flex: 1; min-width: 120px; }
.wave span { flex: 1; max-width: 6px; height: 4px; border-radius: 3px; background: var(--line); transition: height .12s; }
.wave.ayme span, .wave.caller span { animation: talk .9s ease-in-out infinite; }
.wave.ayme span { background: var(--accent); }
.wave.caller span { background: var(--rt); }
.wave span:nth-child(3n) { animation-delay: -.3s; } .wave span:nth-child(3n+1) { animation-delay: -.6s; }
.wave span:nth-child(4n) { animation-duration: .7s; } .wave span:nth-child(5n) { animation-duration: 1.1s; }
@keyframes talk { 0%, 100% { height: 5px; } 50% { height: 30px; } }
.latency { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.call-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.call-controls[hidden] { display: none; }
.toggle { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 550; }
.toggle select { padding: 6px 8px; }
.vturns { list-style: none; padding: 0; margin: 0; }
.vturn { padding: 9px 12px; margin: 8px 0; border-radius: 10px; max-width: 92%; }
.vturn.ayme { background: var(--accent-soft); }
.vturn.caller { background: var(--surface-alt); margin-left: auto; }
.vturn.system { max-width: 100%; text-align: center; color: var(--muted); font-size: 12px; background: none; border: 1px dashed var(--line); }
.vturn.waiting { display: none; }
.vwho { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.vturn.system .vwho { display: none; }
.vtext { margin: 2px 0 4px; }
.vturn.hearing .vtext { color: var(--muted); font-style: italic; }
.vturn.hearing .vwho::after { content: " · hearing…"; color: var(--rt); }
.vturn.speaking .vwho::after { content: " · speaking…"; color: var(--accent); }
.vmeta { display: flex; flex-wrap: wrap; gap: 6px; }
.vturn.hearing .vmeta, .vturn.speaking .vmeta { visibility: hidden; }
.chip { font-size: 10.5px; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); background: var(--surface); }
.chip.warn { color: var(--em); border-color: var(--em); }
.tag.HOT { color: #e5484d; }
dl.lead { margin: 0; }
.lead-row { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lead-row:last-child { border-bottom: 0; }
.lead-row dt { color: var(--muted); font-size: 12px; font-weight: 650; }
.lead-row dd { margin: 0; font-weight: 600; }
.lead-row.empty dd { color: var(--muted); font-weight: 400; }
.lead-row.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.handoff[hidden] { display: none; }
.handoff { border-left: 4px solid #e5484d; }
pre.sms { background: var(--surface-alt); border-radius: 10px; padding: 10px 12px; }
.pipeline { padding-left: 20px; margin: 0 0 10px; }
.pipeline li { margin: 4px 0; }
@media (prefers-reduced-motion: reduce) { .wave span, .live-dot, .lead-row.fresh { animation: none !important; } }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; gap: 5px; }
  .sidebar .brand { padding: 4px; }
  .nav-label, .side-note { display: none; }
  .side-nav { display: flex; flex-direction: row; overflow-x: auto; white-space: nowrap; gap: 4px; }
  .side-nav a { padding: 8px 11px; }
  .side-nav .nav-dot { display: none; }
  .topbar { padding: 12px 16px; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .kpis { gap: 8px; }
  .card { padding: 14px; }
  .kpi-value { font-size: 23px; }
  .status { display: none; }
  .topbar { min-height: 54px; }
  main { padding-top: 20px; }
  td, th { padding: 9px 6px; }
  .login-shell .topbar { justify-content: center; }
}
