/* RCX Agent web workspace — design system ported from the macOS client (DesignSystem.swift/Theme):
   Twenty-inspired light/neutral language — white canvas, light-gray rail, hairline borders, soft
   rounded cards, layered-gray type, soft pastel chips, ONE restrained accent.
   Tokens are CSS custom properties; [data-appearance="dark"] flips the neutral ramp,
   [data-theme="<id>"] picks the accent. */

/* ---- Neutral ramp (Twenty grayscale) ---- */
:root {
  /* Apple system colors — status pills/dots and the in-call control tints (match macOS SwiftUI) */
  --sys-green:#28cd41; --sys-orange:#ff9500; --sys-blue:#007aff;
  --sys-purple:#af52de; --sys-gray:#8e8e93; --sys-teal:#30b0c7;
  --sys-indigo:#5856d6; --sys-red:#ff3b30;
  --canvas:  #f9f9f9;  /* gray3 — app background */
  --card:    #ffffff;  /* gray1 — card fill */
  --surface: #f1f1f1;  /* gray4 — panel / hover / fields */
  --line:    #ebebeb;  /* gray5 — hairline border */
  --line2:   #f3f3f3;  /* faint divider */
  --ink:     #333333;  /* gray12 — primary text */
  --ink2:    #666666;  /* gray11 — secondary */
  --ink3:    #999999;  /* gray9  — tertiary/placeholder */
  --sidebar: #f4f4f4;  /* rail, a hair grayer than canvas */
  --shadow:  0 1px 1px rgba(0,0,0,.02);

  /* Accent (default = teal, matches the macOS default) */
  --brand: #0d9488;
  --brand-soft: rgba(13,148,136,.10);

  /* Semantic (chips + status dots — DS.chip pastel pairs) */
  --ok-bg:#d9f2e3;    --ok-fg:#1a784d;
  --err-bg:#fae3e3;   --err-fg:#b83333;
  --warn-bg:#fcedcc;  --warn-fg:#9e6b0d;
  /* Text ON an amber surface. Separate from --ink because --ink flips to near-white in dark mode
     while --warn-bg does not: the whisper bubble was #ebebeb on #fcedcc, a contrast of 1.03:1. */
  --warn-ink:#3b2f10;
  --info-bg:#e0ebfc;  --info-fg:#1a5cc7;
  --purp-bg:#ede6fc;  --purp-fg:#6b45bd;
  --gray-bg:#f0f1f3;  --gray-fg:#666666;

  --r-sm: 6px; --r-md: 8px; --r-lg: 10px;
  --login-accent: #1a784d; /* fixed "go" green on the sign-in screen, independent of theme */
}
[data-appearance="dark"] {
  --canvas:#171717; --card:#1b1b1b; --surface:#1d1d1d; --line:#2e2e2e; --line2:#232323;
  --ink:#ebebeb; --ink2:#b3b3b3; --ink3:#818181; --sidebar:#1b1b1b;
  --shadow: 0 1px 1px rgba(0,0,0,.2);
}
/* Accent palettes (Theme.palette) */
[data-theme="ocean"]    { --brand:#1961ed; --brand-soft:rgba(25,97,237,.10); }
[data-theme="indigo"]   { --brand:#4f46e5; --brand-soft:rgba(79,70,229,.10); }
[data-theme="violet"]   { --brand:#7c3aed; --brand-soft:rgba(124,58,237,.10); }
[data-theme="teal"]     { --brand:#0d9488; --brand-soft:rgba(13,148,136,.10); }
[data-theme="emerald"]  { --brand:#059669; --brand-soft:rgba(5,150,105,.10); }
[data-theme="rose"]     { --brand:#e12a64; --brand-soft:rgba(225,42,100,.10); }
[data-theme="amber"]    { --brand:#d97706; --brand-soft:rgba(217,119,6,.10); }
[data-theme="graphite"] { --brand:#475569; --brand-soft:rgba(71,85,105,.10); }

/* ---- Base ---- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { height: 100%; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--brand); }
a { color: var(--brand); text-decoration: none; }
::placeholder { color: var(--ink3); }

/* ---- Layout ---- */
.workspace { display: flex; height: 100vh; }
.pane-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.pane { flex: 1; overflow-y: auto; padding: 28px; }
.pane h1 { font-size: 21px; font-weight: 700; margin: 0 0 16px; color: var(--ink); }

/* ---- Components (DS.*) ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.dslabel { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--ink3); }
.hint { font-size: 11.5px; color: var(--ink3); }
.muted { color: var(--ink2); }
.err { color: var(--err-fg); font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.field {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 12px; font-size: 13px; outline: none;
}
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.chip.err  { background: var(--err-bg);  color: var(--err-fg); }
.chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip.info { background: var(--info-bg); color: var(--info-fg); }
.chip.purp { background: var(--purp-bg); color: var(--purp-fg); }
.chip.gray { background: var(--gray-bg); color: var(--gray-fg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-sm); border: 1px solid transparent; padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: #fff; background: var(--brand);
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; }
.btn.green { background: var(--ok-fg); }
.btn.red { background: var(--err-fg); }
.btn-neutral {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 12px; font-size: 13px; font-weight: 500;
}
.btn-neutral:hover { background: var(--line2); }
.btn-ghost {
  background: none; border: none; color: var(--ink2); padding: 4px 8px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
}
.btn-ghost:hover { background: var(--surface); }

.badge {
  min-width: 16px; padding: 1px 6px; border-radius: 999px; background: var(--err-fg);
  color: #fff; font-size: 10px; font-weight: 700; text-align: center;
}

/* ---- Login ---- */
/* Two-panel login: dark branded hero (left) + light sign-in form (right). A deliberate fixed look —
   NOT theme-driven — so it reads the same in light/dark. Collapses to the form-only on narrow screens. */
.login-split { height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: #faf9f7; }
.login-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 56px 56px 0;
  color: #fff; background:
    radial-gradient(66% 46% at 50% 104%, rgba(45,190,115,.26), rgba(45,190,115,0) 62%),
    linear-gradient(#050807 0%, #050807 34%, #071710 100%); }
.login-hero-top { position: relative; z-index: 1; max-width: 452px; }
.login-hero-art { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; display: block; z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14%); mask-image: linear-gradient(to bottom, transparent 0, #000 14%); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 38px; }
.login-brand img, .login-brand svg { width: 38px; height: 38px; }
.login-brand .name { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-headline { font-size: clamp(30px, 3.2vw, 44px); line-height: 1.1; font-weight: 800; letter-spacing: -.022em; margin: 0; text-wrap: balance; }
.login-sub { margin: 18px 0 0; font-size: 15.5px; line-height: 1.55; color: rgba(233,255,244,.6); max-width: 404px; }
.login-form { position: relative; display: flex; align-items: center; justify-content: center; background: #faf9f7; padding: 24px; }
.login-form-inner { width: 100%; max-width: 384px; }
.login-form-brand { display: none; align-items: center; gap: 9px; font-size: 17px; font-weight: 700; color: #14181a; margin-bottom: 26px; }
.login-form-brand svg { width: 30px; height: 30px; }
.login-welcome { font-size: 32px; font-weight: 800; letter-spacing: -.022em; color: #14181a; margin: 0; }
.login-welcome-sub { margin: 7px 0 28px; font-size: 15px; color: #7a8085; }
.login-lbl { display: block; font-size: 13.5px; font-weight: 600; color: #2a2f33; margin: 16px 0 7px; }
.login-input { width: 100%; height: 48px; padding: 0 14px; font-size: 15px; border: 1px solid #dcdcd7; border-radius: 10px; background: #fff; color: #14181a; box-sizing: border-box; transition: border-color .12s, box-shadow .12s; }
.login-input::placeholder { color: #b7bbbe; }
.login-input:focus { outline: none; border-color: #1f8f5a; box-shadow: 0 0 0 3px rgba(31,143,90,.14); }
.login-pass { position: relative; }
.login-pass .login-input { padding-right: 44px; }
.login-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: #9a9fa4; cursor: pointer; border-radius: 8px; }
.login-eye:hover { color: #4a4f54; background: #f0efec; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #3a3f43; cursor: pointer; }
.login-remember input { width: auto; accent-color: #1f8f5a; }
.login-forgot { font-size: 13px; font-weight: 500; color: #6b7280; }
.login-forgot:hover { color: #1f7a4d; text-decoration: underline; }
.login-signin { margin-top: 22px; width: 100%; height: 50px; font-size: 15.5px; font-weight: 700; border-radius: 10px; background: #1f7a4d; color: #fff; border: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .12s; }
.login-signin:hover { background: #186a41; }
/* "or" separator + Google SSO button — shown only when /auth/methods says google is configured */
.login-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; color: #98a1ad; font-size: 12px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: #e6e9ee; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 46px;
  margin-top: 14px; border: 1px solid #dadce0; border-radius: 10px; background: #fff; color: #3c4043;
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s; }
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(60,64,67,.15); }
.login-form .notice-amber, .login-form .err { max-width: 384px; margin-top: 14px; }
.login-gear { position: absolute; top: 18px; right: 20px; font-size: 18px; background: none; border: none; color: #a7acb0; cursor: pointer; }
.login-gear:hover { color: #4a4f54; }
@media (max-width: 900px) { .login-split { grid-template-columns: 1fr; } .login-hero { display: none; } .login-form-brand { display: flex; } }
.notice-amber { background: var(--warn-bg); color: var(--warn-fg); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; margin-bottom: 10px; }

/* ---- Sidebar ---- */
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sb-top { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sb-me { display: flex; align-items: center; gap: 11px; }
.sb-me .who .nm { font-size: 14px; font-weight: 600; }
.sb-me .who .ext { font-size: 11px; color: var(--ink3); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px; border: none; padding: 0;
}
/* initials chip painted instantly; photo fades in over it once loaded (no blank gap while fetching) */
.avatar-stack { position: relative; display: inline-flex; flex-shrink: 0; }
.avatar-stack .avatar { position: absolute; inset: 0; }
.avatar-img { opacity: 0; transition: opacity .18s ease; }
.avatar-img.on { opacity: 1; }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.st-available { background: var(--sys-green); } .st-busy { background: var(--sys-orange); }
.st-reserved { background: var(--sys-blue); } .st-held { background: var(--sys-purple); }
.st-notready { background: var(--sys-orange); } .st-offline { background: var(--sys-gray); }
.status-msg { background: none; border: none; text-align: left; padding: 0; font-size: 11px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.status-msg.set { color: var(--ink2); }
.conn-banner {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  background: var(--err-fg); color: #fff; border: none; border-radius: 999px;
  padding: 5px 10px; font-size: 11px; font-weight: 600;
}
.sb-divider { border-top: 1px solid var(--line); margin: 0; }
.sb-nav { padding: 8px; }
.sb-nav .dslabel { padding: 10px 10px 4px; display: block; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px;
  background: none; border: none; border-radius: var(--r-sm); color: var(--ink); font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .ico { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink2); flex-shrink: 0; }
.nav-item.active .ico { color: var(--brand); }

/* inline SVG icons */
.ic { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.status-picker .ic, .sb-footer-btn .ic, .btn .ic, .btn-neutral .ic, .mi .ic { vertical-align: middle; }
.nav-item .badge { margin-left: auto; }
.sb-bottom { margin-top: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
/* Settings + Sign out sit together as a pair, dropped lower (extra space above) and tight to each other. */
.sb-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.status-picker {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 2px;
  background: none; border: none; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; color: var(--ink); text-align: left;
}
.status-picker:hover { background: var(--surface); }
/* Matches the native macOS control: a teal up/down chevron on the LEFT, then the dark status label. */
.status-picker .chev { display: inline-flex; color: var(--ink3); }
.sb-footer-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; padding: 7px;
  /* Outline matches the macOS footerButton: ink3 @ 35% (a soft mid-gray), not the fainter hairline var(--line). */
  background: none; border: 1px solid color-mix(in srgb, var(--ink3) 35%, transparent); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; color: var(--ink);
}
.sb-footer-btn:hover { background: var(--surface); }
.sb-footer-btn.danger { color: var(--err-fg); }

/* ---- Announcements banner ---- */
.announce { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 13px; font-weight: 500; }
.announce.info { background: var(--brand-soft); }
.announce.warning { background: var(--warn-bg); }
.announce-more { display: block; width: 100%; text-align: left; background: var(--surface); border: none; padding: 7px 16px; font-size: 12px; font-weight: 600; color: var(--brand); }

/* ---- Menus / popovers ---- */
.menu {
  position: absolute; z-index: 60; min-width: 200px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 8px 30px rgba(0,0,0,.12);
  padding: 5px; max-height: 60vh; overflow-y: auto;
}
.menu .mi {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; background: none;
  border: none; border-radius: var(--r-sm); font-size: 13px; color: var(--ink); text-align: left;
}
.menu .mi:hover { background: var(--surface); }
.menu .msep { border-top: 1px solid var(--line); margin: 5px 0; }
.menu .mhead { padding: 6px 10px 3px; }
.menu .mhead-plain { font-size: 12px; color: var(--ink3); }
.menu .chk-inline { display: inline-flex; color: var(--ink); }
/* Searchable transfer picker (many queues/agents): search header + scrolling body + pinned footer.
   Only rendered when the target list is long; a short list stays the plain grouped menu. */
.menu.has-search { overflow: visible; display: flex; flex-direction: column; width: 268px; }
.menu-search { display: flex; align-items: center; gap: 6px; padding: 4px 8px 6px; }
.menu-search .ms-ico { display: inline-flex; color: var(--ink3); }
.menu-search .ms-input {
  flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm);
  padding: 6px 9px; font-size: 13px; outline: none; min-width: 0;
}
.menu-search .ms-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.menu.has-search .menu-body { max-height: 44vh; overflow-y: auto; }
.menu-foot { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.menu .mi.hl { background: var(--brand-soft); }
.menu-empty { padding: 10px; text-align: center; font-size: 12.5px; color: var(--ink3); }
/* Emoji picker grid (chat composer) — 8 columns, matches the macOS EmojiPicker. */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 6px; }
.emoji-cell { font-size: 20px; line-height: 1; background: none; border: none; cursor: pointer; padding: 5px; border-radius: 6px; }
.emoji-cell:hover { background: var(--surface); }

/* ---- Modal / toast ---- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { width: min(480px, 92vw); max-height: 86vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.modal h2 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; }
.modal h2 .mtitle-right { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--ink3); display: inline-flex; align-items: center; gap: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.modal .msub { font-size: 13px; color: var(--ink2); margin: -8px 0 14px; line-height: 1.45; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* form label inside modals — dsLabel typography WITHOUT the uppercase transform (macOS dsLabel
   never transforms; the authored string case shows through) */
.flabel { display: block; font-size: 11px; font-weight: 600; letter-spacing: .6px; color: var(--ink3); }
/* segmented single-select (macOS segmented Picker) */
.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.seg button { flex: 1; border: none; background: none; padding: 5px 8px; font-size: 12.5px; font-weight: 500; color: var(--ink2); border-radius: 5px; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: var(--card); padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: 0 6px 24px rgba(0,0,0,.2); animation: toast-in .18s ease-out; }
.toast.error { background: var(--err-fg); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ---- Chat pane ---- */
.chat-subtabs { display: flex; gap: 6px; margin-bottom: 14px; }
.chat-subtabs button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink2); }
.chat-subtabs button.active { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
/* Incoming-chat offer — a neat contained card (not a full-width bar): circular tinted channel icon,
   title + queue + optional context, and an Accept button that sits close, not flung to the far edge. */
.chat-offer { display: flex; align-items: center; gap: 12px; max-width: 560px;
  background: var(--card); border: 1px solid var(--ok-fg); border-radius: var(--r-lg);
  padding: 11px 12px 11px 13px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.chat-offer .offer-ico { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: var(--ok-bg); color: var(--ok-fg); display: inline-flex; align-items: center; justify-content: center; }
.chat-offer .what { flex: 1; min-width: 0; }
.chat-offer .what .t { font-weight: 600; font-size: 13.5px; }
.chat-offer .what .q { font-size: 12px; color: var(--ink2); }
.chat-offer .what .ctx { font-size: 11.5px; color: var(--ink3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-offer .btn { flex-shrink: 0; padding-left: 20px; padding-right: 20px; }
/* Chat pane fills the workspace height so the columns reach the bottom (no dead gap). */
.chat-pane { display: flex; flex-direction: column; height: 100%; }
.chat-split { display: flex; gap: 14px; flex: 1; min-height: 340px; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; }
.chat-empty .ce-ico { width: 84px; height: 84px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.chat-empty .ce-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.chat-empty .ce-sub { font-size: 13px; color: var(--ink3); max-width: 300px; line-height: 1.5; }
.conv-list { width: 250px; flex-shrink: 0; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.conv-list .head { padding: 10px 12px 6px; }
.conv-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px; background: none; border: none; text-align: left; }
.conv-row:hover { background: var(--surface); }
.conv-row.sel { background: var(--brand-soft); }
.conv-row .who { flex: 1; min-width: 0; }
.conv-row .who .nm { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row .who .sub { font-size: 11px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.conv-head .t { font-weight: 600; }
.conv-head .spacer { flex: 1; }
/* Neat header actions (Transfer / End): a clean thin-outlined button — colored icon+label on a plain
   surface, a soft tint appearing only on hover. Reads as a tidy control, not a heavy filled pill. */
.chat-act { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  font-size: .84rem; font-weight: 600; line-height: 1; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--brand);
  transition: background .12s ease, border-color .12s ease; }
.chat-act .ic { opacity: .9; }
.chat-act:hover { background: var(--brand-soft); border-color: var(--brand); }
.chat-act.danger { color: var(--err-fg); }
.chat-act.danger:hover { background: var(--err-bg); border-color: var(--err-fg); }
/* muted: a passive cleanup action (Dismiss an already-ended card) — neutral gray, not the brand accent
   used for Transfer/End, so a harmless list-tidy doesn't read as a real action. */
.chat-act.muted { color: var(--ink3); }
.chat-act.muted:hover { background: var(--surface); border-color: var(--line); }
.transcript { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.bubble.customer { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.bubble.agent { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.agent_prev { align-self: flex-end; background: var(--gray-bg); color: var(--ink2); border-bottom-right-radius: 4px; }
.bubble.peer { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
/* AI-authored messages: business side (right) like an agent, but tinted + tagged so the pre-handoff
   AI transcript never blends into the customer's or the live agent's bubbles. */
.bubble.ai { align-self: flex-end; background: var(--brand-soft); color: var(--ink); border-bottom-right-radius: 4px; }
.ai-tag { align-self: flex-end; font-size: 10px; font-weight: 700; color: var(--brand); margin: 0 2px -4px; }
/* Supervisor whisper: business side, but deliberately NOT the agent's own colour — a dashed amber
   frame reads as "this is not part of the conversation". The customer never receives these; the
   styling has to make that obvious at a glance, because acting on a coaching note as though the
   customer had seen it is the way a whisper does damage. */
.bubble.whisper { align-self: flex-end; background: var(--warn-bg); color: var(--warn-ink);
  border: 1px dashed var(--warn-fg); border-bottom-right-radius: 4px; }
.msg-time.whisper { align-self: flex-end; }
.bubble .attach a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.bubble.agent .attach a { color: #fff; text-decoration: underline; }
.bubble img.att { max-width: 220px; border-radius: 8px; display: block; margin-top: 4px; }
/* Per-message time (parity with the macOS chat bubble): a small muted stamp under each bubble,
   aligned to the same side as its bubble. */
.msg-time { font-size: 10px; color: var(--ink3); margin: -2px 2px 2px; }
/* grouped transcript: a continuation bubble sits tight under its predecessor (container gap is 8px;
   -5px pulls same-sender runs to ~3px) — the group's single .msg-time hangs under the LAST bubble. */
.bubble.cont { margin-top: -5px; }
.msg-time.agent, .msg-time.me, .msg-time.ai { align-self: flex-end; }
.msg-time.customer, .msg-time.peer, .msg-time.agent_prev { align-self: flex-start; }
.sysline { align-self: center; color: var(--ink3); font-size: 11.5px; padding: 2px 0; text-align: center; }
/* Handoff/transcript boundary — a centered labeled divider (AI-vs-live fence), macOS parity. */
.msg-divider { display: flex; align-items: center; gap: 10px; margin: 8px 0; color: var(--ink3); }
.msg-divider::before, .msg-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg-divider span { font-size: 11px; font-weight: 600; white-space: nowrap; }
/* Speaker label above the first bubble of each run. align-self matters: in the transcript's flex
   column a label without it stretches full width and the text drifts from its bubble. Left by
   default (customer/colleague); the business side overrides to flex-end inline. */
.from-name { align-self: flex-start; font-size: 10.5px; color: var(--ink3); margin: 0 6px 1px; }
/* Business side (you / a previous agent / the AI). Declared AFTER .from-name and .ai-tag so the
   cascade resolves here rather than via an inline style — .from-name would otherwise silently win
   over .ai-tag's flex-end simply by being further down the file. */
.from-name.right { align-self: flex-end; }
/* The whisper's label carries the amber the bubble does, at the same weight macOS uses. A muted grey
   label under-sells the one thing the agent must not misread: this is NOT what the customer saw. */
.from-name.whisper { color: var(--warn-fg); font-weight: 600; }
.suggestion-banner { margin: 0 14px 8px; background: var(--purp-bg); border-radius: var(--r-md); padding: 9px 12px; font-size: 12.5px; color: var(--ink); }
.suggestion-banner .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
/* KB grounding as a chip in the banner's own language (was a raw "from: …" text line). */
.suggestion-banner .src-chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  font-size: 10.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--purp-line, #e3dcf2); color: var(--purp-fg, #6b5a9e); }
/* Conference roster — mirrors the macOS "IN THIS CONFERENCE" card: avatar + name/status + tinted icon buttons. */
.conf-roster { max-width: 360px; margin: 0 auto; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); text-align: left; }
.conf-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.conf-meta { flex: 1; min-width: 0; }
.conf-name { font-size: 13px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conf-status { font-size: 10px; color: var(--ink3); }
.conf-status.muted { color: var(--warn-fg); }
.conf-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 26px; border-radius: var(--r-sm); cursor: pointer;
  color: var(--ink2); background: color-mix(in srgb, var(--ink2) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ink2) 22%, transparent); }
.conf-ico.warn { color: var(--warn-fg); background: color-mix(in srgb, var(--warn-fg) 10%, transparent); border-color: color-mix(in srgb, var(--warn-fg) 22%, transparent); }
.conf-ico.danger { color: var(--err-fg); background: color-mix(in srgb, var(--err-fg) 10%, transparent); border-color: color-mix(in srgb, var(--err-fg) 22%, transparent); }
.conf-ico:hover { filter: brightness(.96); }

/* Store-and-forward hint above the composer when a DM colleague is offline (macOS moon.zzz banner). */
.offline-banner { display: flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 12px; color: var(--ink3); background: var(--surface); border-top: 1px solid var(--line); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; max-height: 110px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; outline: none; }
.composer textarea:focus { border-color: var(--brand); }
.icon-btn { background: none; border: none; font-size: 16px; color: var(--ink3); padding: 6px; border-radius: var(--r-sm); }
.icon-btn:hover { background: var(--surface); color: var(--ink2); }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--card); position: absolute; bottom: -1px; right: -1px; }
.avatar-wrap { position: relative; flex-shrink: 0; }
.drop-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); border: 2px dashed var(--brand); border-radius: var(--r-lg); color: var(--brand); font-weight: 700; z-index: 5; pointer-events: none; }

/* ---- Tables (History / AI Activity) ---- */
/* Table scrolls horizontally so columns resize INDEPENDENTLY: widening one grows the table (and scrolls
   if needed) instead of stealing width from a neighbor. JS sets the table's pixel width to the SUM of its
   column widths (so table-layout:fixed honors each width and clips overflow to …), and fills any slack
   into the flex column once at render so it still fills the card by default. */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.tbl th { position: relative; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink3); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tr.row:hover td { background: var(--surface); cursor: pointer; }
/* Direction/channel icon sits in a soft rounded badge; numeric columns use tabular figures + secondary ink. */
.dir-badge { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; background: var(--gray-bg); color: var(--ink2); }
.tbl td.num { font-variant-numeric: tabular-nums; color: var(--ink2); }
.tbl .eng { color: var(--ink2); }
/* Clickable caller — the teal "call back" link (macOS parity); the row's only colored/interactive element. */
.linkcall { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; background: none; border: none; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.linkcall span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.linkcall svg { flex-shrink: 0; }
.linkcall:hover span { text-decoration: underline; }
/* Resizable columns: a flex .cell keeps a trailing button visible while the text ellipsizes; drag the
   grip on a header's right edge to widen a column (width persisted per table). Full value on hover (title). */
.tbl td .cell { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tbl .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.col-grip { position: absolute; top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize; z-index: 2; }
.col-grip::after { content: ""; position: absolute; top: 22%; right: 4px; width: 1px; height: 56%; background: var(--line); }
.col-grip:hover::after { background: var(--brand); width: 2px; }
.copybtn { background: none; border: none; color: var(--ink3); font-size: 11px; padding: 1px 4px; border-radius: 4px; }
.copybtn:hover { background: var(--surface); color: var(--ink2); }

/* ---- Toggle switch (Queues) ---- */
.switch { position: relative; width: 36px; height: 21px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; }
.switch .sl:before { content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .sl { background: var(--brand); }
.switch input:checked + .sl:before { transform: translateX(15px); }

/* ---- Scorecard / stats ---- */
.scorecard { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 110px; background: var(--surface); border-radius: var(--r-md); padding: 12px; text-align: center; }
.stat .v { font-size: 20px; font-weight: 700; }
.stat .k { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.stat .v.good { color: var(--ok-fg); } .stat .v.bad { color: var(--warn-fg); }

/* ---- Badge grid (gamification) ---- */
/* My day — card headers with an icon + title (macOS Label style), and the sub-sections below. */
.card-hd { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.card-hd .ch-ico { display: inline-flex; color: var(--ink); }
.today-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; }
.today-stats { display: flex; align-items: stretch; }
.today-stats .tstat { flex: 1; text-align: center; }
.today-stats .tstat .v { font-size: 22px; font-weight: 700; color: var(--ink); }
.today-stats .tstat .v.good { color: var(--ok-fg); } .today-stats .tstat .v.bad { color: var(--warn-fg); }
.today-stats .tstat .k { font-size: 11.5px; color: var(--ink3); margin-top: 3px; }
.today-stats .tdiv { width: 1px; background: var(--line); margin: 5px 0; }
.gami-row { display: flex; gap: 26px; }
.gami-stat .gv { font-size: 26px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.gami-stat .gk { font-size: 12px; color: var(--ink3); }
.md-hr { border: none; border-top: 1px solid var(--line2); margin: 13px 0; }
.md-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; }
.md-eval { padding: 8px 0; border-bottom: 1px solid var(--line2); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.gbadge { display: flex; align-items: center; gap: 9px; text-align: left; background: rgba(120,120,128,.06); border-radius: 9px; padding: 9px 11px; }
.gbadge.earned { background: var(--brand-soft); }
.gbadge .i { font-size: 22px; flex-shrink: 0; line-height: 1; }
.gbadge.locked .i { opacity: .3; }
.gbadge .n { font-weight: 700; font-size: 12px; color: var(--ink); }
.gbadge.locked .n { color: var(--ink3); }
.gbadge .d { font-size: 10.5px; color: var(--ink3); }
/* Supervisor board — a gray section-header strip atop each card + two-line agent rows (macOS parity). */
.sup-card { padding: 0; overflow: hidden; margin-bottom: 14px; }
.sup-hd { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: rgba(120,120,128,.06); font-size: 15px; font-weight: 700; color: var(--ink); }
.sup-hd .sup-count { font-weight: 400; color: var(--ink3); }
.sup-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line2); font-size: 13px; }
.sup-row:last-child { border-bottom: none; }
.sup-who { min-width: 0; }
.sup-name { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.sup-sub { font-size: 12px; color: var(--ink3); }
.sup-empty { color: var(--ink3); padding: 16px; font-size: 13px; }

/* ---- Detail sheet (centered dialog, macOS 470×580 sheet) ---- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; display: flex; align-items: center; justify-content: center; }
.sheet { width: min(470px, 94vw); max-height: min(620px, 90vh); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 18px 60px rgba(0,0,0,.2); display: flex; flex-direction: column; overflow: hidden; animation: sheet-in .16s ease-out; }
@keyframes sheet-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; background: var(--card); }
.sheet .sh-head .hd-ico { display: inline-flex; color: var(--brand); flex-shrink: 0; }
/* Two-line sheet title: "caller · outcome" over a "number · time" subtitle (macOS detail header). */
.sheet .sh-head .sh-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sheet .sh-head .sh-t { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.sheet .sh-head .sh-sub { font-size: 12px; font-weight: 400; color: var(--ink3); }
.sheet .sh-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.sheet .kv { display: grid; grid-template-columns: 120px 1fr; gap: 5px 12px; font-size: 12.5px; margin-bottom: 14px; }
.sheet .kv .k { color: var(--ink3); }
.sheet .sh-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Directory rows ---- */
.dir-row { display: flex; align-items: center; gap: 11px; padding: 10px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.dir-row .who { flex: 1; min-width: 0; }
.dir-row .who .nm { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 7px; }
/* an offline colleague reads as inactive: fade the identity, keep the actions crisp */
.dir-row.off .avatar-wrap, .dir-row.off .who { opacity: .5; }
.dir-row .dirchat { padding: 6px 10px; color: var(--ink2); }
.dir-row .dircall { padding: 6px 14px; }
.dir-row .dircall:disabled { background: transparent; color: var(--ink3); border: 1px solid var(--line); opacity: 1; }
.dir-row .who .sub { font-size: 11.5px; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-row .acts { display: flex; gap: 7px; align-items: center; }
.star { background: none; border: none; font-size: 15px; color: var(--ink3); padding: 3px; }
.star.on { color: #f2b021; }

/* ---- Dial pad ---- */
.dialpad { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; justify-content: center; margin: 14px 0; }
.dialpad button { height: 48px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--card); font-size: 17px; font-weight: 600; }
.dialpad button:hover { background: var(--surface); }
.dialpad button .sub { display: block; font-size: 8.5px; color: var(--ink3); font-weight: 500; letter-spacing: 1px; }

/* ---- Alert rows (supervisor) ---- */
.alert-row { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: var(--r-md); margin-bottom: 6px; font-size: 12.5px; font-weight: 500; }
.alert-row.critical { background: var(--err-bg); color: var(--err-fg); }
.alert-row.warning { background: var(--warn-bg); color: var(--warn-fg); }

/* ---- Status pill (semantic, capsule) ---- */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-pill.ok   { background: color-mix(in srgb, var(--sys-green) 22%, transparent);  color: var(--sys-green); }
.status-pill.info { background: color-mix(in srgb, var(--sys-blue) 22%, transparent);   color: var(--sys-blue); }
.status-pill.purp { background: color-mix(in srgb, var(--sys-purple) 22%, transparent); color: var(--sys-purple); }
.status-pill.warn { background: color-mix(in srgb, var(--sys-orange) 22%, transparent); color: var(--sys-orange); }
.status-pill.gray { background: color-mix(in srgb, var(--sys-gray) 22%, transparent);   color: var(--sys-gray); }

/* Recording indicator on the active-call card: always-on red badge while the call is recorded,
   amber when the agent has paused (masked) it for PCI capture. Pulsing dot = "live". */
.rec-badge {
  display: inline-flex; align-items: center; gap: 7px; margin: 8px auto 0; align-self: center;
  padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--sys-red) 16%, transparent); color: var(--sys-red);
}
.rec-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; animation: rec-pulse 1.4s ease-in-out infinite; }
.rec-badge.paused { background: color-mix(in srgb, var(--sys-orange) 16%, transparent); color: var(--sys-orange); }
.rec-badge.paused .dot { animation: none; }
@keyframes rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-badge .dot { animation: none; } }

/* status menu reason rows (icon + label + checkmark) */
.reason-row { justify-content: flex-start; }
.reason-row .ri { display: inline-flex; align-items: center; justify-content: center; color: var(--ink2); width: 18px; }
.reason-row .chk { margin-left: auto; color: var(--brand); display: inline-flex; }

/* ---- Phone pane: one centered dialpad-width column (macOS layout) ---- */
.phone-col { max-width: 460px; margin: 0 auto; }
/* On a call the column widens for the 5-across control row (5×96 + gaps) — macOS gives the call
   view the full pane. */
.phone-col:has(.call-active) { max-width: 680px; }
/* other simple panes: centered readable column (macOS window width) instead of full-bleed */
.pane-col { max-width: 720px; margin: 0 auto; }

/* ---- New-call dialer card ---- */
.newcall { max-width: 460px; margin-left: auto; margin-right: auto; }
.nc-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.nc-ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--r-md); background: var(--brand-soft); color: var(--brand); }
.nc-title { font-size: 15px; font-weight: 700; }
.dial-field { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 10px; }
.dial-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.dial-field .lead { display: inline-flex; color: var(--ink3); }
.dial-field input { flex: 1; background: none; border: none; outline: none; padding: 10px 0; font-size: 15px; letter-spacing: .5px; }
.dial-field .clear { background: none; border: none; color: var(--ink3); display: inline-flex; padding: 4px; }
.dial-field .clear:hover { color: var(--ink2); }
/* Recent-dials suggestions: in-flow panel right under the dial field (pushes the pad down while
   open — no overlay positioning to break). Rows follow the .menu .mi conventions. */
.dial-recent { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); overflow: hidden; }
.dial-recent .dr-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; background: none; border: none; text-align: left; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.dial-recent .dr-item:hover, .dial-recent .dr-item.hl { background: var(--brand-soft); }
.dial-recent .dr-item .ri { display: inline-flex; color: var(--ink3); flex: none; }
.dial-recent .dr-typed { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dial-recent .dr-num { margin-left: auto; color: var(--ink3); font-size: 12px; flex: none; }
/* Dial-type chip: left-aligned sentence-case pastel pill — the macOS "External number" chip. */
.type-row { display: flex; justify-content: flex-start; margin-top: 10px; }
.type-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.type-chip.info { background: var(--info-bg); color: var(--info-fg); }
.type-chip.purp { background: var(--purp-bg); color: var(--purp-fg); }
.type-chip.ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.type-chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
.type-chip.gray { background: var(--gray-bg); color: var(--gray-fg); }
.callerid-picker { display: flex; align-items: center; gap: 7px; justify-content: center; margin-top: 10px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--ink2); cursor: pointer; width: fit-content; margin-left: auto; margin-right: auto; }
.callerid-picker:hover { border-color: var(--ink3); }
/* Pinned by an admin: a statement, not a control — drop the affordances so it doesn't invite a click
   that cannot change anything (the chevron is hidden in markup order via the last child). */
.callerid-picker.is-pinned { cursor: default; }
.callerid-picker.is-pinned:hover { border-color: var(--line); }
.callerid-picker.is-pinned > svg:last-child { display: none; }
.callerid-picker .ci-ico { display: inline-flex; color: var(--ink3); }
.callerid-picker b { color: var(--ink); font-weight: 600; }
.dial-actions { display: flex; gap: 8px; margin-top: 12px; align-items: stretch; }
.dial-actions .btn.green { flex: 1; height: 44px; font-size: 15px; }
.dial-actions .backspace { width: 52px; flex-shrink: 0; }

/* ---- Active-call panel (screenshot-matched to the macOS Agent app) ----
   macOS renders the call view FLOATING on the pane background (no card box) — the white cards are
   the control buttons themselves. Same here: the .card wrapper goes transparent and borderless. */
.call-active { text-align: center; padding: 26px 0 22px; background: none; border: none; box-shadow: none; }
.ca-who { font-size: 32px; font-weight: 700; margin-top: 4px; letter-spacing: .3px; }
/* Status line: colored dot + colored word ("Calling…" blue / "On call" green) · mono 00:04 */
.ca-status { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 12px 0 10px; font-size: 14px; }
.ca-status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ca-status .word { font-weight: 600; }
.ca-status .dot.ok { background: var(--ok-fg); }     .ca-status .word.ok { color: var(--ok-fg); }
.ca-status .dot.info { background: var(--info-fg); } .ca-status .word.info { color: var(--info-fg); }
.ca-status .dot.purp { background: var(--purp-fg); } .ca-status .word.purp { color: var(--purp-fg); }
.ca-status .sep { color: var(--ink3); }
.ca-status .t { color: var(--ink); font-size: 14px; }
/* ENG id (+copy): a quiet centered mono line under the status. (The RTP packet counters that
   used to sit here were debug instrumentation shown to agents on every call — removed.) */
.ca-eng { margin-top: 2px; }
/* Controls: two CENTERED rows of white cards (5 across / 4 across on macOS). The 18px above them
   used to come from .ca-rtp's bottom margin, so it moved here when that line went away. */
.callctls { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 18px; }
.ctl-row { display: flex; gap: 8px; justify-content: center; }
/* Sized against the native macOS control cards — compact, not billboard buttons. */
.callctl { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 80px; padding: 10px 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 11.5px; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.callctl:hover { background: var(--surface); }
.callctl .dd { position: absolute; top: 5px; right: 6px; opacity: .55; display: inline-flex; }
.callctl svg { color: inherit; }
/* Active toggle: the accent FILLS the card (background set inline), so ON state is obvious at a glance —
   mirrors the macOS ctlCard filled: treatment and the Hang Up card. */
.callctl.on { border-color: transparent; box-shadow: 0 1px 6px rgba(0,0,0,.14); }
.callctl.on:hover { filter: brightness(.94); }
/* Red square Hang Up card (icon above label), centered — not a full-width bar */
.hangup-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 94px; padding: 11px 4px; background: var(--sys-red); color: #fff; border: none; border-radius: var(--r-md); font-size: 12px; font-weight: 700; box-shadow: 0 1px 6px rgba(255,59,48,.35); }
.hangup-card:hover { filter: brightness(.94); }

/* ---- Waiting card (collapsible) ---- */
.waiting-card { padding: 0; overflow: hidden; }
.wc-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 13px 16px; background: none; border: none; text-align: left; }
.wc-head:hover { background: var(--surface); }
.wc-ico { display: inline-flex; color: var(--ink2); }
.wc-ico.hot { color: #f59e0b; }  /* orange when callers are waiting — matches the native macOS card */
.wc-title { font-weight: 700; font-size: 15px; }
.count-pill { min-width: 27px; text-align: center; padding: 3px 9px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-fg); font-size: 14px; font-weight: 700; }
.count-pill.hot { background: #f59e0b; color: #fff; }  /* solid orange, white number — the macOS badge */
.wc-sub { font-size: 12px; }
.wc-chev { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; color: var(--ink3); }
.wc-body { padding: 0 16px 8px; }
.wait-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: 1px solid var(--line2); font-size: 14px; }
.wait-row .wr-ico { display: inline-flex; color: var(--ink3); }
.wait-row .wr-ico.hot { color: #f59e0b; }  /* orange tray when the queue has callers waiting (macOS) */
.wait-row .wr-ico.ok { color: var(--sys-green); }  /* green check on the "All N queues clear" row (macOS) */
.wait-row .wr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-fg); }
.chan-chip.voice { background: rgba(245,158,11,.16); color: #c2740a; }   /* voice waiting — orange (macOS) */
.chan-chip.chat  { background: var(--info-bg); color: var(--info-fg); }  /* chat waiting — blue (macOS) */
.wr-wait { font-size: 12.5px; }

/* ---- Under-dialer strip: centered Schedule-a-callback + idle indicator (macOS layout) ---- */
.under-dialer { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 2px 0 16px; }

/* ---- Idle "receiving calls" indicator (compact centered pill) ---- */
/* macOS (screenshot-verified): colored icon + plain secondary-gray text, NO pill background. */
.idle-indicator { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); width: fit-content; }
.idle-indicator .ii-ico { display: inline-flex; }
.idle-indicator.ok .ii-ico { color: var(--sys-green); }
.idle-indicator.purp .ii-ico { color: var(--sys-purple); }
.idle-indicator.gray .ii-ico { color: var(--ink3); }

/* ---- Settings modal (640×560, left category rail — macOS SettingsView) ---- */
.set-split { display: flex; gap: 0; height: 430px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.set-rail { width: 158px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.set-cat { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; background: none; border: none; border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--ink); text-align: left; }
.set-cat:hover { background: var(--surface); }
.set-cat.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.set-cat .ico { display: inline-flex; color: var(--ink2); width: 18px; }
.set-cat.active .ico { color: var(--brand); }
.set-body { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 18px; background: var(--card); }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center; color: #fff; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: var(--ink); }

/* ---- Empty / loading states ---- */
.empty { color: var(--ink3); font-size: 13px; padding: 24px 0; text-align: center; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Desktop shell (html.shell — set when running inside the Electron app).
   Removes the "webpage texture" so the app feels native, like the macOS client:
   arrow cursor on chrome, no text selection outside content, thin macOS-style
   scrollbars, subtle focus, no drag ghosts, no overscroll bounce.
   Zero effect in a normal browser (class absent).
   ========================================================================== */
html.shell, html.shell body { overscroll-behavior: none; height: 100%; }
html.shell body { user-select: none; cursor: default; }

/* native apps use the ARROW cursor on buttons/controls — pointer is a web tell */
html.shell button, html.shell .nav-item, html.shell .mi, html.shell .conv-row,
html.shell .tbl tr.row, html.shell .callerid-picker, html.shell .wc-head,
html.shell .set-cat, html.shell .swatch, html.shell label { cursor: default; }
html.shell a { cursor: default; }
html.shell input, html.shell textarea { cursor: text; }
html.shell input[type="range"], html.shell input[type="checkbox"] { cursor: default; }

/* content the user legitimately copies stays selectable */
html.shell input, html.shell textarea,
html.shell .bubble, html.shell .transcript, html.shell .sysline,
html.shell .kv span:nth-child(even), html.shell .tbl td, html.shell .mono,
html.shell .suggestion-banner, html.shell .msub, html.shell .hint { user-select: text; }

/* no image/link drag ghosts (dragging UI = webpage feel) */
html.shell img, html.shell a, html.shell svg { -webkit-user-drag: none; }

/* macOS-style thin overlay scrollbars */
html.shell ::-webkit-scrollbar { width: 9px; height: 9px; }
html.shell ::-webkit-scrollbar-track { background: transparent; }
html.shell ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.22); border-radius: 99px;
  border: 2px solid transparent; background-clip: content-box;
}
html.shell ::-webkit-scrollbar-thumb:hover { background-color: rgba(0,0,0,.35); }
html.shell[data-appearance="dark"] ::-webkit-scrollbar-thumb,
[data-appearance="dark"] html.shell ::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,.22); }
html.shell ::-webkit-scrollbar-corner { background: transparent; }

/* web focus outlines → subtle app-style focus (keyboard nav keeps a soft ring) */
html.shell :focus { outline: none; }
html.shell button:focus-visible, html.shell .nav-item:focus-visible,
html.shell .mi:focus-visible { box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---- AI handoff summary -------------------------------------------------
   Shown once, where the AI's part of a conversation ends and the agent's begins.
   Deliberately NOT a chat bubble: it is a briefing about the conversation, so it
   spans the column, carries no sender label, and reads as a boundary marker. */
.handoff-note {
  margin: 14px 0;
  padding: 12px 14px 13px;
  border: 1px solid var(--brand-line, rgba(0,128,128,.28));
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: var(--brand-tint, rgba(0,128,128,.05));
}
.handoff-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.handoff-eyebrow {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--brand);
}
.handoff-why {
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  padding: 2px 8px; border-radius: 100px;
  background: rgba(0,0,0,.06); color: var(--ink2, #555);
}
.handoff-body { font-size: 13.5px; line-height: 1.55; color: var(--ink); }
@media (prefers-color-scheme: dark) {
  .handoff-why { background: rgba(255,255,255,.10); }
}
