/* FixCall client portal. Same design language as FixCall Ops (web/styles.css): variables, panels, badges, buttons, light + dark. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f1f3f6; --border: #e3e6eb; --text: #14171c; --muted: #646b76; --faint: #8a919c;
  --accent: #2563eb; --accent-weak: #e8efff;
  --crit: #dc2626; --crit-weak: #fde8e8; --high: #ea580c; --high-weak: #ffedd5; --med: #ca8a04; --med-weak: #fef6d8;
  --ok: #16a34a; --ok-weak: #e3f6ea; --low: #64748b; --low-weak: #eef1f5;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --new: #fff7d6; --bubble-agent: var(--panel-2); --bubble-caller: var(--accent-weak);
  --topbar-h: 56px; --panel-w: 560px;
  color-scheme: light dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --panel: #161a21; --panel-2: #1c212a; --border: #272d38; --text: #e7eaf0; --muted: #9aa3b2; --faint: #747d8c;
    --accent: #5b8cff; --accent-weak: #1b2645;
    --crit: #f87171; --crit-weak: #3a1717; --high: #fb923c; --high-weak: #3a2414; --med: #facc15; --med-weak: #342d10;
    --ok: #4ade80; --ok-weak: #12301f; --low: #94a3b8; --low-weak: #222935; --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); --new: #33300f;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.4; } /* no overflow-x mask: nothing may overflow */
