/* wmReceptionist admin UI — brand colours taken from the logo (navy → blue → teal). */
:root {
  --navy: #0b1f44;
  --brand: #0b5cad;
  --brand-600: #094d92;
  --brand-50: #eef5fd;
  --teal: #12bfae;
  --cyan: #19ded6;
  --grad: linear-gradient(100deg, #0a3d7a 0%, #0b6fc4 55%, #14c8b4 100%);
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #0f1a2e;
  --muted: #5d6b82;
  --faint: #8a97ab;
  --border: #e3e9f2;
  --border-strong: #cfd8e6;
  --green: #0f9d6b; --green-bg: #e6f6ef;
  --amber: #b26b00; --amber-bg: #fff4de;
  --red: #c93434; --red-bg: #fdecec;
  --blue: #0b5cad; --blue-bg: #e8f1fc;
  --gray: #55627a; --gray-bg: #eef1f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 26, 46, .05), 0 1px 8px rgba(15, 26, 46, .04);
  --sidebar: 248px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--navy); }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--gray-bg); padding: 1px 6px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
svg[aria-hidden="true"] { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.btn svg[aria-hidden="true"] { width: 16px; height: 16px; }
.empty .icon svg[aria-hidden="true"] { width: 22px; height: 22px; }
.checklist .tick svg[aria-hidden="true"] { width: 13px; height: 13px; vertical-align: 0; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex-shrink: 0; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { display: block; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.sidebar .logo img { display: block; width: 100%; max-width: 190px; height: auto; }
.sidebar .area-label { margin: 16px 20px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav { list-style: none; margin: 0; padding: 4px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); color: #33415c; font-weight: 500; position: relative; }
.nav a:hover { background: var(--brand-50); text-decoration: none; color: var(--navy); }
.nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 18px; }
.sidebar .foot { margin-top: auto; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .tenant-name { font-weight: 650; color: var(--navy); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 99px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-menu .dropdown { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(15, 26, 46, .12); min-width: 220px; padding: 6px; z-index: 20; }
.user-menu .dropdown a, .user-menu .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.user-menu .dropdown a:hover, .user-menu .dropdown button:hover { background: var(--gray-bg); text-decoration: none; }
.user-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.content { padding: 26px 28px 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.impersonation { background: var(--navy); color: #fff; padding: 8px 28px; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.impersonation form { margin-left: auto; }
.impersonation .btn { background: rgba(255, 255, 255, .14); color: #fff; border-color: transparent; }

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: -.02em; margin-top: 2px; }
.stat .hint { font-size: 12px; color: var(--faint); margin-top: 2px; }
.meter { height: 6px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }
.meter.over > span { background: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--border); background: #fafbfd; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8fafd; }
.table tr.unread td { background: #f5f9ff; }
.table tr.unread .title { font-weight: 650; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .title { color: var(--navy); }
.table .sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; text-transform: capitalize; line-height: 20px; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.green { background: var(--green); } .dot.red { background: var(--red); } .dot.amber { background: #e0a100; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: #fff; color: var(--text); font: 600 13.5px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: #f6f8fb; border-color: #b9c5d8; }
.btn:focus-visible { outline: 3px solid rgba(11, 92, 173, .25); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-grad { background: var(--grad); border: 0; color: #fff; }
.btn-grad:hover { filter: brightness(1.05); background: var(--grad); }
.btn-danger { color: var(--red); border-color: #f0c4c4; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 11px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.form-grid .field + .field { margin-top: 0; }
label, .label { font-weight: 600; font-size: 13px; color: #24324d; }
.help { font-size: 12.5px; color: var(--muted); font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], input[type=time], input[type=search], input[type=month], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); font: 14px/1.4 var(--font); transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 90px; resize: vertical; }
textarea.tall { min-height: 180px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 92, 173, .14); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--red); }
.field-error { color: var(--red); font-size: 12.5px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.check .help { display: block; }
.input-group { display: flex; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.section-title { font-size: 13px; font-weight: 700; color: var(--navy); margin: 0 0 12px; }

.hours-table td { padding: 6px 8px; border: 0; vertical-align: middle; }
.hours-table td:first-child { width: 120px; font-weight: 600; }
.hours-table input[type=time] { width: 130px; }

.repeater-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.repeater-row:last-child { border-bottom: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: 600 13.5px var(--font); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--navy); text-decoration: none; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert-success { background: var(--green-bg); border-color: #bfe6d4; color: #0b6e4b; }
.alert-error { background: var(--red-bg); border-color: #f3c6c6; color: #9e2424; }
.alert-info { background: var(--blue-bg); border-color: #c9ddf5; color: #0a4a8c; }
.alert-warning { background: var(--amber-bg); border-color: #f2d9a5; color: #8a5300; }
.alert .close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; font-size: 16px; line-height: 1; }

/* ---------- Misc components ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty h3 { color: var(--navy); }
.empty .icon { width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: var(--brand-50); display: grid; place-items: center; color: var(--brand); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.pill { display: inline-block; padding: 3px 10px; background: var(--gray-bg); border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--gray); }
.copy-box { display: flex; align-items: center; gap: 8px; background: #f6f8fb; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.copy-box span { flex: 1; }
.secret-reveal { background: #0b1f44; color: #c7f9f3; padding: 14px; border-radius: var(--radius-sm); font-family: var(--mono); word-break: break-all; }
.prompt-preview { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: #0b1f44; color: #e6eefb; padding: 18px; border-radius: var(--radius); line-height: 1.6; max-height: 70vh; overflow: auto; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 16px; align-items: center; }
.pagination .info { margin-right: auto; color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters input[type=search] { max-width: 260px; }
.filters select { width: auto; }
.chip-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-tabs a { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--muted); font-weight: 600; font-size: 12.5px; }
.chip-tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-tabs a:hover { text-decoration: none; }

/* Setup checklist */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; display: grid; place-items: center; margin-top: 1px; }
.checklist li.done .tick { background: var(--teal); border-color: var(--teal); color: #fff; }
.checklist li.done .what { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist .what { font-weight: 600; color: var(--navy); }
.checklist .go { margin-left: auto; }
.progress-ring { font-size: 13px; color: var(--muted); }

/* Transcript */
.transcript { display: flex; flex-direction: column; gap: 10px; }
.turn { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; }
.turn .who { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 2px; }
.turn.caller { align-self: flex-start; background: #f0f3f8; border-bottom-left-radius: 4px; }
.turn.assistant { align-self: flex-end; background: var(--brand-50); border-bottom-right-radius: 4px; }
.turn.tool, .turn.system { align-self: center; max-width: 90%; background: #fff; border: 1px dashed var(--border-strong); color: var(--muted); font-size: 12.5px; border-radius: 8px; }

/* Console */
.console { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.chat-box { height: 520px; overflow-y: auto; padding: 18px; background: #fbfcfe; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.typing { color: var(--faint); font-style: italic; font-size: 13px; }
.voice-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 34px 20px; min-height: 300px; text-align: center; }
.orb { width: 132px; height: 132px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; box-shadow: 0 10px 40px rgba(11, 92, 173, .3); transition: transform .15s ease; position: relative; }
.orb svg[aria-hidden="true"] { width: 52px; height: 52px; color: #fff; }
.orb.live::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid rgba(20, 200, 180, .45); animation: pulse 1.6s ease-out infinite; }
.orb.speaking { transform: scale(1.06); }
@keyframes pulse { from { transform: scale(.95); opacity: 1; } to { transform: scale(1.25); opacity: 0; } }
.voice-status { font-weight: 600; color: var(--navy); }
.voice-log { max-height: 260px; overflow-y: auto; padding: 14px 18px; border-top: 1px solid var(--border); }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 10% -10%, #dbeafd 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #d6f7f2 0%, transparent 55%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 26, 46, .08); padding: 30px; }
.auth-card.wide { max-width: 640px; }
.auth-card .logo { display: block; margin: 0 auto 22px; max-width: 240px; }
.auth-card .logo img { width: 100%; height: auto; display: block; }
.auth-card h1 { text-align: center; font-size: 20px; }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 20px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .console { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .turn { max-width: 92%; }
}
