:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a313c;
  --text: #e6edf3;
  --dim: #8b97a6;
  --accent: #3fb950;
  --accent-dim: #1f6f2e;
  --ring: #e3b341;
  --alert: #f85149;
  --blue: #58a6ff;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
}

header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: -0.2px; }
header .sub { color: var(--dim); font-size: 13px; }
header .spacer { flex: 1; }

.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--dim); }

.signout {
  color: var(--dim); font-size: 13px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 11px;
  margin-left: 6px; transition: color .12s, border-color .12s;
}
.signout:hover { color: var(--text); border-color: var(--dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--alert); }
.dot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

main { max-width: 1320px; margin: 0 auto; padding: 22px; }

.layout { display: grid; grid-template-columns: 1fr 268px; gap: 26px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.col-side .hint { color: var(--dim); font-size: 13px; margin: -4px 0 12px; }

/* ---------- agent sidebar ---------- */
.agent {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 7px;
  transition: border-color .12s, background .12s, transform .12s;
}
.agent .adot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.agent.idle .adot { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.agent.ringing .adot { background: var(--ring); animation: blink .8s infinite; }
.agent[class*="in-use"] .adot, .agent.busy .adot { background: var(--alert); }
.agent.unavailable { opacity: .45; }
.agent .aname { font-weight: 600; font-size: 14px; }
.agent .aext { color: var(--dim); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }

@keyframes blink { 50% { opacity: .25; } }

.agent.drop {
  border-color: var(--blue); background: rgba(88,166,255,.12);
  transform: translateX(-3px);
}

/* ---------- transfer buttons on the call card ---------- */
.xfer { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.xfer .lbl { font-size: 12px; color: var(--dim); margin-bottom: 7px; }
.xfer-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.xfer-btns button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 5px 11px; cursor: pointer; font-size: 13px;
  font-family: var(--font);
}
.xfer-btns button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.xfer-btns button:disabled { opacity: .35; cursor: not-allowed; }
.xfer-btns button .bd {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dim); margin-right: 6px; vertical-align: middle;
}
.xfer-btns button.idle .bd { background: var(--accent); }
.xfer-btns button.ringing .bd { background: var(--ring); }
.xfer-btns button[class*="in-use"] .bd, .xfer-btns button.busy .bd { background: var(--alert); }

.call[draggable=true] { cursor: grab; }
.call.dragging { opacity: .5; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { border-color: var(--alert); color: var(--alert); }
.toast.good { border-color: var(--accent-dim); }

h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.9px;
  color: var(--dim); margin: 0 0 12px; font-weight: 600;
}

/* ---------- live call cards ---------- */
#live { display: grid; gap: 14px; margin-bottom: 34px; }

.call {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--ring); border-radius: var(--radius);
  padding: 18px 20px; animation: pop .25s ease-out;
}
.call.answered { border-left-color: var(--accent); }
.call.ended { border-left-color: var(--line); opacity: .6; }

@keyframes pop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.call-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.who { font-size: 23px; font-weight: 650; letter-spacing: -0.3px; }
.num { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 15px; }
.state {
  margin-left: auto; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; padding: 3px 10px; border-radius: 20px;
  background: rgba(227,179,65,.15); color: var(--ring);
}
.call.answered .state { background: rgba(63,185,80,.15); color: var(--accent); }

.meta { margin-top: 6px; color: var(--dim); font-size: 14px; }
.meta b { color: var(--text); font-weight: 600; }

.hist { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.hist-row {
  display: flex; gap: 12px; align-items: baseline;
  font-size: 14px; padding: 3px 0;
}
.hist-row .ago { color: var(--dim); min-width: 108px; }
.hist-row .ag { font-weight: 600; }
.hist-row .tk { color: var(--dim); font-variant-numeric: tabular-nums; }
.hist-none { color: var(--dim); font-size: 14px; font-style: italic; }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--dim);
}

/* ---------- history table ---------- */
.bar { display: flex; gap: 10px; margin-bottom: 12px; }
input[type=search], input[type=text], input[type=password] {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font-size: 14px; font-family: var(--font);
}
input[type=search] { flex: 1; }
input:focus { outline: 2px solid var(--blue); outline-offset: -1px; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th {
  text-align: left; padding: 10px 14px; color: var(--dim); font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--line); background: var(--panel);
  white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--panel-2); }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: var(--panel-2); color: var(--dim); border: 1px solid var(--line);
}
.tag.ans { color: var(--accent); border-color: var(--accent-dim); }
.tag.miss { color: var(--alert); border-color: #5c2626; }
button.play {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--blue);
  border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px;
}
button.play:hover { border-color: var(--blue); }
button.play.playing {
  color: var(--accent); border-color: var(--accent-dim);
  background: rgba(63,185,80,.12);
}
button.play.playing:hover { border-color: var(--accent); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- login ---------- */
.login-wrap { max-width: 340px; margin: 12vh auto; }
.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
}
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p { color: var(--dim); font-size: 14px; margin: 0 0 20px; }
.login-card input { width: 100%; margin-bottom: 10px; }
.login-card button {
  width: 100%; padding: 10px; border-radius: 8px; border: none;
  background: var(--blue); color: #06101d; font-weight: 650; font-size: 15px;
  cursor: pointer; font-family: var(--font);
}
.err { color: var(--alert); font-size: 13px; min-height: 18px; margin-top: 8px; }