body.lock { overflow: hidden; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
mark { background: #fde68a; color: #14171c; border-radius: 2px; padding: 0 1px; }
/* !important everywhere: an input rule (padding, min-height, width: 100%) must never make a hidden field take space */
.sr-only { position: absolute !important; left: 0; top: 0; width: 1px !important; height: 1px !important; min-width: 0 !important; min-height: 0 !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; border: 0 !important; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1440px; margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 18px; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-weak); color: var(--accent); }
.count-pill { font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.usermenu { position: relative; }
.userbtn { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; padding: 4px 8px 4px 4px; border-radius: 999px; min-height: 40px; }
.userbtn:hover, .userbtn[aria-expanded=true] { background: var(--panel-2); border-color: var(--border); }
.userbtn .nm { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.fixcall { background: var(--ok); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu .who b { display: block; } .menu .who span { color: var(--muted); font-size: 12px; word-break: break-all; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; text-align: left; padding: 9px 10px; border-radius: 6px; border: 0; background: none; color: var(--text); min-height: 38px; }
.menu a:hover, .menu button:hover { background: var(--panel-2); text-decoration: none; }
.menu .danger { color: var(--crit); }
kbd { font-family: ui-monospace, monospace; font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--panel-2); color: var(--muted); }

/* ---------- page ---------- */
.main { max-width: 1440px; margin: 0 auto; padding: 24px 24px 60px; transition: padding-right .2s ease; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0 0 2px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 12px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.sub { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 14px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.foot { margin-top: 28px; color: var(--faint); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.foot button { border: 0; background: none; color: var(--faint); padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); padding: 7px 14px; min-height: 36px; border-radius: 8px; font-weight: 500; color: var(--text); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--crit); }
.btn.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.icon { padding: 0; width: 36px; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: default; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.primary.busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

input[type=email], input[type=password], input[type=text], input[type=search], input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; min-height: 38px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 500; }
form > .field:first-child label, form > .form-row .field label, #step-1 > .field:first-child label { margin-top: 0; }
.hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.err { color: var(--crit); font-size: 13px; margin-top: 10px; }
.err:empty { display: none; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
.code-input { font-size: 22px !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }

.rules { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13px; }
.rules li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.rules li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* segmented control (date presets, overview period) */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; min-height: 32px; border-radius: 7px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }

/* switch (Unreviewed only, Reviewed in the panel) */
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 14px; cursor: pointer; min-height: 36px; user-select: none; font-weight: 500; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border); position: relative; margin: 0; flex: none; transition: background .15s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { box-shadow: var(--focus); }

/* reviewed checkbox in the list */
.rv { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin: -6px 0; border-radius: 8px; cursor: pointer; }
.rv:hover { background: var(--panel-2); }
.rv input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border: 2px solid var(--faint); border-radius: 6px; margin: 0; cursor: pointer; display: grid; place-items: center; background: var(--panel); transition: background .12s, border-color .12s; }
.rv input:checked { background: var(--ok); border-color: var(--ok); }
.rv input:checked::after { content: ''; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.rv input:focus-visible { box-shadow: var(--focus); }

/* badges and type chips */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.b-ok { background: var(--ok-weak); color: var(--ok); } .b-new { background: var(--accent-weak); color: var(--accent); }
.b-warn { background: var(--med-weak); color: var(--med); } .b-crit { background: var(--crit-weak); color: var(--crit); }
.b-low { background: var(--low-weak); color: var(--low); }
.chip { --c: #8a919c; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.t-booking { --c: #34a853; } .t-warranty { --c: #8e63ce; } .t-recall { --c: #4a86e8; } .t-sales { --c: #f6923a; }
.t-callback { --c: #ea4335; } .t-canceled { --c: #8a919c; } .t-rescheduled { --c: #e0a800; } .t-other { --c: #8a919c; }

/* ---------- calls page ---------- */
.tabs, .nav, .tab, .seg, .tbl-wrap, .detail-body { position: relative; } /* keeps .sr-only children inside their scroller */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
/* scrolling strips (tabs, phone nav): the edge with more items fades out, so it is clear there is more to swipe to */
.tabs.more-r, .nav.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tabs.more-l, .nav.more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.tabs.more-l.more-r, .nav.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.tab { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 10px 12px; min-height: 44px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .n { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.tab .u { font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 260px; min-width: 0; max-width: 420px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 34px; padding-right: 34px; }
.search .kbd-hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search input:focus ~ .kbd-hint, .search input:not(:placeholder-shown) ~ .kbd-hint { display: none; }
.custom-range { display: flex; gap: 6px; align-items: center; }
.custom-range input { width: 150px; }
.toolbar .spacer { flex: 1; }
.status-line { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.status-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.status-line.stale .dot { background: var(--med); }

.calls-wrap { container-type: inline-size; container-name: calls; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--border); background: var(--panel); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.calls td { color: var(--muted); }
.call { cursor: pointer; transition: background-color .4s; }
.call:hover td { background: var(--panel-2); }
/* three different marks: unreviewed = left bar (below), selected with j / k = outline, open in the panel = outline + tint */
.calls tr.call.sel, .calls tr.call.open { outline: 2px solid var(--accent); outline-offset: -2px; }
.call.open td { background: var(--accent-weak); }
.call.is-new td { animation: flash 4s ease-out; }
@keyframes flash { 0%, 40% { background: var(--new); } 100% { background: transparent; } }
.call .when b { display: block; color: var(--text); font-weight: 500; white-space: nowrap; }
.call .when span { font-size: 12px; color: var(--faint); }
.call .cust a { color: var(--text); font-weight: 500; }
.call .cust .ph { display: block; font-size: 12px; margin-top: 1px; }
.call .cust .ph a { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.call .what { max-width: 360px; }
.call .what div { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.call .bk { white-space: nowrap; font-size: 13px; }
.call .bk b { display: block; color: var(--text); font-weight: 500; }
.call .nc { font-size: 12px; white-space: nowrap; }
.call .nc .ico { width: 14px; height: 14px; vertical-align: -2px; }
.call.unrev .when b, .call.unrev .cust > a { font-weight: 700; }
.call.unrev .what { color: var(--text); }
.call.unrev td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.call.rv-done td { opacity: .62; }
.col-rv { width: 56px; text-align: center; }

/* compact list (narrow container: phone, or the side panel is open) */
.calls-wrap.is-loading tbody { opacity: .55; transition: opacity .15s; }
mark.cur { background: #f59e0b; }
@container calls (max-width: 820px) {
  .calls, .calls tbody { display: block; }
  .calls thead { display: none; }
  .calls tr.call { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "cust when rv" "what what rv" "meta meta rv"; column-gap: 10px; row-gap: 3px; padding: 12px 6px 12px 14px; border-bottom: 1px solid var(--border); position: relative; }
  .calls tr.call:last-child { border-bottom: 0; }
  .calls tr.call td { padding: 0; border: 0; background: none !important; box-shadow: none !important; }
  .calls tr.call:hover { background: var(--panel-2); }
  .calls tr.call.open { background: var(--accent-weak); }
  .calls tr.call.unrev { box-shadow: inset 3px 0 0 var(--accent); }
  .calls tr.call.is-new { animation: flash 4s ease-out; }
  .calls .when { grid-area: when; text-align: right; white-space: nowrap; }
  .calls .when b, .calls .when span { display: inline; }
  .calls .when span::before { content: ' · '; }
  .calls .cust { grid-area: cust; min-width: 0; }
  .calls .cust .ph { display: block; }
  /* block, or the ellipsis does nothing and a long name runs over the time */
  .calls .cust > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .calls .typ { grid-area: meta; display: flex !important; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
  .calls .what { grid-area: what; max-width: none; }
  .calls .bk, .calls .nc { display: none; }
  .calls .typ .m-bk, .calls .typ .m-nc { display: inline !important; font-size: 12px; color: var(--muted); }
  .calls .col-rv { grid-area: rv; align-self: center; width: auto; }
  .calls tr.skel { display: block; padding: 14px; }
}
.typ .m-bk, .typ .m-nc { display: none; }

.more { display: flex; justify-content: center; padding: 14px; }
.list-end { text-align: center; color: var(--faint); font-size: 12px; padding: 14px; }

/* empty / loading / error */
.state { text-align: center; padding: 48px 20px; color: var(--muted); }
.state .ico { width: 32px; height: 32px; color: var(--faint); stroke-width: 1.5; margin-bottom: 8px; }
.state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.state .actions { justify-content: center; margin-top: 14px; }
.skel td { padding: 14px 10px; }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2) 25%, var(--border) 50%, var(--panel-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.sk.w40 { width: 40%; } .sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.w30 { width: 30%; } .sk.mt { margin-top: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }

/* ---------- call detail panel ---------- */
.detail { position: fixed; z-index: 15; top: var(--topbar-h); right: 0; bottom: 0; width: var(--panel-w); max-width: 100%; background: var(--panel); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; clip-path: inset(0 0 0 100%); visibility: hidden; transition: clip-path .2s ease, visibility 0s .2s; }
.detail.on { clip-path: inset(0 0 0 -40px); visibility: visible; transition: clip-path .2s ease; }
.detail-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--border); flex: none; }
.detail-head .grow { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.detail-body { overflow-y: auto; padding: 18px 20px 40px; flex: 1; overscroll-behavior: contain; }
.detail-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
#detail-h { font-size: 20px; margin: 8px 0 2px; outline: none; box-shadow: none; word-break: break-word; }
.detail .when-line { color: var(--muted); font-size: 13px; }
.review-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 16px 0 4px; padding: 10px 14px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--border); }
.review-box.done { background: var(--ok-weak); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.review-box .by { font-size: 12px; color: var(--muted); }
.sec { margin-top: 22px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sec-head h3 { margin: 0; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.kv dd { margin: 0; display: flex; align-items: flex-start; gap: 6px; min-width: 0; word-break: break-word; }
.kv dd .v { flex: 1; min-width: 0; }
.copy { border: 0; background: none; color: var(--faint); width: 28px; height: 28px; margin: -4px 0; border-radius: 6px; display: inline-grid; place-items: center; flex: none; }
.copy:hover { background: var(--panel-2); color: var(--text); }
.copy .ico { width: 14px; height: 14px; }
.callout { background: var(--high-weak); color: var(--text); border-left: 3px solid var(--high); border-radius: 0 8px 8px 0; padding: 10px 12px; white-space: pre-wrap; }
.prose { white-space: pre-wrap; line-height: 1.55; margin: 0; }
audio { width: 100%; height: 40px; display: block; }
.tr-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.tr-tools .search { max-width: none; }
.tr-count { font-size: 12px; color: var(--faint); white-space: nowrap; min-width: 70px; text-align: right; }
.transcript { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble .who { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
.bubble.agent { align-self: flex-start; background: var(--bubble-agent); border-bottom-left-radius: 4px; }
.bubble.caller { align-self: flex-end; background: var(--bubble-caller); border-bottom-right-radius: 4px; }
.bubble.dim { opacity: .35; }
.notes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.note { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.note .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note .meta b { color: var(--text); font-weight: 600; }
.note .meta .grow { flex: 1; }
.note p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.note-form .form-actions { margin-top: 8px; justify-content: space-between; }
.backdrop { display: none; }

/* ---------- overview ---------- */
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 16px; }
a.kpi { color: inherit; display: block; text-decoration: none; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--accent); }
.kpi .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .hint { font-size: 12px; color: var(--faint); }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.kpi.attn .value { color: var(--accent); }
.chart-card { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .axis-t { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); transition: opacity .12s; }
.chart .hit { fill: transparent; }
.chart a:hover .bar, .chart a:focus .bar { opacity: .75; }
.chart a:focus { outline: none; }
.chart a:focus-visible .hit { stroke: var(--accent); stroke-width: 2; }
.chart .zero { fill: var(--border); }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--panel); font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; box-shadow: var(--shadow-lg); z-index: 2; }

/* ---------- team / activity / account ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl td { color: var(--text); }
.tbl .em { color: var(--muted); font-size: 13px; word-break: break-all; }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tbl tr.dis td { color: var(--faint); }
.tbl tr[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; box-shadow: none; }
.invite-result { margin-top: 14px; padding: 12px; border-radius: var(--radius); background: var(--ok-weak); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.invite-result p { margin: 0 0 8px; }
.copy-line { display: flex; gap: 8px; }
.copy-line input { font-family: ui-monospace, monospace; font-size: 12px; }
.form-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.form-row label { margin-top: 0; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 220px; }
.account { max-width: 760px; }
.secret { font-family: ui-monospace, monospace; font-size: 16px; letter-spacing: .06em; padding: 10px 12px; background: var(--panel-2); border-radius: 8px; word-break: break-all; }
.steps { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; }
.sessions { display: flex; flex-direction: column; }
.sess { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.sess:last-child { border-bottom: 0; }
.sess .grow { flex: 1; min-width: 0; }
.sess .meta { font-size: 12px; color: var(--muted); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin-bottom: 18px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand h1 { font-size: 20px; }
.auth .card { padding: 28px; }
.auth .btn.primary { width: 100%; min-height: 42px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 12px; color: var(--faint); }
.auth .notice { background: var(--accent-weak); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }

/* ---------- toasts and dialogs ---------- */
.toasts { position: fixed; z-index: 50; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(460px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%; background: var(--text); color: var(--panel); padding: 10px 10px 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
.toast.error { background: var(--crit); color: #fff; }
.toast .msg { flex: 1; min-width: 0; }
.toast button { border: 0; background: none; color: inherit; opacity: .8; min-width: 32px; min-height: 32px; border-radius: 6px; font-size: 16px; }
.toast button:hover { opacity: 1; background: rgba(255,255,255,.12); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); padding: 22px; width: min(440px, calc(100% - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 12, 16, .45); }
dialog h2 { font-size: 17px; }
dialog p { color: var(--muted); margin: 0; line-height: 1.5; }
dialog .form-actions { justify-content: flex-end; margin-top: 20px; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin: 0; font-size: 13px; }
.keys dt { text-align: right; } .keys dd { margin: 0; color: var(--muted); }

@media (hover: none) { .kbd-only, .search .kbd-hint, .foot [data-act=shortcuts], .menu [data-act=shortcuts] { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- desktop: list makes room for the side panel ---------- */
@media (min-width: 1100px) { body.has-panel .main { padding-right: calc(var(--panel-w) + 24px); } }
@media (max-width: 1099px) {
  .backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 14; background: rgba(10, 12, 16, .35); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
  body.has-panel .backdrop { opacity: 1; visibility: visible; transition: opacity .2s; }
}

/* ---------- tablet / phone ---------- */
@media (max-width: 900px) {
  .topbar-in { flex-wrap: wrap; height: auto; padding: 8px 16px 0; gap: 4px 12px; }
  .brand { flex: 1; min-height: 44px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px 6px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { height: 44px; padding: 0 10px; }
  .userbtn { min-height: 44px; }
  .userbtn .nm { display: none; }
  :root { --topbar-h: 104px; }
  .two, .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .main { padding: 16px 16px 40px; }
  h1 { font-size: 20px; }
  .detail { top: 0; width: 100%; z-index: 40; border-left: 0; }
  .detail-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .backdrop { display: none !important; }
  .search { flex-basis: 100%; max-width: none; }
  .search .kbd-hint { display: none; }
  .toolbar .spacer { display: none; }
  .toolbar .seg { display: flex; width: 100%; }
  .toolbar .seg button { flex: 1 1 auto; padding: 5px 4px; font-size: 13px; }
  .custom-range { flex-basis: 100%; } .custom-range input { width: auto; flex: 1; min-width: 0; }
  /* 44 px touch targets everywhere (.btn.sm is more specific than .btn, so it is named too) */
  .btn, .btn.sm, .tab, .seg button, .switch, .menu a, .menu button, .userbtn { min-height: 44px; }
  .btn.icon { width: 44px; }
  .copy { width: 44px; height: 44px; margin: -12px -8px; }
  .toast button { min-width: 44px; min-height: 44px; }
  .tbl a { display: inline-block; padding: 14px 0; margin: -12px 0; }
  .calls .cust .ph a { display: inline-block; padding: 14px 0; margin: -14px 0; } /* the row itself is the big target */
  .foot button { min-height: 44px; }
  .rv { width: 44px; height: 44px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 24px; }
  .filters select { min-width: 0; width: 100%; }
  .auth .card { padding: 22px; }
  .bubble { max-width: 92%; }
  .tbl-resp thead { display: none; }
  .tbl-resp tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .tbl-resp tr:last-child { border-bottom: 0; }
  .tbl-resp td { display: block; border: 0; padding: 2px 0; }
  .tbl-resp td[data-l]::before { content: attr(data-l) ': '; color: var(--faint); font-size: 12px; }
  .tbl-resp .row-actions { justify-content: flex-start; margin-top: 8px; }
  .toasts { bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media print { .topbar, .toolbar, .foot, .detail-head, .toasts { display: none !important; } .detail { position: static; transform: none; visibility: visible; width: auto; box-shadow: none; border: 0; } }
