/* Shared look for the sign-in page, admin console and agent console.
   Colors are reserved for call states, like lamps on a switchboard. */
:root {
  --ink: #13213c;
  --ink-2: #1d2e50;
  --ink-3: #2c406a;
  --paper: #eef1f4;
  --card: #ffffff;
  --line: #dce1e8;
  --line-soft: #e8ecf1;
  --text: #13213c;
  --muted: #5e6b80;
  --faint: #8792a2;

  --ready: #0e8a7e;   /* ready, primary positive */
  --dial: #d98a1c;    /* dialing, ringing */
  --air: #e0483a;     /* on call: the ON AIR lamp */
  --wrap: #6e56cf;    /* wrap-up */
  --idle: #8792a2;    /* paused, offline */
  --danger: #c4372a;

  --display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(19, 33, 60, .06), 0 4px 16px rgba(19, 33, 60, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--body); color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
a { color: var(--ready); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 2px solid var(--ready); outline-offset: 2px; }

/* ---- controls */
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; min-height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink-3); outline: none; box-shadow: 0 0 0 3px rgba(44, 64, 106, .14); }
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--muted); }
label.field > input, label.field > select { width: 100%; }

.btn {
  font: 500 14px/1 var(--body); display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--ink); color: #fff; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.go { background: var(--ready); }
.btn.go:hover { background: #0b766c; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a92e23; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--faint); background: #fff; }
.btn.link { background: none; color: var(--ready); padding: 0; min-height: 0; }
.btn.big { min-height: 46px; font-size: 15px; padding: 0 20px; }
kbd { font: 500 11px var(--mono); padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); }
.btn.ghost kbd { background: var(--paper); border-color: var(--line); color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; width: 36px; height: 20px; min-height: 0; padding: 0; border-radius: 99px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--ready); }
.switch input:checked::after { left: 19px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--line-soft); border: 1px solid var(--line); }
.segmented button { font: 500 14px var(--body); border: 0; background: none; color: var(--muted); padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(19, 33, 60, .12); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--line-soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.on { background: #e3f4f2; color: #0a6b61; border-color: #bfe5e0; }
.chip.off { background: #f1f2f5; color: var(--faint); }
.chip.warn { background: #fdf1e1; color: #8f5810; border-color: #f2d9b3; }

/* ---- lamps: the one recurring signature */
.lamp { --c: var(--idle); display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); flex: none; }
.lamp.ready { --c: var(--ready); }
.lamp.dialing, .lamp.connecting { --c: var(--dial); animation: blink 1.1s steps(2, jump-none) infinite; }
.lamp.talking { --c: var(--air); box-shadow: 0 0 0 3px color-mix(in srgb, var(--air) 22%, transparent), 0 0 12px color-mix(in srgb, var(--air) 55%, transparent); }
.lamp.wrap-up { --c: var(--wrap); }
.lamp.preview { --c: var(--ready); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ready); }
.lamp.no-leads { --c: var(--dial); }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .lamp { animation: none !important; } }

.state-label { font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* ---- cards, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.card-head h2 { flex: 1; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font: 500 12px var(--body); color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fb; }
td.num, th.num { text-align: right; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

.bar { height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ready); border-radius: 99px; }

/* ---- drawer, toast */
.scrim { position: fixed; inset: 0; background: rgba(19, 33, 60, .32); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); z-index: 41; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease; box-shadow: -8px 0 32px rgba(19, 33, 60, .18); }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; background: #fff; border-top: 1px solid var(--line); }
.form-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.form-section > h3 { font-family: var(--body); font-weight: 600; font-size: 14px; }
.form-section .hint { font-size: 13px; color: var(--muted); margin: -4px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checklist { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.checklist label:hover { background: var(--paper); }
.checklist input { min-height: 0; width: 16px; height: 16px; accent-color: var(--ready); }
.checklist label.disabled { opacity: .5; cursor: not-allowed; }
.form-error { color: var(--danger); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 9px; font-size: 14px; z-index: 60; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .card-head, .card-pad { padding-left: 16px; padding-right: 16px; }
}
