:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1d2430;
  --muted: #5d6878;
  --line: #dde2ea;
  --nav: #222b37;
  --accent: #337ab7;
  --accent-soft: #e6f0f9;
  --ok: #1e7b4f;
  --warn: #9a6400;
  --warn-soft: #fff4dc;
  --bad: #b3261e;
  --ring: #f0b429;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d;
    --panel: #1b212b;
    --text: #e6eaf0;
    --muted: #9aa5b5;
    --line: #2c3442;
    --nav: #0c1016;
    --accent: #5aa0e0;
    --accent-soft: #1e2d3e;
    --ok: #4cc38a;
    --warn: #e8b04a;
    --warn-soft: #33290f;
    --bad: #ff7b72;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Lato, Roboto, sans-serif; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 6px 12px; }
button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 8px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h3 { font-size: 13px; color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--nav); color: #fff; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .04em; }
.brand span { font-weight: 400; opacity: .75; }
.brand .version { font-size: 11px; opacity: .6; margin-left: 4px; }
.status { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); white-space: nowrap; }
.chip.ok::before, .chip.bad::before, .chip.warn::before { content: "●"; margin-right: 5px; }
.chip.ok::before { color: #4cc38a; }
.chip.warn::before { color: var(--ring); }
.chip.bad::before { color: #ff7b72; }
.ext { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ext input { width: 80px; padding: 3px 6px; }
.fixture-banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); padding: 6px 16px; font-size: 13px; font-weight: 600; }

.signin { display: grid; place-items: center; padding: 64px 16px; }
.signin form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(420px, 100%); display: grid; gap: 12px; }
.signin label { display: grid; gap: 4px; }
.error { color: var(--bad); margin: 0; }

.layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; padding: 16px; max-width: 1280px; margin: 0 auto; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  /* On a phone the customer comes first; the call list follows. */
  .workspace { order: -1; }
}
.calls, .workspace { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
.empty { color: var(--muted); }

.call-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.call-list button { width: 100%; text-align: left; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 6px 9px; display: grid; gap: 1px; }
.call-list .day { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 6px 0 0; }
.call-list .line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.call-list .line .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-list .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.call-list .dir { font-size: 13px; color: var(--muted); width: 12px; }
.call-list button.missed .dir.inbound { color: var(--bad); }
.call-list .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-list .result { font-weight: 600; }
.call-list .result.missed { color: var(--bad); }
.call-list .result.ringing { color: var(--ring); }
.call-list .result.answered { color: var(--ok); }
.call-list .more { text-align: center; padding: 5px; color: var(--accent); }
.call-list button[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
.call-list .who { font-weight: 600; }
.call-list .meta { font-size: 12px; color: var(--muted); }
.call-list .ringing-me { border-left: 4px solid var(--ring); }

.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--line); color: var(--text); vertical-align: middle; }
.pill.ringing { background: var(--ring); color: #1d2430; }
.pill.answered { background: var(--ok); color: #fff; }
.pill.missed { background: var(--bad); color: #fff; }

.who-header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: start; }
.who-header h1 { font-size: 24px; margin: 0; }
.who-header .company { font-size: 16px; color: var(--muted); }
.number { font-variant-numeric: tabular-nums; color: var(--muted); }
.notice { margin: 12px 0; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.opening { margin: 12px 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--bg); }
.opening small { display: block; color: var(--muted); font-size: 12px; }
.block { margin-top: 18px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rows li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rows .sub { color: var(--muted); font-size: 12px; }
.freshness { margin-top: 18px; font-size: 12px; color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.search { display: flex; gap: 6px; margin: 8px 0; }
.search input { flex: 1; min-width: 0; }
.fixture-controls { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); }
.fixture-controls .hint { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.fixture-call { font-size: 13px; margin: 6px 0; }

.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(420px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; }
.who-am-i { font-size: 12px; opacity: .8; }
.signout { color: #fff; font-size: 12px; }
.alerts { margin-bottom: 16px; }
.alerts li { cursor: pointer; }
.alerts li.unread { border-left: 4px solid var(--ring); }
.count { background: var(--ring); color: #1d2430; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tab { font-size: 12px; padding: 3px 8px; background: transparent; color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.rows li.overdue { border-color: var(--bad); }
.pill.overdue { background: var(--bad); color: #fff; }
.commit-form { display: grid; gap: 8px; margin-top: 8px; padding: 10px; border: 1px dashed var(--line); border-radius: 6px; }
.commit-form .row { display: flex; gap: 6px; flex-wrap: wrap; }
.commit-form input, .commit-form select { flex: 1; min-width: 140px; }
select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }

.phone { margin-bottom: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; }
.phone .state { font-size: 13px; }
.phone .state.ready::before, .phone .state.bad::before, .phone .state.wait::before { content: "●"; margin-right: 5px; }
.phone .state.ready::before { color: var(--ok); }
.phone .state.wait::before { color: var(--ring); }
.phone .state.bad::before { color: var(--bad); }
.phone .incoming { background: var(--warn-soft); border-radius: 6px; padding: 8px; font-weight: 600; }
.phone-form { display: grid; gap: 6px; margin-top: 6px; }
.find { margin-bottom: 6px; }
.find input { width: 100%; }
.find-results { margin-bottom: 14px; }
.find-results li { cursor: pointer; }
.find-results li:hover { border-color: var(--accent); }
.gaps { margin: 10px 0; padding: 8px 10px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.numbers li { align-items: center; }
.comment { white-space: pre-wrap; }
.my-day { margin-bottom: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; display: grid; gap: 4px; }
.my-day strong { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.board-buttons { margin: 0 0 12px; }
.board-buttons button { flex: 1; }
#my-status { padding: 3px 6px; font-size: 13px; }
.board { width: 100%; border-collapse: collapse; font-size: 13px; }
.board th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); }
.board td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.board .sub { color: var(--muted); font-size: 12px; display: block; }
.board-wrap { overflow-x: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--line); }
.dot.on { background: var(--ok); }
.dot.busy { background: var(--ring); }
.dot.off { background: var(--bad); }
.late { color: var(--bad); }
.schedule-editor { display: grid; gap: 4px; margin-top: 6px; }
.schedule-editor .row { display: flex; gap: 6px; align-items: center; }
.schedule-editor input[type=time] { width: 110px; }
.dial { display: flex; gap: 6px; }
.dial input { width: 150px; padding: 3px 6px; }
.dial button { padding: 3px 10px; }
.dial .pad-toggle { display: inline-flex; align-items: center; padding: 3px 7px; background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; }
.dial-pad { position: absolute; z-index: 50; width: 190px; padding: 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--panel, var(--bg)); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.dial-pad[hidden] { display: none; }
.dial-pad button { padding: 8px 0; font-size: 16px; }
.dial-pad .pad-wide { grid-column: span 3; padding: 6px 0; font-size: 14px; }
.dial-pad .pad-wide[hidden] { display: none; }
.controls { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); display: grid; gap: 10px; }
.controls .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.controls input { flex: 1; min-width: 140px; }
.controls .muted { color: var(--muted); font-size: 13px; margin: 0; }
.rec { color: var(--bad); font-weight: 600; }
.rec::before { content: "●"; margin-right: 4px; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.cmd { font-size: 12px; color: var(--muted); }
.cmd.uncertain, .cmd.failed { color: var(--bad); }

.ai-brief { padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--panel); }
.ai-brief h2 { margin-top: 0; }
.ai-headline { margin: 6px 0; font-weight: 600; }
.ai-points { margin: 6px 0; padding-left: 18px; display: grid; gap: 4px; }
.ai-ref { display: inline-block; font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none; margin-left: 2px; }
a.ai-ref { color: var(--accent); }
.ai-note { margin: 6px 0; font-size: 12px; color: var(--muted); }
.call-alerts { margin-bottom: 12px; font-size: 13px; }
.call-alerts p { margin: 0; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--panel); }
.tile-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tile-value { font-size: 24px; font-weight: 600; margin-top: 2px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 6px; overflow-x: auto; }
.hour { flex: 1; min-width: 16px; height: 100%; display: flex; flex-direction: column; }
.bar-stack { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; }
.bar { width: 100%; }
.bar.in { background: var(--accent); }
.bar.out { background: var(--muted); opacity: .5; }
.bar.missed { background: var(--bad); }
.hour-label { font-size: 10px; color: var(--muted); text-align: center; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0; }

.sms-list li { cursor: pointer; }
.sms-list li.unread { border-left: 4px solid var(--accent); font-weight: 600; }
.sms-list li.selected { border-color: var(--accent); }
.sms-list .count { margin-left: 6px; }
.sms-thread { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; padding: 8px 2px; margin: 12px 0; }
.bubble { max-width: 75%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); white-space: pre-wrap; word-break: break-word; }
.bubble.inbound { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.outbound { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.bubble.failed { border-color: var(--bad); }
.bubble-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.bubble-error { color: var(--bad); }
.bubble-media img { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; margin-top: 4px; }
.sms-compose { display: grid; gap: 6px; }
.sms-compose textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); resize: vertical; }
.sms-files { display: flex; gap: 6px; flex-wrap: wrap; }
button.link { background: none; border: none; color: var(--accent); padding: 0 2px; cursor: pointer; }
.field { display: grid; gap: 3px; flex: 1; min-width: 160px; font-size: 13px; color: var(--muted); }
.field input, .field select { padding: 5px 7px; font-size: 14px; }
.contact-form h2 { margin: 0; }
.transcript { max-height: 260px; overflow-y: auto; display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.tline { line-height: 1.4; }
.tline .who { display: inline-block; min-width: 72px; margin-right: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tline.agent .who { color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }
.my-call { border-color: var(--accent); }
.my-call input { padding: 5px 7px; }
.phone-form .row { display: flex; gap: 6px; }
.phone-form .row input { flex: 1; min-width: 0; }
#my-ext:disabled { opacity: 1; background: transparent; border-color: transparent; color: inherit; font-weight: 600; }
.team-status ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 260px; overflow-y: auto; }
.team-status .team-head { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 4px 0; }
.team-status li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.team-status li .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-status li .state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.team-status li button { padding: 2px 8px; font-size: 12px; }
.team-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.team-status li.available .dot { background: var(--ok); }
.team-status li.unknown .dot { background: var(--accent); }
.team-status li.ringing .dot { background: var(--ring); }
.team-status li.on_call .dot { background: var(--bad); }
.team-status li.away .dot { background: var(--warn, #c98a1a); }
.team-status li.offline { opacity: .55; }

/* ---------- one-page app shell (V1.019) ---------- */
:root { --top-h: 52px; --dock-h: 52px; --nav-w: 76px; --tabs-h: 58px; }
body { min-height: 100vh; }
.topbar { gap: 10px; padding: 8px 12px; min-height: var(--top-h); flex-wrap: nowrap; position: sticky; top: 0; z-index: 30; }
.brand { white-space: nowrap; }
.topbar .find { flex: 1; min-width: 0; max-width: 520px; }
.topbar .find input { width: 100%; padding: 6px 10px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.topbar .find input::placeholder { color: rgba(255,255,255,.6); }
.topbar .dial input { width: 140px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; }
.me-bar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me-bar select { padding: 4px 6px; font-size: 13px; }
.ext input { width: 64px; }
.me-menu { position: relative; }
.followme { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 13px; min-width: 260px; }
.followme .fm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.followme input[type="tel"] { flex: 1; min-width: 0; padding: 5px 8px; font-size: 13px; }
.followme input[role="switch"] { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin: 0; flex: none; }
.followme input[role="switch"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.followme input[role="switch"]:checked { background: var(--ok); }
.followme input[role="switch"]:checked::after { left: 18px; }
.followme .sub { margin: 0; color: rgba(255,255,255,.75); font-size: 12px; }
.followme input[type="tel"] { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 6px; }
.followme button.secondary { width: auto; padding: 4px 10px; background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.followme input[role="switch"] { background: rgba(255,255,255,.3); }
.fm-badge { font-size: 12px; }
.me-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .9; white-space: nowrap; }
.me-menu summary::-webkit-details-marker { display: none; }
.me-pop { position: absolute; right: 0; top: calc(100% + 8px); background: var(--nav); border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 10px; display: grid; gap: 8px; min-width: 240px; z-index: 40; }
.me-pop .status { flex-direction: column; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa5b5; display: inline-block; }
.health-dot.ok { background: #4cc38a; } .health-dot.warn { background: var(--ring); } .health-dot.bad { background: #ff7b72; }

.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "nav view" "nav dock"; height: calc(100vh - var(--top-h)); }
.app[hidden] { display: none; }
.nav { grid-area: nav; display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; background: var(--panel); border-right: 1px solid var(--line); }
.nav button { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; background: transparent; border: 0; color: var(--muted); font-size: 11px; position: relative; border-radius: 8px; }
.nav button .ico { font-size: 18px; line-height: 1; }
.nav button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav button .count { position: absolute; top: 2px; right: 8px; }
.view { grid-area: view; min-width: 0; min-height: 0; }
.view-inbox { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.inbox { overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); background: var(--panel); }
.workspace { overflow-y: auto; padding: 16px 20px; border: 0; border-radius: 0; background: var(--bg); }
.workspace .back { display: none; }
.view-page { overflow-y: auto; }
.page { max-width: 820px; margin: 0 auto; padding: 16px 20px; }
.page.wide { max-width: 1180px; }
.page h1 { font-size: 22px; }
.filters { display: flex; gap: 6px; margin: 4px 0 8px; flex-wrap: wrap; }
.chip-btn { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: transparent; color: var(--text); border: 1px solid var(--line); }
.chip-btn[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.my-day { font-size: 12px; color: var(--muted); margin: 0 0 6px; padding: 0; border: 0; display: block; }
.my-day strong, .my-day div:nth-child(n+2) { display: inline; }
.my-day div + div::before { content: " · "; }
.call-list button.text .dir { color: var(--accent); }
.call-list button.unread .who { font-weight: 700; }
.call-list button .count { margin-left: 4px; }

.dock { grid-area: dock; display: flex; align-items: center; gap: 12px; padding: 6px 12px; min-height: var(--dock-h); background: var(--panel); border-top: 1px solid var(--line); flex-wrap: wrap; z-index: 20; }
.dock .phone { margin: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
.dock .phone .button-row { margin: 0; }
.dock .phone.on-call > .state { display: none; }
.dock .phone .incoming { padding: 4px 10px; }
.dock .phone.ringing { background: var(--warn-soft); margin: -6px -12px; padding: 6px 12px; }
.dock .my-call { display: flex; align-items: center; gap: 8px; position: relative; border: 0; padding: 0; margin: 0; }
.dock .my-call .with { font-weight: 600; text-decoration: none; }
.xfer-panel { position: absolute; bottom: calc(100% + 10px); right: 0; width: min(440px, 94vw); max-height: 65vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.xfer-panel input { width: 100%; }

.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-live { margin: 8px 0 16px; }
.live-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.live-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; font-size: 12px; color: var(--muted); }
.live-tile .n { font-size: 24px; font-weight: 700; color: var(--text); }
.live-tile.available .n { color: var(--ok); } .live-tile.on_call .n { color: var(--bad); } .live-tile.away .n { color: var(--warn); }
.live-people { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.live-people li { font-size: 13px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); display: inline-flex; align-items: center; gap: 5px; }
.live-people .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-people .available .dot { background: var(--ok); } .live-people .unknown .dot { background: var(--accent); } .live-people .ringing .dot { background: var(--ring); }
.live-people .on_call .dot { background: var(--bad); } .live-people .away .dot { background: var(--warn); } .live-people li.offline { opacity: .6; }
#dash .who-header h2 { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--text); }

/* Phones and small tablets: list or detail, tabs at the bottom, phone dock above them. */
@media (max-width: 760px) {
  :root { --nav-w: 0px; }
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar .brand span:not(.version), .topbar .version { display: none; }
  .topbar .find { order: 3; flex-basis: 100%; max-width: none; }
  .topbar .dial { order: 4; flex-basis: 100%; }
  .topbar .dial input { flex: 1; width: auto; }
  .ext { display: none; }
  .app { display: block; height: auto; padding-bottom: calc(var(--tabs-h) + var(--dock-h) + 8px); }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabs-h); flex-direction: row; justify-content: space-around; padding: 4px; border-right: 0; border-top: 1px solid var(--line); z-index: 25; }
  .nav button { flex: 1; }
  .dock { position: fixed; left: 0; right: 0; bottom: var(--tabs-h); }
  .view-inbox { display: block; }
  .inbox { border-right: 0; min-height: 50vh; }
  .view-inbox .workspace { display: none; padding: 12px; }
  .view-inbox.detail .inbox { display: none; }
  .view-inbox.detail .workspace { display: block; }
  .workspace .back { display: inline-block; margin-bottom: 8px; background: transparent; color: var(--accent); border: 0; padding: 4px 0; }
  .page { padding: 12px; }
  .live-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xfer-panel { position: fixed; left: 8px; right: 8px; width: auto; bottom: calc(var(--tabs-h) + var(--dock-h) + 8px); }
}
body { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
body > .app { flex: 1; height: auto; min-height: 0; }
.call-alerts { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  body { display: block; height: auto; }
}
.my-day strong { margin-right: 6px; text-transform: none; }
.topbar .secondary-dark { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.filters .new-text { margin-left: auto; color: var(--accent); border-color: var(--accent); }
.call-list li { position: relative; }
.call-list .repeat { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.call-list .expand { position: absolute; right: 4px; bottom: 4px; width: 26px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.call-list li.grouped { margin-left: 16px; }
.call-list li.grouped button { padding: 4px 8px; }
.call-list li:has(> .expand) > button:first-child { padding-right: 32px; }
/* Row actions: ↩ reply and ⋯ more. On hover/focus with a mouse; always on touch screens. */
.call-list .row-tools { position: absolute; right: 8px; bottom: 7px; display: none; gap: 2px; background: var(--panel, #fff); border-radius: 6px; }
.call-list li:has(> .expand) > .row-tools { right: 34px; }
.call-list li:hover > .row-tools, .call-list li:focus-within > .row-tools { display: flex; }
@media (hover: none) { .call-list .row-tools { display: flex; } }
.call-list .row-tools button { display: inline-flex; align-items: center; justify-content: center; text-align: center; width: 28px; border-radius: 6px; height: 22px; padding: 0; border: 1px solid var(--line, #dde3ea); background: transparent; color: var(--muted); font-size: 13px; line-height: 1; }
.call-list .row-tools button:hover { color: var(--accent); border-color: var(--accent); }
.call-list li.row-menu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px 8px; border-bottom: 1px solid var(--line, #dde3ea); }
.call-list li.row-menu button { display: inline-block; width: auto; padding: 4px 12px; font-size: 13px; border-radius: 999px; }
.call-list li.row-menu button.link { border: 0; margin-left: auto; }
.call-list li.row-menu .danger, .secondary.danger { background: var(--panel); color: #b42318; border-color: #f1b4ae; }
.call-list li.undo-bar button { width: auto; }
.call-list li.undo-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 10px; font-size: 13px; background: #fff8e1; border-bottom: 1px solid #f3e1a6; }

/* ---------- timeline (30,000-foot view) ---------- */
.timeline { display: grid; gap: 6px; margin-top: 8px; }
.tl-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 210px; gap: 10px; align-items: center; }
.tl-head { margin-bottom: 2px; }
.tl-who { display: grid; min-width: 0; }
.tl-who .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-who .sub { font-size: 12px; color: var(--muted); }
.tl-now-state { font-size: 11px; font-weight: 600; }
.tl-now-state.available { color: var(--ok); } .tl-now-state.on_call { color: var(--bad); } .tl-now-state.away { color: var(--warn); } .tl-now-state.offline { color: var(--muted); }
.tl-bar { position: relative; height: 22px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tl-seg { position: absolute; top: 0; bottom: 0; }
.tl-seg.available { background: #4cc38a; } .tl-seg.on_call { background: #e05252; } .tl-seg.ringing { background: var(--ring); }
.tl-seg.away { background: #e8b04a; } .tl-seg.offline { background: transparent; }
.tl-now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--accent); }
.tl-axis { position: relative; height: 16px; font-size: 11px; color: var(--muted); }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-sum { font-size: 12px; color: var(--muted); }
.tl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tl-legend .tl-seg { position: static; display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .tl-row { grid-template-columns: 1fr; gap: 3px; }
  .tl-head > div:first-child, .tl-head > div:last-child { display: none; }
  .tl-sum { margin-bottom: 8px; }
}

/* ---------- call lists ---------- */
.cl-make { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.cl-make input { flex: 1; min-width: 220px; }
.board tr.blocked { opacity: .55; }
.board td .sub { display: block; }
.cl-items .cl-item { display: grid; gap: 6px; }
.cl-items .cl-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.cl-items .cl-main > .sub { grid-column: 1 / -1; }
.cl-status { font-weight: 600; font-size: 13px; white-space: nowrap; }
.cl-status.booked { color: var(--ok); } .cl-status.no_answer, .cl-status.call_back_later { color: var(--warn); }
.cl-status.declined, .cl-status.opted_out { color: var(--bad); } .cl-status.no_number, .cl-status.skipped { color: var(--muted); }
.cl-items .button-row { margin: 0; }
.cl-items button { padding: 3px 10px; font-size: 13px; }
.cl-slots { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cl-lists .pill { margin-left: 6px; }
.dock .phone-error { color: var(--bad); font-size: 13px; font-weight: 600; }

/* ---------- call quality ---------- */
.score { display: inline-block; white-space: nowrap; flex: none; min-width: 34px; text-align: center; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--text); vertical-align: middle; }
.score.good { background: var(--ok); color: #fff; }
.score.fair { background: #f2c94c; color: #1d2430; }
.score.poor { background: var(--bad); color: #fff; }
.score.none { background: transparent; border: 1px dashed var(--muted); color: var(--muted); font-weight: 600; }
.q-calls li { list-style: none; }
.q-call { width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; }
.q-call:hover { border-color: var(--accent); }
.q-main { display: grid; gap: 2px; min-width: 0; }
.q-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.flag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #fdecea; color: #8a1c14; }
.q-mine { margin: 6px 0 10px; }
.q-parts { display: grid; gap: 6px; margin-top: 8px; }
.q-part { display: grid; grid-template-columns: 120px 64px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.q-label { font-weight: 600; }
.q-num { font-variant-numeric: tabular-nums; }
.q-input { width: 60px; padding: 3px 6px; }
.q-note { padding: 6px 8px; background: var(--accent-soft); border-radius: 6px; }
.q-block textarea { width: 100%; margin-top: 8px; }
.check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
@media (max-width: 760px) { .q-part { grid-template-columns: 1fr auto; } .q-part .sub { grid-column: 1 / -1; } }

/* ---------- AI caller on a call list ---------- */
.ai-panel { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.ai-panel.on { border-color: var(--ok); }
.ai-calls { display: grid; gap: 4px; margin-top: 4px; }
.ai-call details summary { cursor: pointer; font-size: 12px; color: var(--accent); }

/* ---------- booked support calls ---------- */
.todays-calls { display: grid; gap: 6px; margin: 6px 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 13px; }
.todays-calls[hidden] { display: none; }
.tc-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.tc-row.done { opacity: .6; }
.tc-row.late .tc-time { color: var(--bad); font-weight: 700; }
.tc-row .button-row button { width: auto; padding: 3px 10px; font-size: 12px; }
.call-reminder { position: fixed; right: 16px; bottom: 90px; z-index: 60; width: min(360px, calc(100vw - 32px)); background: var(--panel); border: 2px solid var(--accent); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; gap: 6px; }
.call-reminder.call_missed { border-color: var(--bad); }
.call-reminder p { margin: 0; }
@media (max-width: 760px) { .tc-row { grid-template-columns: 56px minmax(0, 1fr); } .tc-row .button-row { grid-column: 1 / -1; } }

/* ---------- admin View as ---------- */
.view-as-banner { position: sticky; top: 0; z-index: 70; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 14px; background: #7a2e0e; color: #fff; font-size: 13px; font-weight: 600; }
.view-as-banner button { width: auto; padding: 4px 12px; background: #fff; color: #7a2e0e; border: 0; border-radius: 6px; font-weight: 700; }
.view-as-btn { width: auto; padding: 3px 10px; font-size: 12px; }

/* ---------- Follow-ups board ---------- */
.page:has(#fu-board) { max-width: 1280px; }
.fu-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.fu-scopes { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.fu-scope { width: auto; border: 0; border-radius: 0; background: transparent; color: var(--text); padding: 6px 12px; font-size: 13px; }
.fu-scope[aria-selected="true"] { background: var(--accent); color: #fff; }
.fu-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.fu-filters input { flex: 1; min-width: 200px; }
.fu-filters select, .fu-filters input { padding: 6px 8px; font-size: 13px; }
.fu-group { margin: 12px 0; border-left: 4px solid var(--g); border-radius: 6px; background: var(--panel); }
.fu-group-head { width: 100%; display: flex; gap: 6px; align-items: baseline; background: transparent; border: 0; padding: 8px 10px; color: var(--g); font-size: 15px; text-align: left; }
.fu-group-head .sub { color: var(--muted); }
.fu-caret { width: 14px; }
.fu-rows { display: grid; }
.fu-row { display: grid; grid-template-columns: 160px minmax(0, 2.4fr) 120px 130px minmax(0, 1.2fr) 150px auto; gap: 10px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.fu-row.closed { opacity: .65; }
.fu-row select.fu-status { width: 100%; appearance: none; -webkit-appearance: none; border: 0; border-radius: 4px; padding: 7px 8px; background: var(--c) !important; background-image: none !important; color: #fff !important; font-weight: 700; text-align: center; text-align-last: center; cursor: pointer; }
.fu-row select.fu-status option { background: var(--panel); color: var(--text); }
.fu-status:disabled { cursor: default; opacity: 1; }
.fu-item { display: grid; gap: 2px; min-width: 0; }
.fu-desc { font-weight: 600; overflow-wrap: anywhere; }
.fu-customer { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.fu-customer a { color: var(--accent); }
.fu-owner-wrap { display: flex; gap: 6px; align-items: center; font-size: 12px; min-width: 0; }
.fu-owner { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; }
.fu-owner-sel { width: 100%; font-size: 12px; padding: 3px; }
.fu-due-btn { width: auto; background: transparent; border: 0; padding: 0; color: var(--text); text-align: left; cursor: pointer; }
.fu-due.late { color: var(--bad); font-weight: 700; }
.fu-due-input { font-size: 12px; padding: 3px; }
.fu-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fu-row button.fu-tag { width: auto; padding: 2px 9px; border: 0 !important; border-radius: 999px; background: var(--t) !important; color: #fff !important; font-size: 11px; font-weight: 700; }
.fu-tag-add { width: auto; font-size: 11px; padding: 1px 4px; border-radius: 999px; }
.fu-last { width: auto; background: transparent; border: 0; padding: 0; color: var(--accent); text-align: left; font-size: 12px; }
.fu-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.fu-actions button { width: auto; padding: 4px 10px; font-size: 12px; }
.btn-link { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--accent); }
.fu-sync { font-size: 11px; color: var(--ok); text-decoration: none; }
.fu-sync.bad { color: var(--bad); }
@media (max-width: 980px) {
  .fu-row { grid-template-columns: 140px minmax(0, 1fr); }
  .fu-row > :nth-child(n+3) { grid-column: 1 / -1; }
  .fu-row .fu-owner-sel { width: auto; max-width: 100%; }
  .fu-actions { justify-content: flex-start; }
}

.fu-new { width: auto; padding: 6px 14px; font-weight: 700; }
.fu-new[hidden] { display: none; }
.fu-modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.45); display: grid; place-items: start center; padding: 6vh 16px; overflow-y: auto; }
.fu-modal-box { width: min(560px, 100%); background: var(--panel); color: var(--text); border-radius: 12px; padding: 18px; display: grid; gap: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.fu-modal-box h2 { margin: 0 0 4px; }
.fu-modal-box label { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.fu-modal-box input, .fu-modal-box select { width: 100%; padding: 8px; }
.fu-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fu-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow-y: auto; }
.fu-results button { width: 100%; display: grid; text-align: left; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 6px 8px; }
.fu-chosen { display: flex; gap: 6px; align-items: baseline; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 6px; }
.fu-chosen[hidden] { display: none; }
.fu-modal-box button.fu-tag { width: auto; padding: 3px 10px; border: 0 !important; border-radius: 999px; background: var(--t) !important; color: #fff !important; font-size: 12px; font-weight: 700; cursor: pointer; }
.fu-modal-box button.fu-tag.off { opacity: .35; }
@media (max-width: 760px) { .fu-two { grid-template-columns: 1fr; } }

/* ---------- report tiles open their details ---------- */
button.tile-link { text-align: left; cursor: pointer; font: inherit; color: inherit; width: 100%; display: block; }
button.tile-link:hover, button.tile-link:focus-visible { border-color: var(--accent); }
.tile-more { margin-top: 6px; font-size: 12px; color: var(--accent); }
tr.late td { color: var(--bad); }
