/* SB Agent Desk. Lives in the agent workspace's app pane (about 900 x 700, often
   narrower), so it should read as part of the workspace: same light/dark
   preference, no heavy boxes, tabular numbers. One loud thing per view:
   callers waiting while idle, the caller and IVR result on a call, the wrap-up
   in after call work. */
:root {
  --bg: #f5f7fa;
  --raise: #ffffff;
  --ink: #16202b;
  --muted: #5d6978;
  --faint: #8792a0;
  --line: #dde3ea;
  --accent: #1f62b5;
  --accent-ink: #ffffff;
  --wait: #a35a00;
  --wait-bg: #fff1d9;
  --ok: #15703d;
  --ok-bg: #e4f4ea;
  --warn: #8f5300;
  --warn-bg: #fbf0dc;
  --bad: #b3261e;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171e;
    --raise: #18202a;
    --ink: #e6ebf1;
    --muted: #93a0b0;
    --faint: #66727f;
    --line: #26303c;
    --accent: #5b9cf0;
    --accent-ink: #0b1420;
    --wait: #f2b54d;
    --wait-bg: #2e2412;
    --ok: #62d394;
    --ok-bg: #13301f;
    --warn: #f2b54d;
    --warn-bg: #3a2a0e;
    --bad: #f3837a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; color: inherit; }
.app { min-height: 100vh; padding: 16px 18px 20px; max-width: 1100px; margin: 0 auto; container-type: inline-size; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

button.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 6px;
  padding: 7px 18px; font-weight: 600; cursor: pointer;
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: default; }

/* Full-pane messages: connecting, outside the workspace, idle without sign-in */
.message { max-width: 440px; margin: 16vh auto 0; text-align: center; padding: 0 12px; }
.message h1 { font-size: 18px; font-weight: 600; margin: 14px 0 6px; }
.message p { margin: 0; }
.idle-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); margin: 0 auto; animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .idle-dot { animation: none; } }

/* ---- Waiting for a call: queues and the associate's numbers ---------------- */
.stats { display: grid; gap: 22px; }
.stats-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stats-head h1 { margin: 0; font-size: 18px; font-weight: 600; }
.updated { color: var(--faint); font-size: 12px; white-space: nowrap; }

.block h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

.queues { width: 100%; border-collapse: collapse; }
.queues th, .queues td { padding: 9px 8px; text-align: right; white-space: nowrap; }
.queues thead th { padding-top: 0; font-size: 12px; font-weight: 500; color: var(--faint); vertical-align: bottom; }
.queues tbody tr { border-top: 1px solid var(--line); }
.queues th[scope="row"] { text-align: left; font-weight: 500; padding-left: 10px; white-space: normal; }
.queues thead th:first-child { padding-left: 10px; }
.queues td { color: var(--muted); }

/* Callers waiting: the number to notice. Big, and amber when it isn't zero. */
.q-wait { font-size: 20px; font-weight: 600; color: var(--faint) !important; line-height: 1; }
.q-busy { background: var(--wait-bg); }
.q-busy th[scope="row"] { box-shadow: inset 3px 0 0 var(--wait); }
.q-busy .q-wait, .q-busy .q-longest { color: var(--wait) !important; }
.q-busy .q-longest { font-weight: 600; }

.queues tfoot tr { border-top: 2px solid var(--line); }
.q-total th[scope="row"], .q-total td { font-weight: 600; color: var(--ink); }
.q-total .q-wait { color: var(--ink) !important; }
.q-total-busy .q-wait, .q-total-busy .q-longest { color: var(--wait) !important; }

/* The associate: today large, this month underneath. */
.you { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0; border-top: 1px solid var(--line); }
.metric { padding: 10px 10px 2px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; padding-left: 10px; }
.metric dt { font-size: 12px; color: var(--faint); }
.metric dd { margin: 0; }
.metric-today { font-size: 22px; font-weight: 600; line-height: 1.25; margin-top: 2px !important; }
.metric-month { font-size: 12px; color: var(--muted); }

/* Sign-in and other problems in place of the numbers */
.notice { display: grid; justify-items: start; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--raise); border: 1px solid var(--line); }
.notice p { margin: 0; }
.detail { font-size: 12px; color: var(--faint); max-width: 100%; }
.detail summary { cursor: pointer; }
.detail p { margin: 6px 0 0; overflow-wrap: anywhere; }

@container (max-width: 560px) {
  .queues .opt { display: none; }
  .you { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(4) { border-left: 0; }
  .metric:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@container (max-width: 400px) {
  .queues th, .queues td { padding: 8px 5px; }
  .q-wait { font-size: 17px; }
}

/* ---- On a call ---------------------------------------------------------------- */
.strip {
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  padding: 2px 0 14px 14px; margin-bottom: 16px;
  border-left: 3px solid var(--accent); border-bottom: 1px solid var(--line);
}
.strip-acw { border-left-color: var(--faint); }
.line-chip { color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
.line-chip-unknown { color: var(--muted); }
.caller { flex: 1 1 200px; min-width: 0; }
.caller-number { font-size: 22px; font-weight: 600; letter-spacing: .01em; line-height: 1.2; }
.timer { color: var(--ink); }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); white-space: nowrap; }
.strip .pill { font-size: 12.5px; padding: 5px 12px; }
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; white-space: normal; }
.pill-acw { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pill-muted { color: var(--muted); }
.head-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
@container (max-width: 640px) {
  .grid { grid-template-columns: 1fr; gap: 22px; }
  .view-acw .grid > :last-child { order: -1; } /* stacked in after call work: wrap-up first */
}
.card { min-width: 0; }
.card-focus { padding: 12px 14px; margin: 0 -14px; border-radius: var(--radius); background: var(--raise); box-shadow: inset 0 0 0 1px var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.reason { margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 13px; }
.note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

/* Label/value rows with copy buttons */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 14px; margin: 0; align-items: center; }
.facts dt, .facts dd { padding: 7px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; }
.value { overflow-wrap: anywhere; font-weight: 500; }
.value.muted { font-weight: 400; }
.copy {
  margin-left: auto; flex: none; cursor: pointer;
  border: 1px solid var(--line); background: transparent; border-radius: 5px;
  padding: 1px 9px; font-size: 12px; color: var(--muted);
}
.copy:hover { color: var(--ink); border-color: var(--muted); }
.copy.done { color: var(--ok); border-color: var(--ok); }

/* Wrap-up */
label.block { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
select {
  width: 100%; border: 1px solid var(--line); background: var(--raise); color: var(--ink);
  border-radius: 6px; padding: 8px 10px;
}
select:disabled { opacity: .7; }
.status { color: var(--muted); }
.status-ok { color: var(--ok); font-weight: 600; }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); font-weight: 600; }
