/* Thynk AI customer portal — shared styles (matches the approved mockups). No inline styles: the CSP forbids them. */

:root {
  --ink: #181120; --ink-2: #3B3448; --ink-3: #5E5870; --ink-4: #6B6578; --ink-5: #A39CB2;
  --bg: #F6F5F9; --surface: #FFFFFF; --surface-2: #FBFAFD; --line: #E7E4EE; --line-2: #F1EEF5; --line-3: #DDD8E6;
  --brand: #6D28D9; --brand-strong: #4B1C99; --brand-mid: #8B37F5; --brand-wash: #F1E7FE; --brand-wash-2: #F8F3FF;
  /* outcome series (validated: lightness band, chroma, CVD separation) */
  --o-resolved: #6D28D9; --o-transferred: #B78CFF; --o-message: #14A38B; --o-abandoned: #E8890C; --o-unknown: #D6D1DE;
  --good-bg: #E3F4EA; --good: #0B6B3F; --bad-bg: #FDE8E6; --bad: #A8261B; --warn-bg: #FFF1DB; --warn: #8A4B00;
  --radius: 14px;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
button { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.h { font-family: var(--display); letter-spacing: -.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.side .logo { display: flex; align-items: center; padding: 4px 8px; }
.side .logo img { height: 30px; width: auto; display: block; }
.ws { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.ws .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-mid); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.ws .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ws .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .sub { font-size: 12px; color: var(--ink-3); }
.side nav { display: flex; flex-direction: column; gap: 18px; }
.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navhead { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); padding: 0 12px 6px; }
.navlink { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: #4A4458; text-decoration: none; font-weight: 500; }
.navlink:hover { background: #F6F3FA; color: var(--ink); }
.navlink.on { background: var(--brand-wash); color: var(--brand-strong); font-weight: 600; }
.navlink.soon { color: var(--ink-5); cursor: default; }
.navlink.soon:hover { background: transparent; color: var(--ink-5); }
.navlink .tag { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--ink-4); background: #F0EDF5; border-radius: 999px; padding: 2px 8px; }
.navlink svg { flex: none; }
.side .spacer { flex: 1; }
.devbox { border-radius: 12px; background: var(--brand-wash-2); border: 1px solid #E6D7FD; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.devbox .t { font-size: 12px; font-weight: 600; color: var(--brand-strong); text-transform: uppercase; letter-spacing: .06em; }
.devbox a { font-size: 12px; font-weight: 600; text-decoration: none; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 0; border-top: 1px solid var(--line-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-wash); color: var(--brand-strong); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.me .n { font-weight: 600; }
.me .r { font-size: 12px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 32px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 69px; }
.topbar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .menu { display: none; }
.topbar .mlogo { display: none; height: 26px; }
.content { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1320px; width: 100%; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; border: 1px solid var(--line-3); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: #F7F5FB; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-p:hover { background: #5B21B6; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.icobtn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: #EFECF5; gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; font-size: 13px; color: #4A4458; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(24,17,32,.12); }
.sel { height: 36px; border: 1px solid var(--line-3); border-radius: 10px; padding: 0 10px; font: 500 13px var(--font); color: var(--ink); background: #fff; max-width: 100%; }
.input { height: 40px; border: 1px solid var(--line-3); border-radius: 10px; padding: 0 12px; font: 400 14px var(--font); width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.good { background: var(--good-bg); color: var(--good); }
.bad { background: var(--bad-bg); color: var(--bad); }
.neutral { background: #F0EDF5; color: #4A4458; }
.purple { background: var(--brand-wash); color: #5B21B6; }
.warn { background: var(--warn-bg); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.live { background: #16A34A; box-shadow: 0 0 0 4px rgba(22,163,74,.18); }

/* ---------- page header ---------- */
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.pagehead .crumb { font-size: 13px; color: var(--ink-3); }
.pagehead h1 { margin: 4px 0 4px; font-size: 32px; font-weight: 700; }
.pagehead .tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cardpad { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cardhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cardhead h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.cardhead .sub { font-size: 13px; color: var(--ink-3); }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.grow2 { flex: 2 1 600px; min-width: 0; }
.grow1 { flex: 1 1 320px; min-width: 0; }
.loading { transition: opacity .15s; }
.loading.busy { opacity: .45; }

.note { font-size: 12px; color: var(--ink-4); }
.empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty h2 { margin: 0; font-size: 20px; }
.empty p { margin: 0; color: var(--ink-3); max-width: 520px; }
.alert { border-radius: 12px; padding: 12px 14px; background: var(--bad-bg); color: var(--bad); font-weight: 500; }
.info { border-radius: 12px; padding: 12px 14px; background: var(--brand-wash-2); border: 1px solid #E6D7FD; color: var(--ink-2); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 14px; }
.kpi { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.kpi .l { font-size: 13px; font-weight: 500; color: #4A4458; display: flex; justify-content: space-between; gap: 6px; }
.kpi .help { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ink-5); color: var(--ink-4); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; cursor: help; flex: none; }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.05; }
.kpi .s { font-size: 12px; color: var(--ink-4); }
.kpi svg { width: 100%; height: 34px; display: block; }

/* ---------- charts ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.sw-resolved { background: var(--o-resolved); } .sw-transferred { background: var(--o-transferred); }
.sw-message { background: var(--o-message); } .sw-abandoned { background: var(--o-abandoned); }
.sw-unknown { background: var(--o-unknown); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--ink-4); }
.chart .col:hover rect.seg, .chart .col:focus rect.seg { filter: brightness(1.08); }
.chart .col:focus { outline: none; }
.chart .col:focus .hit { stroke: var(--brand); stroke-width: 1.5; }
.stats { display: flex; flex-wrap: wrap; gap: 24px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats .k { font-size: 12px; color: var(--ink-3); }
.stats .val { font-family: var(--mono); font-size: 15px; font-weight: 600; }

.donutwrap { display: flex; justify-content: center; position: relative; }
.donutwrap svg { width: 196px; height: 196px; }
.donutwrap .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donutwrap .center b { font-family: var(--display); font-size: 30px; }
.donutwrap .center span { font-size: 12px; color: var(--ink-3); }
.mix { display: flex; flex-direction: column; }
.mix div { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.mix div:last-child { border-bottom: 0; }
.mix .lbl { flex: 1; }
.mix .c { font-family: var(--mono); color: var(--ink-2); }
.mix .p { font-family: var(--mono); width: 56px; text-align: right; color: var(--ink-3); }

.heat { overflow-x: auto; }
.heat table { border-collapse: separate; border-spacing: 3px; min-width: 620px; width: 100%; table-layout: fixed; }
.heat th { font: 500 11px var(--mono); color: var(--ink-4); text-align: left; padding: 0; }
.heat th.day { width: 40px; font: 500 12px var(--font); color: var(--ink-3); }
.heat td { height: 26px; border-radius: 4px; background: #F4F2F8; padding: 0; }
.heat td:hover, .heat td:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat .office { box-shadow: inset 0 -3px 0 rgba(109,40,217,.18); }
.heatkey { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-2); }
.heatkey .scale { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.heatkey .scale i { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }
.h0, .heat td.h0 { background: #F4F2F8; } .heat td.h1, .h1 { background: rgba(109,40,217,.14); } .heat td.h2, .h2 { background: rgba(109,40,217,.32); }
.heat td.h3, .h3 { background: rgba(109,40,217,.55); } .heat td.h4, .h4 { background: rgba(109,40,217,.8); } .heat td.h5, .h5 { background: #4B1C99; }

.intents { display: flex; flex-direction: column; gap: 14px; }
.intent { display: flex; flex-direction: column; gap: 6px; }
.intent .top { display: flex; justify-content: space-between; gap: 8px; }
.intent .n { font-family: var(--mono); color: var(--ink-2); }
.intent .track { height: 8px; border-radius: 99px; background: var(--line-2); }
.intent .fill { height: 8px; border-radius: 99px; background: var(--brand-mid); }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 12px; min-width: 150px; box-shadow: 0 8px 24px rgba(24,17,32,.22); }
.tip .t { font-weight: 600; margin-bottom: 6px; color: #E6E1EE; }
.tip .r { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.tip .r b { font-family: var(--mono); font-weight: 600; min-width: 24px; }
.tip .r i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.tip .r .nm { color: #CFC8DA; }

/* ---------- tables ---------- */
.tblwrap { overflow-x: auto; position: relative; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 12px 20px; border-bottom: 1px solid #ECE9F1; background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 14px 20px; border-bottom: 1px solid var(--line-2); color: #2A2335; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td, .tbl tbody tr.click:focus td { background: #FBF9FE; }
.tbl tbody tr.click:focus { outline: none; }
.tbl tbody tr.click:focus td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.tbl .num { text-align: right; font-family: var(--mono); }
.tbl .sub { font-size: 12px; color: var(--ink-4); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }
.pager .btns { display: flex; gap: 8px; }

/* ---------- call detail drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(24,17,32,.32); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(24,17,32,.16); }
.drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0 0 4px; font-size: 20px; }
.drawer .body { overflow-y: auto; padding: 20px 22px 32px; display: flex; flex-direction: column; gap: 20px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 18px; }
.facts .k { font-size: 12px; color: var(--ink-3); }
.facts .v { font-weight: 600; margin-top: 2px; word-break: break-word; }
.sec h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.summary { background: var(--brand-wash-2); border: 1px solid #E6D7FD; border-radius: 12px; padding: 12px 14px; color: var(--ink-2); }
.drawer audio { width: 100%; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 9px 12px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble .who { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.bubble.agent { align-self: flex-start; background: #F3F1F7; border-top-left-radius: 4px; }
.bubble.agent .who { color: var(--brand); }
.bubble.user { align-self: flex-end; background: var(--brand-wash); border-top-right-radius: 4px; }
.bubble.user .who { color: var(--brand-strong); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.privacy { font-size: 12px; color: var(--ink-4); border-top: 1px solid var(--line-2); padding-top: 12px; }

/* ---------- dev sign-in ---------- */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate .card { width: min(440px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.gate img { height: 30px; width: auto; align-self: flex-start; }
.gate h1 { margin: 0; font-size: 24px; }
.gate p { margin: 0; color: var(--ink-3); }
.gate label { font-weight: 600; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.userpick { display: flex; flex-direction: column; gap: 8px; }
.userpick button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.userpick button:hover { border-color: #CDB4F7; background: var(--brand-wash-2); }
.userpick .who { display: flex; flex-direction: column; }
.userpick .who small { color: var(--ink-3); }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  /* Pinned to the top AND bottom of what's visible, so the name and Sign out at the bottom aren't hidden behind a
     phone browser's toolbar (100vh is the height with the toolbars collapsed, taller than what's on screen). */
  .side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; z-index: 30; transform: translateX(-100%); transition: transform .2s;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); overscroll-behavior: contain; }
  /* above the dimmed overlay (.scrim, z-index 40) so taps reach the links */
  .side.open { transform: none; box-shadow: 12px 0 40px rgba(24,17,32,.16); z-index: 42; }
  .topbar { padding: 12px 16px; min-height: 0; }
  .topbar .menu { display: inline-flex; }
  .topbar .mlogo { display: block; }
  .content { padding: 20px 16px 40px; }
  .pagehead h1 { font-size: 26px; }
  .grow2, .grow1 { flex-basis: 100%; }
  .cardpad { padding: 16px; }
  .tbl th, .tbl td { padding: 12px 14px; }
  .hide-sm { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px 12px 10px; }
  .kpi .v { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- sign-in, sign out, team ---------- */
.gate .signin { justify-content: center; }
.staffsignin { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.gate .staffsignin .btn { flex: 1; }
.devsignin { border-top: 1px solid var(--line-2); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.devsignin h2 { margin: 0; font-size: 16px; }
.me .meinfo { flex: 1; min-width: 0; }
.linkbtn { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px; }
.linkbtn:hover { color: var(--brand-strong); text-decoration: underline; }
.rowactions { text-align: right; }
.rowactions .btn + .btn { margin-left: 8px; }
.btn.danger { background: var(--bad-bg); border-color: #F3C2BC; color: var(--bad); }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.formgrid label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.formgrid .wide { grid-column: 1 / -1; }
.formgrid .sel.input { height: 40px; font-size: 14px; }
.formbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.content > div:empty { display: none; }

/* ---------- support ---------- */
.views { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid #ECE9F1; padding: 0 12px; }
.views button { height: 46px; padding: 0 12px; border: 0; background: transparent; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.views button.on { color: var(--ink); border-bottom-color: var(--brand-mid); }
.views .count { font-size: 12px; background: #F0EDF5; color: #4A4458; border-radius: 999px; padding: 1px 8px; }
.views button.on .count { background: var(--brand-wash); color: var(--brand-strong); }
.back { font-weight: 600; text-decoration: none; font-size: 14px; }
.casetitle { margin: 6px 0 10px; font-size: 22px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.msg.thynk { background: var(--brand-wash-2); border-color: #E6D7FD; }
.msg.internalnote { background: #FFF8EC; border-color: #F5DDB0; border-style: dashed; }
.msg .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.msg .body { white-space: pre-wrap; line-height: 1.5; word-break: break-word; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.replybox { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.replybox.internal .ta { background: #FFF8EC; border-color: #F5DDB0; }
.ta { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.45; font-family: var(--font); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint, .hint { font-weight: 400; font-size: 12px; color: var(--ink-4); }
.field.wide { grid-column: 1 / -1; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { flex: 1 1 90px; height: 36px; border-radius: 9px; border: 1px solid var(--line-3); background: #fff; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.pill.on { border-color: var(--brand); background: var(--brand-wash); color: var(--brand-strong); }
.sidepanel { gap: 14px; align-self: flex-start; }
.sidepanel .sel.input { height: 40px; }

/* ---------- agents ---------- */
.agentgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; transition: opacity .15s; }
.agentgrid.busy { opacity: .45; }
.agentcard { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.agenthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.agenthead h2 { margin: 0 0 2px; font-size: 18px; }
.numbers { display: flex; flex-direction: column; gap: 4px; }
.numbers .num { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.metrics .m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metrics .k { font-size: 12px; color: var(--ink-3); }
.metrics .v { font-family: var(--mono); font-size: 15px; font-weight: 600; }
.spark { width: 100%; height: 36px; display: block; }
.agentfoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 13px; }
.filterchip { display: inline-flex; align-self: flex-start; align-items: center; gap: 10px; background: var(--brand-wash-2); border: 1px solid #E6D7FD; border-radius: 999px; padding: 6px 8px 6px 14px; font-size: 13px; }
@media (max-width: 960px) { .agentgrid { grid-template-columns: 1fr; } .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- profile ---------- */
.me a.meinfo { color: inherit; text-decoration: none; border-radius: 8px; }
.me a.meinfo:hover .n, .me a.meinfo:focus-visible .n { color: var(--brand, #6D28D9); text-decoration: underline; }
.profilehead { display: flex; align-items: center; gap: 16px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; flex: none; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.checkrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line, #E7E4EE); cursor: pointer; }
.checkrow:first-of-type { border-top: 0; }
.checkrow input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: #6D28D9; flex: none; }
.checkrow .t { font-weight: 600; }
.checkrow .d { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.checkrow.locked { cursor: default; }
.checkrow.locked input { accent-color: #9C95A8; }
.inlinemsg { font-size: 13px; color: var(--ink-3); min-height: 18px; }
.inlinemsg.ok { color: #14A38B; }
.inlinemsg.bad { color: #B42318; }
.pform { display: grid; gap: 12px; margin-top: 4px; }
.pform .formbtns { align-items: center; }
.pnote { margin: 14px 0 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- billing ---------- */
.billbanner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.meterhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.meterhead .big { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1; }
.meter { display: flex; gap: 2px; height: 14px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.meter-used { background: var(--brand); min-width: 4px; }
.meter-over { background: #E8890C; }
.meterkey { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.meterkey span { display: inline-flex; align-items: center; gap: 6px; }
.meterkey i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.meterkey .k-used { background: var(--brand); }
.meterkey .k-over { background: #E8890C; }
.chart text.reflabel { font-family: var(--font); font-size: 12px; fill: var(--ink-3); }
.planform .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.plansummary { font-size: 14px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tbl tr.sel td { background: var(--brand-wash-2); }
.tbl.compact th, .tbl.compact td { padding: 10px 8px; }
.tbl.compact th:first-child, .tbl.compact td:first-child { padding-left: 0; }
.tbl.compact th:last-child, .tbl.compact td:last-child { padding-right: 0; }
.tbl.compact th { background: transparent; }
/* Staff → Customers agent list: the agent's details wrap so its action buttons stay in view. */
.tbl.agentbuilds td:first-child { white-space: normal; min-width: 220px; }
h3.subhead { margin: 4px 0 6px; font-size: 15px; font-weight: 600; }
/* one-time charges (staff Billing plans) */
.row + .card { margin-top: 16px; }
.chargeform { display: flex; flex-direction: column; gap: 14px; }
.chargeform .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.setupfee { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- onboarding ---------- */
.small { font-size: 13px; }
.radios { display: flex; flex-wrap: wrap; gap: 18px; margin: 10px 0 12px; }
.radios input { accent-color: #6D28D9; }
.plainlist { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.inlineform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inlineform label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.cardhead .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wizstep { display: flex; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.wizstep:first-of-type { border-top: 0; }
.wiznum { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-wash); color: #5B21B6; font-weight: 700; display: grid; place-items: center; }
.wizbody { flex: 1; min-width: 0; display: grid; gap: 8px; }
.stepper { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 4px 0 14px; padding: 0; counter-reset: st; }
.stepper li { counter-increment: st; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3); }
.stepper li::before { content: counter(st) ". "; }
.stepper li.done { color: #14A38B; border-color: #BFE8DF; background: #EEFAF7; }
.stepper li.done::before { content: "✓ "; }
.stepper li.now { color: #5B21B6; border-color: #D9C2FC; background: var(--brand-wash-2); font-weight: 600; }
.nextstep { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.addagent { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 10px; }
.lifebanners { display: grid; gap: 8px; padding: 16px 32px 0; max-width: 1320px; width: 100%; }
.lifebanner { border-radius: 12px; padding: 10px 14px; background: var(--brand-wash-2); border: 1px solid #E6D7FD; color: var(--ink-2); font-size: 14px; }
.lifebanner.warn { background: #FFF6E8; border-color: #F6D9A8; }
.agreegate { max-width: 520px; text-align: left; display: grid; gap: 12px; }
.agreegate label[for="ag-org"] { display: grid; gap: 6px; font-weight: 600; }
@media (max-width: 720px) { .lifebanners { padding: 12px 16px 0; } }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.6; }
.legal h2 { font-size: 18px; margin: 24px 0 6px; }
.draftnote { background: #FFF6E8; border: 1px solid #F6D9A8; border-radius: 12px; padding: 10px 14px; }
.errtext { color: #B42318; }
.agreegate label.checkrow { display: flex; flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 400; }

/* ---------- chat agents (Chats page, channel switch, chat meters) ---------- */
:root { --chat: #0E7C6B; --chat-mid: #14A38B; --chat-wash: #E2F5F1; }
.sw-chat { background: var(--chat-mid); } .sw-voice { background: var(--brand); }
.filterrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: #4A4458; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chipbtn:hover { border-color: #BFE6DD; color: var(--ink); }
.chipbtn[aria-pressed="true"] { background: var(--chat-wash); border-color: #BFE6DD; color: var(--chat); }
.usageline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 18px; }
.usageline .lbl { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.usageline .bar { flex: 1 1 200px; height: 8px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.usageline .bar i { display: block; height: 100%; background: var(--chat-mid); border-radius: 6px; }
.bubble.agent.chat { background: var(--chat-wash); }
.bubble.agent.chat .who { color: var(--chat); }
.meter-used.meter-chat { background: var(--chat-mid); }
.meterkey .k-used.k-chat { background: var(--chat-mid); }
.badge.teal { background: var(--chat-wash); color: var(--chat); }
.seg .sw { margin-right: 6px; vertical-align: -1px; }
.kpi .split { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.kpi .split span { display: inline-flex; align-items: center; gap: 5px; }
.planusage { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 28px; }
.planusage .m { display: flex; flex-direction: column; gap: 8px; }
.planusage .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.planusage .top .lbl { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.planusage .top .val { font-family: var(--mono); font-size: 13px; }
.planusage .track { position: relative; height: 10px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.planusage .track i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; }
.planusage .note2 { font-size: 12px; color: var(--ink-3); }
