/* The wallboard's own small stylesheet. One accent, everything else mixed from
   it, dark by default — so it reads as part of the product without pulling in
   the console's whole kit. The accent is stamped onto :root by the page from a
   value the server supplies, defaulting to the tenant's own. */
:root {
  --accent: #e2005a;
  --bg: #0e1014;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a2f3a;
  --text: #e8eaed;
  --dim: #9aa0ac;
  --ok: #33c27f;
  --warn: #e6b23a;
  --bad: #e5484d;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: 15px; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login form {
  background: var(--panel); padding: 32px; border-radius: var(--radius);
  box-shadow: var(--shadow); width: 320px; display: flex; flex-direction: column; gap: 14px;
}
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login .sub { color: var(--dim); font-size: 13px; margin: 0; }
.login input {
  padding: 11px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font-size: 15px;
}
.login .err { color: var(--bad); font-size: 13px; min-height: 16px; margin: 0; }
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 16px; font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* shell */
header {
  display: flex; align-items: center; gap: 18px; padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
header .brand { font-weight: 700; font-size: 17px; }
header .brand b { color: var(--accent); }
nav { display: flex; gap: 4px; margin-left: 8px; }
nav button {
  background: transparent; border: 0; color: var(--dim); padding: 8px 14px;
  border-radius: 8px; font-weight: 600;
}
nav button.on { background: var(--panel-2); color: var(--text); }
nav button .badge {
  background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px;
  padding: 1px 7px; margin-left: 6px; font-weight: 700;
}
header .spacer { flex: 1; }
header .clock { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 13px; }
/* Wide enough for the call log's nine columns. It was 1200, which forced the
   history table into horizontal scrolling — and a table you have to scroll
   sideways is one where the outcome and the recording are off-screen, which is
   most of why somebody opens it. */
main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.hidden { display: none !important; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card {
  background: var(--panel); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card .n { font-size: 30px; font-weight: 700; line-height: 1; }
.card .l { color: var(--dim); font-size: 13px; margin-top: 6px; }
.card.accent .n { color: var(--accent); }
.card.ok .n { color: var(--ok); }
.card.warn .n { color: var(--warn); }
.card.bad .n { color: var(--bad); }

/* panels & tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.panel h2 { margin: 0; padding: 14px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.panel .empty { padding: 24px 16px; color: var(--dim); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
/* The two columns that carry names. A long name is allowed to take a second
   line rather than push the whole table sideways. */
td.wrap, th.wrap { white-space: normal; max-width: 210px; }
th { color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }

/* agent grid */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 16px; }
.agent { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 10px 12px; border-radius: 10px; }
.agent .dot { width: 10px; height: 10px; border-radius: 999px; flex: none; }
.agent .who { overflow: hidden; }
.agent .who .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .who .ext { color: var(--dim); font-size: 12px; }
.dot.on-call { background: var(--accent); }
/* Ringing pulses, because it is the one state a supervisor is meant to ACT on:
   a phone nobody has picked up. A still dot reads as another resting state. */
.dot.ringing { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.dot.paused { background: #8e7cc3; }
.dot.ready { background: var(--ok); }
.dot.offline { background: #4a505c; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.25 } }
@media (prefers-reduced-motion: reduce) { .dot.ringing { animation: none } }

/* team headings */
.panel h2 { display: flex; align-items: center; gap: 10px; }
.tally { display: flex; gap: 8px; margin-left: auto; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel-2); border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.chip .dot { width: 8px; height: 8px; border-radius: 999px; }
.note { margin: 0; padding: 10px 16px 0; color: var(--dim); font-size: 13px; }
.note + .scroll table { margin-top: 8px; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.answered { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.pill.missed { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.pill.busy, .pill.failed { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.pill.in { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.pill.out { background: var(--panel-2); color: var(--dim); }
.pill.internal { background: var(--panel-2); color: var(--dim); }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.filters select, .filters input {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px;
}
.filters .grow { flex: 1; min-width: 140px; }

/* by-hour bars */
.hours { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 16px; }
.hours .h { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.hours .h .bar { width: 100%; border-radius: 2px 2px 0 0; min-height: 1px; }
.hours .h .bar.ans { background: var(--ok); }
.hours .h .bar.mis { background: var(--bad); }
.hours .h .bar.made { background: color-mix(in srgb, var(--accent) 60%, transparent); }
.hours .h .lbl { color: var(--dim); font-size: 9px; text-align: center; margin-top: 4px; }

/* the play control in a history row */
/* The recording cell only ever holds a small button now — the player opens in
   a row of its own below — so this column can be narrow again and give the
   width back to the columns that carry names. */
th.rec, td.rec { width: 120px; min-width: 120px; }

/* The player's own row, spanning the table.
   The scrubber gets the WHOLE row at every width — which is the entire point of
   moving it out of the cell. Sharing the line with a caption and two buttons
   put it back to 423px on a laptop, and seeking is a matter of pixels per
   second: at 423px a four-minute call is half a second per pixel, at full width
   it is a tenth of that. So the caption sits above it and the bar spans. */
.player-row td { background: var(--panel-2); padding: 12px 16px; }
.player { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.player audio { flex: 1 0 100%; order: 2; height: 40px; min-width: 0; }
.player-who { font-size: 13px; margin-right: auto; }
.player .iconbtn { flex: none; text-decoration: none; }

/* voicemail */
.vm-row td .play { display: flex; align-items: center; gap: 8px; }
.vm-row audio { height: 34px; }
.iconbtn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; color: var(--text); font-size: 13px; }
.iconbtn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
tr.unheard td:first-child { border-left: 3px solid var(--accent); }
.muted { color: var(--dim); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); }
