/* Web-only additions on top of the shared dashboard styles (tokens.css + dashboard.css). */

/* Sidebar: signed-in person + sign out */
.side-user .u-meta { min-width: 0; flex: 1; }
.side-user .u-name, .side-user .u-plan { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-signout { flex: none; }

/* Team tab */
.team-actions { display: inline-flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Sign-in and admin pages */
body.auth-page { margin: 0; min-height: 100vh; background: var(--color-background); color: var(--color-text); font-family: var(--font); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; box-sizing: border-box; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md); padding: 32px; box-sizing: border-box;
}
.auth-brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 23px; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-brand .wordmark { font-weight: 900; }
.auth-brand .logo { width: 36px; height: 36px; flex: none; display: block; }
.auth-tagline { margin: 0 0 24px; color: var(--color-text-muted); font-size: 13.5px; }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .sub { margin: 0 0 20px; color: var(--color-text-secondary); font-size: 13.5px; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .field { margin: 0; }
.auth-card .btn { width: 100%; justify-content: center; height: 40px; }
.auth-switch { margin: 18px 0 0; text-align: center; font-size: 13.5px; color: var(--color-text-secondary); }
.auth-switch button { background: none; border: 0; padding: 0; color: var(--color-primary); font: inherit; font-weight: 600; cursor: pointer; }
.auth-error {
  display: none; padding: 10px 12px; border-radius: var(--radius); background: var(--color-danger-soft);
  color: var(--color-danger-text); font-size: 13px;
}
.auth-error.show { display: block; }
.auth-notice {
  display: none; padding: 10px 12px; border-radius: var(--radius); background: var(--color-warning-soft);
  color: var(--color-warning-text); font-size: 13px; line-height: 1.45;
}
.auth-notice.show { display: block; }
.auth-hint { margin: -4px 0 0; font-size: 12px; color: var(--color-text-muted); text-align: center; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--color-text-muted); }
.auth-foot.auth-help { margin-top: 6px; }

/* Super admin */
/* "Admin" under the name: the logo's typeface is too wide for a tag beside it */
.side-brand .admin-brand { display: flex; flex-direction: column; gap: 4px; }
.admin-tag { font-family: var(--font); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; line-height: 1; color: var(--color-primary); }
.nav-item .count.attention { background: var(--color-warning-soft); color: var(--color-warning-text); }
.seg-count { font-weight: 500; color: var(--color-text-muted); margin-left: 2px; }
.seg-btn.active .seg-count { color: inherit; }
tr.clickable-row { cursor: pointer; }
.toolbar .search-wrap.grow .input { width: 100%; }
table.data.compact tbody td { padding: 9px 10px; }
table.data.compact thead th { padding-left: 10px; padding-right: 10px; }
.settings-panel { max-width: 820px; margin-bottom: 18px; }
.drawer.wide { width: 600px; }
.drawer .d-section .table-wrap { margin: 0 -4px; }
td.when { text-align: right; white-space: nowrap; vertical-align: top; }
.person-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--color-text-muted); }

.side-theme, .side-signout { flex: none; }
.warn-text { color: var(--color-warning-text); font-weight: 600; }
.badge-stack { display: flex; flex-wrap: wrap; gap: 4px; }
.modal-card.wide { width: min(860px, calc(100vw - 32px)); max-width: none; }
.devices-body { max-height: 60vh; overflow-y: auto; }
.modal-foot .spacer { flex: 1; }

/* Sidebar: your name opens your account */
.u-meta-button { cursor: pointer; border-radius: 6px; }
.u-meta-button:hover .u-name { text-decoration: underline; }
.u-meta-button:focus-visible { outline: none; box-shadow: var(--ring); }

/* Calling: the bar that stays on screen during a call */
/* Bottom centre, above the carrier drawer (50) and below dialogs (60) and toasts (80) */
.call-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 55; width: 360px; max-width: calc(100vw - 32px);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); padding: 14px 16px; box-sizing: border-box;
}
.call-bar .cb-top { display: flex; align-items: center; gap: 10px; }
.call-bar .cb-live { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--color-success); animation: callPulse 1.2s ease-in-out infinite; }
.call-bar .cb-who { min-width: 0; flex: 1; }
.call-bar .cb-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-size: 14px; }
.call-bar .cb-num { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.call-bar .cb-dial { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--color-border-strong); }
.call-bar .cb-dial:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.call-bar .cb-timer { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.call-bar .cb-hint { margin: 8px 0 10px; font-size: 12px; color: var(--color-text-muted); }
.call-bar .cb-actions { display: flex; justify-content: space-between; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .call-bar .cb-live { animation: none; } }
/* A call through the company's VICIdial or SIP service: its live status and controls (dialer.js) */
.call-bar .cb-status { margin: 8px 0 10px; font-size: 12.5px; color: var(--color-text-secondary); }
.call-bar .cb-status.live { color: var(--color-success-text); }
.call-bar .cb-status.done { color: var(--color-warning-text); }
.call-bar .cb-via { display: inline-block; margin-right: 4px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 650;
  background: var(--color-surface-secondary); color: var(--color-text-secondary); }
.call-bar .cb-controls { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.call-bar .cb-controls .btn { flex: 1 1 0; justify-content: center; }
.call-bar .cb-controls .btn.on { background: var(--color-primary-soft); color: var(--color-primary); border-color: var(--color-primary); }
.call-bar .cb-keypad { margin-bottom: 10px; }
.call-bar .cb-keypad .kp-key { height: 36px; }
/* An incoming call on the browser phone sits above the call bar */
.call-bar.in-call-bar { bottom: auto; top: 20px; z-index: 56; }

/* Settings → Calling */
.calling-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.calling-choice { display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; padding: 12px 14px;
  border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; }
.calling-choice b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.calling-choice span { font-size: 12px; color: var(--color-text-muted); }
.calling-choice:hover { border-color: var(--color-border-strong); }
.calling-choice.on { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.calling-choice:focus-visible { outline: none; box-shadow: var(--ring); }
.calling-ok { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--color-success-soft); color: var(--color-success-text); }
.calling-ok .warn-text { display: block; margin-top: 4px; }
.calling-help { margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-secondary); font-size: 12.5px; }
.calling-help summary { cursor: pointer; font-weight: 650; }
.calling-help ol, .calling-help p { margin: 8px 0 0; padding-left: 18px; color: var(--color-text-secondary); }
.calling-help p { padding-left: 0; }
.calling-help li + li { margin-top: 4px; }
.check-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; }
.check-line input { margin-top: 3px; flex: none; }
.check-line span { display: flex; flex-direction: column; gap: 2px; }
.check-line b { font-weight: 600; }
.dispo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; padding: 12px; border-radius: var(--radius); background: var(--color-surface-secondary); }
.dispo-grid .field { min-width: 0; }
.dispo-grid .field label { font-size: 11.5px; font-weight: 600; color: var(--color-text-secondary); }
@media (max-width: 720px) {
  .calling-choices { grid-template-columns: 1fr; }
  .dispo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: a page's title sits above its tabs or buttons instead of beside them, and a long tab strip scrolls
   sideways inside itself (Settings has five tabs for owners) instead of widening the whole page. */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; padding: 16px; }
  .topbar .titles { flex: 1 1 100%; }
  .topbar .spacer { display: none; }
  .topbar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topbar .seg-btn { flex: none; white-space: nowrap; }
}

/* Calling: choosing how the call went */
.outcome-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.outcome-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); font: inherit;
}
.outcome-btn b { font-size: 13.5px; }
.outcome-btn span { font-size: 12px; color: var(--color-text-muted); }
.outcome-btn:hover { border-color: var(--color-border-strong); background: var(--color-surface-secondary); }
.outcome-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.outcome-btn.on { border-color: var(--color-primary); background: var(--color-primary-soft); box-shadow: inset 0 0 0 1px var(--color-primary); }
.outcome-btn.success b { color: var(--color-success-text); }
.outcome-btn.warning b { color: var(--color-warning-text); }
.outcome-btn.danger b { color: var(--color-danger-text); }
@media (max-width: 520px) { .outcome-grid { grid-template-columns: 1fr; } }

/* Calling: history in the carrier drawer */
.web-calls .wc-actions { margin-bottom: 10px; }
.web-calls .wc-list { display: flex; flex-direction: column; gap: 6px; }
.web-calls .wc-row { padding: 8px 10px; background: var(--color-surface-secondary); border-radius: 8px; }
.web-calls .wc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.web-calls .wc-note { margin-top: 4px; font-size: 13px; color: var(--color-text-secondary); white-space: pre-wrap; }

/* Performance */
.perf-table td, .perf-table th { white-space: nowrap; }
.perf-note { max-width: 320px; white-space: normal; }
.perf-footnote { margin-top: 14px; }

@media (max-width: 520px) {
  .auth-card { padding: 24px 20px; }
}

/* Plan: trial reminder and the paywall when a plan has ended */
.trial-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; margin: 0 0 4px;
  background: var(--color-warning-soft); color: var(--color-warning-text); font-size: 13.5px; border-bottom: 1px solid var(--color-border);
}
.trial-banner span { flex: 1; min-width: 200px; }
.paywall {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 23, 42, .55);
}
.paywall-card {
  width: min(460px, 100%); background: var(--color-surface); color: var(--color-text); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); padding: 28px; box-sizing: border-box;
}
.paywall-card h2 { margin: 0 0 8px; font-size: 20px; }
.paywall-card p { margin: 0 0 10px; color: var(--color-text-secondary); font-size: 14px; line-height: 1.5; }
.paywall-card .paywall-sub { color: var(--color-text-muted); font-size: 13px; }
.paywall-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* The page couldn't open yet (bad connection, server restarting): shown instead of an empty dashboard */
.boot-notice { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 16px; pointer-events: none; }
.boot-notice-card {
  pointer-events: auto; width: min(440px, 100%); background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 24px; box-sizing: border-box;
}
.boot-notice-card h2 { margin: 0 0 8px; font-size: 18px; }
.boot-notice-card p { margin: 0 0 10px; color: var(--color-text-secondary); font-size: 14px; line-height: 1.5; }
.boot-notice-card .boot-notice-detail { font-size: 12.5px; color: var(--color-text-muted); overflow-wrap: anywhere; }

/* Something went wrong after the page opened (boot.js): a slim bar with Reload, above the call bar and dialogs.
   At the top: a phone's browser bars change the bottom of the screen, and a bar there could end up out of sight. */
.app-error-bar {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 86;
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box;
  padding: 10px 10px 10px 16px; border-radius: var(--radius-lg); border: 1px solid var(--color-warning);
  background: var(--color-warning-soft); color: var(--color-warning-text); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600;
}
.app-error-bar .icon-btn { width: 30px; height: 30px; font-size: 18px; color: inherit; }

/* Sales tools: call-backs and today's numbers */
.fu-panel { margin-bottom: 18px; }
.fu-panel .panel-head { flex-wrap: wrap; row-gap: 8px; }
.fu-panel td:first-child { width: 1%; white-space: nowrap; }
.fu-more { padding: 8px 14px; border-top: 1px solid var(--color-border); }
.today-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.today-stat { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-secondary); }
.today-stat b { color: var(--color-text); }
.today-stat.met b { color: var(--color-success-text); }
.mini-bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--color-surface-secondary); overflow: hidden; vertical-align: middle; }
.mini-bar > span { display: block; height: 100%; background: var(--color-primary); border-radius: 3px; }
.target-met + .mini-bar > span, .today-stat.met .mini-bar > span, .mini-bar.met > span { background: var(--color-success); }
td .mini-bar { margin-top: 4px; }
.perf-table .rank { width: 1%; color: var(--color-text-muted); text-align: center; }
/* Performance: picked days, and who researched which ranges */
#perfPick { display: inline-flex; align-items: center; gap: 6px; }
.topbar:has(#perfPick) { flex-wrap: wrap; row-gap: 12px; }
.range-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--color-border); }
.range-chips .chip b { font-weight: 700; font-variant-numeric: tabular-nums; }
.ranges-table td { white-space: nowrap; }
/* Dashboard (owners): call-backs, and the team's table on phones */
.cb-list { list-style: none; margin: 0; padding: 4px 0; }
.cb-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.cb-row + .cb-row { border-top: 1px solid var(--color-border); }
.cb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cb-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.cb-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
@media (max-width: 560px) {
  .cb-row { padding: 10px 14px; }
  .dash-grid .hide-sm { display: none; }
}
.perf-table .rank.top { color: var(--color-primary); font-weight: 700; }

/* Who works a prospect */
.web-assign { margin-top: 14px; }
.assign-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.assign-line .k { color: var(--color-text-muted); font-size: 12.5px; min-width: 84px; }
.assign-line .select { min-width: 180px; }
.assign-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; }
@media (max-width: 520px) { .assign-list { grid-template-columns: 1fr; } }

/* Sign-in page: forgot / reset password */
.auth-link { background: none; border: 0; padding: 0; color: var(--color-primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; justify-self: end; }
.auth-legal { margin-top: 10px; text-align: center; font-size: 12px; color: var(--color-text-muted); }
.auth-legal a { color: var(--color-text-secondary); }

/* Saved Prospects: company names (and who works them) stay readable in the wide table */
#view table.data td[data-open] { min-width: 170px; }

/* Settings → Team: whose prospects a sales person sees */
.vis-body .check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.vis-some { margin: 4px 0 0 26px; padding: 0; border: 0; min-width: 0; }
.vis-some:disabled { opacity: .45; }

/* Email (email.js): the Email page, template editor, composer and the carrier drawer's emails */
.modal-card:has(> .modal-wide) { width: 760px; }
/* While writing an email or a template, notices appear at the top instead of over the Send and Save buttons. */
body:has(.modal-card.show > .modal-wide) .toasts { top: 20px; bottom: auto; }
.email-cell .phone-num { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.email-body { font-size: 14px; line-height: 1.55; color: var(--color-text); overflow-wrap: anywhere; }
.email-body p, .email-body ul, .email-body ol, .email-body blockquote { margin: 0 0 .9em; }
.email-body ul, .email-body ol { padding-left: 1.4em; }
.email-body blockquote { padding-left: 12px; border-left: 3px solid var(--color-border); color: var(--color-text-secondary); }
.email-body a { color: var(--color-primary); }
.email-body > :last-child { margin-bottom: 0; }

.rt { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.rt:focus-within { border-color: var(--color-primary); box-shadow: var(--ring); }
.rt-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-secondary); border-radius: var(--radius) var(--radius) 0 0; }
.rt-btn { min-width: 30px; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-secondary); font: 600 13px var(--font); cursor: pointer; display: inline-grid; place-items: center; }
.rt-btn:hover { background: var(--color-surface); color: var(--color-text); }
.rt-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--color-border); }
.rt-link { display: flex; align-items: center; gap: 6px; padding: 6px; border-bottom: 1px solid var(--color-border); }
.rt-link[hidden] { display: none; }
.rt-link .input { flex: 1; min-width: 0; height: 32px; }
.rt-area { min-height: 180px; max-height: 42vh; overflow-y: auto; padding: 10px 12px; outline: none; }
.compose-body .rt-area { max-height: none; }
.compose-body > div:empty { display: none; } /* notes that aren't showing leave no gap */
mark.var-missing { background: var(--color-warning-soft); color: var(--color-warning-text); border-radius: 4px; padding: 0 2px; }

.var-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--color-surface-secondary); }
.var-head { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.var-group { display: flex; flex-direction: column; gap: 6px; }
.var-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); }
.var-chip { padding: 4px 10px; font-size: 12.5px; }

.tpl-card { display: flex; align-items: flex-start; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--color-border); }
.tpl-card:last-child { border-bottom: none; }
.tpl-main { flex: 1; min-width: 0; }
.tpl-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 650; }
.tpl-subject { margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.tpl-snippet { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.tpl-default { display: inline-flex; align-items: center; gap: 4px; background: var(--color-primary-soft); color: var(--color-primary); }
.tpl-foot { margin: 10px 2px 0; }
.tpl-preview { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius); }
.tpl-preview[hidden] { display: none; }
.preview-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.preview-row .select { flex: 1; min-width: 200px; }

.compose-head { display: flex; align-items: flex-start; gap: 12px; }
.compose-head > div { flex: 1; min-width: 0; }
.compose-grid { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 8px 12px; font-size: 13.5px; }
.compose-k { font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.compose-v { min-width: 0; overflow-wrap: anywhere; }
.compose-alert { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--color-text-secondary); }
.compose-alert.warn { color: var(--color-warning-text); }
.compose-note { min-width: 0; }
.missing-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.missing-name { min-width: 130px; font-weight: 600; }
.missing-row .input { flex: 1; min-width: 160px; height: 32px; }
.recent-body { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--color-surface); }
.recent-body[hidden] { display: none; }
.switch-box { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.switch-box .switch-actions { display: inline-flex; gap: 6px; }
.discard-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--color-border); background: var(--color-warning-soft); color: var(--color-warning-text); font-size: 13px; }
.discard-bar .spacer { flex: 1; }

.email-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sent-subject { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--color-border); }
.sent-meta { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; overflow-wrap: anywhere; }
.sent-body { padding-top: 14px; border-top: 1px solid var(--color-border); }
.gmail-panel { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.gmail-panel .s-desc { margin: 0; font-size: 13px; color: var(--color-text-secondary); }
.gmail-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14px; }
.gm-test[hidden] { display: none; }
.gm-test { display: flex; flex-direction: column; gap: 10px; }
.plain-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 18px; font-size: 13px; color: var(--color-text-secondary); }
.web-calls .wc-email { display: block; width: 100%; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.web-calls .wc-email:hover { background: var(--color-primary-soft); }
.web-calls .wc-email .wc-note { display: block; }
@media (max-width: 640px) {
  .compose-grid, .sent-meta { grid-template-columns: minmax(0, 1fr); }
  .tpl-card { flex-direction: column; }
  .tpl-actions { justify-content: flex-start; }
}

/* Settings: a sales person's qualification criteria are their own or the company's */
.note.prefs-source { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }

/* ---------------- Support chat (support.js for owners, admin.js for staff) ---------------- */
/* The chat fills the screen under the top bar; its list and messages scroll inside it */
.sup-layout { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px; height: calc(100vh - 150px); height: calc(100dvh - 150px); min-height: 460px; }
.sup-side, .sup-main { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sup-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.sup-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-disabled); }
.sup-live.on { color: var(--color-success-text); }
.sup-live.on::before { background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-soft); }
.sup-list { flex: 1; overflow-y: auto; padding: 6px; }
.sup-list-loading { display: grid; gap: 10px; padding: 12px; }
.sup-list-loading .skeleton { height: 46px; }
.sup-empty { padding: 18px 14px; font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }
.sup-item {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 2px; border: 1px solid transparent;
  border-radius: var(--radius); background: transparent; color: var(--color-text); font: inherit; cursor: pointer;
}
.sup-item:hover { background: var(--color-surface-secondary); }
.sup-item.active { background: var(--color-primary-softer); border-color: var(--color-primary-soft); }
.sup-item:focus-visible { outline: none; box-shadow: var(--ring); }
.sup-item-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sup-item-subject { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-item.unread .sup-item-subject { font-weight: 750; }
.sup-item-time { font-size: 11.5px; color: var(--color-text-muted); white-space: nowrap; }
.sup-item-preview { font-size: 12.5px; color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-item-sub { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-item-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sup-item-foot .sup-dot { margin-left: auto; }
.sup-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); flex: none; }
.sup-contact { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--color-border); font-size: 13px; overflow-wrap: anywhere; }
.sup-contact-ic { color: var(--color-text-muted); margin-top: 1px; }
.sup-contact-k { font-size: 12px; color: var(--color-text-muted); }
.sup-contact a, .sup-alt a, .sup-pw-foot a { color: var(--color-primary); font-weight: 600; }

.sup-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sup-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--color-border); }
.sup-titles { flex: 1; min-width: 0; }
.sup-titles h2 { margin: 0; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sup-back { display: none; }
.sup-back svg, #supPwBack svg { transform: rotate(180deg); }
.sup-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; background: var(--color-background); }
.sup-msgs-loading { display: grid; gap: 12px; padding: 8px 0; }
.sup-msgs-loading .skeleton { height: 38px; width: 60%; }
.sup-msgs-loading .skeleton:nth-child(2) { margin-left: auto; width: 45%; }
.sup-msgs-error { padding: 4px 0; }
.sup-intro { display: flex; gap: 8px; align-items: flex-start; margin: 0 auto 8px; max-width: 460px; font-size: 12px; line-height: 1.45; color: var(--color-text-muted); }
.sup-intro svg { flex: none; margin-top: 1px; }
.sup-day { display: flex; justify-content: center; margin: 10px 0 6px; }
.sup-day span { font-size: 11px; font-weight: 600; color: var(--color-text-muted); background: var(--color-surface); border: 1px solid var(--color-border); padding: 2px 10px; border-radius: 999px; }
.sup-event { align-self: center; text-align: center; margin: 6px 0; font-size: 12px; color: var(--color-text-muted); }
.sup-event.internal { color: var(--color-warning-text); }
.sup-msg { display: flex; flex-direction: column; max-width: min(78%, 620px); margin-top: 6px; }
.sup-msg.mine { align-self: flex-end; align-items: flex-end; }
.sup-msg.theirs { align-self: flex-start; align-items: flex-start; }
.sup-who { font-size: 11.5px; font-weight: 600; color: var(--color-text-secondary); margin: 4px 4px 3px; }
.sup-bubble {
  padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border);
}
.sup-msg.mine .sup-bubble { background: var(--color-primary); color: #fff; border-color: transparent; border-bottom-right-radius: 5px; }
.sup-msg.theirs .sup-bubble { border-bottom-left-radius: 5px; }
.sup-msg.mine .sup-bubble a { color: #fff; text-decoration: underline; }
.sup-msg.theirs .sup-bubble a { color: var(--color-primary); }
.sup-msg.sup-note .sup-bubble { background: var(--color-warning-soft); color: var(--color-warning-text); border: 1px dashed var(--color-warning); }
.sup-msg.sup-note .sup-bubble a { color: inherit; }
.sup-msg.pending .sup-bubble { opacity: .7; }
.sup-msg.failed .sup-bubble { background: var(--color-danger-soft); color: var(--color-danger-text); }
.sup-meta { font-size: 11px; color: var(--color-text-muted); margin: 3px 4px 0; }
.sup-meta .linklike { font-size: 11px; }
.sup-typing { min-height: 22px; padding: 2px 16px; font-size: 12px; color: var(--color-text-muted); display: flex; align-items: center; gap: 6px; background: var(--color-background); }
.sup-dots { display: inline-flex; gap: 3px; }
.sup-dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: supDot 1.2s infinite ease-in-out; }
.sup-dots i:nth-child(2) { animation-delay: .15s; }
.sup-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes supDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .sup-dots i { animation: none; } }
.sup-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 4px; border-top: 1px solid var(--color-border); }
.sup-compose textarea { flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 168px; padding: 9px 12px; line-height: 1.4; font: inherit; font-size: 14px; box-sizing: border-box; }
.sup-send { height: 40px; }
.sup-compose-hint { padding: 0 14px 8px; font-size: 11px; color: var(--color-text-muted); }

.sup-new { padding: 22px 24px; overflow-y: auto; height: 100%; box-sizing: border-box; }
.sup-hello { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.sup-hello-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--color-primary-soft); color: var(--color-primary); flex: none; }
.sup-hello h2 { margin: 0 0 4px; font-size: 18px; font-weight: 650; }
.sup-hello p { margin: 0; font-size: 13.5px; color: var(--color-text-secondary); line-height: 1.5; max-width: 560px; }
.sup-topics { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.sup-topics legend { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 8px; padding: 0; }
.sup-topic { position: relative; }
.sup-topic input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sup-topic span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border); font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); background: var(--color-surface); }
.sup-topic input:checked + span { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); }
.sup-topic input:focus-visible + span { box-shadow: var(--ring); }
.sup-new .field { margin-bottom: 12px; }
.sup-new .input { width: 100%; box-sizing: border-box; }
.sup-new textarea.input { resize: vertical; min-height: 120px; font: inherit; font-size: 14px; line-height: 1.45; padding: 10px 12px; }
.sup-count { text-align: right; }
.sup-new-error { color: var(--color-danger-text); font-size: 13px; margin-bottom: 8px; }
.sup-new-error:empty { display: none; }
.sup-new-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sup-alt { display: flex; gap: 8px; align-items: center; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-secondary); overflow-wrap: anywhere; }

/* On the chat pages toasts sit top right, off the message box and its Send buttons */
body:has(.sup-layout) .toasts { top: 20px; bottom: auto; }
.toast.sup-toast { border-left-color: var(--color-primary); cursor: pointer; text-align: left; font: inherit; font-size: 13.5px; color: var(--color-text); }
.toast.sup-toast .t-ic { color: var(--color-primary); }
.sup-toast-text { display: grid; gap: 2px; min-width: 0; }
.sup-toast-text span { color: var(--color-text-secondary); overflow-wrap: anywhere; }

/* Over the plan-ended notice */
.paywall-card.sup-pw { width: min(640px, 100%); height: min(680px, calc(100vh - 32px)); height: min(680px, calc(100dvh - 32px)); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.sup-pw-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--color-border); }
.sup-pw-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.paywall-card.sup-pw h2 { margin: 0; font-size: 16px; }
.paywall-card.sup-pw p { margin: 0; }
.sup-pw-main { flex: 1; }
.sup-pw-main .sup-head { padding: 10px 14px; }
.sup-pw-foot { padding: 8px 14px 12px; font-size: 12.5px; color: var(--color-text-muted); border-top: 1px solid var(--color-border); overflow-wrap: anywhere; }

/* The collapsed menu (tablets, phones) has no room for counts: unread answers show as a dot */
@media (max-width: 820px) {
  .nav-item { position: relative; }
  .nav-item .count.attention { display: block; position: absolute; top: 5px; right: 9px; width: 9px; height: 9px; padding: 0; font-size: 0; border-radius: 50%; background: var(--color-danger); }
  /* One pane at a time: the list, or the conversation (or the new-conversation form), using the whole screen */
  .main:has(.sup-layout) .topbar { padding: 12px 14px; flex-wrap: nowrap; }
  .main:has(.sup-layout) .topbar .titles { flex: 1 1 auto; }
  .main:has(.sup-layout) .topbar .subtitle { display: none; }
  .main:has(.sup-layout) .view { padding: 10px; }
  .sup-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 86px); height: calc(100dvh - 86px); min-height: 380px; }
  .sup-layout[data-mode="list"] .sup-main, .sup-layout[data-mode="thread"] .sup-side, .sup-layout[data-mode="new"] .sup-side { display: none; }
  .sup-back { display: inline-flex; }
  .sup-msg { max-width: 88%; }
}
@media (max-width: 560px) {
  .sup-head { flex-wrap: wrap; padding: 10px 12px; }
  .sup-head-actions { width: 100%; justify-content: flex-start; }
  .sup-new { padding: 16px; }
  .sup-send span { display: none; }
  #supNewBtn span, #saNewBtn span { display: none; }
  .sup-compose-hint { display: none; }
}

/* ---------------- Super admin: Support inbox (admin.js) ---------------- */
.kpis.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sa-layout { position: relative; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(240px, 280px); }
.sa-list-head { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
.sa-list-head .seg-btn { padding: 5px 9px; }
.sa-tools { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
.sa-tools .search-wrap { flex: 1; min-width: 0; }
.sa-tools .search-wrap .input { width: 100%; box-sizing: border-box; }
.sa-tools .select { width: auto; flex: none; }
.sa-wait { font-size: 11.5px; font-weight: 600; color: var(--color-warning-text); }
.sa-who { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--color-neutral-soft); color: var(--color-neutral-text); font-size: 10.5px; font-weight: 700; }
.sa-none { display: grid; place-items: center; height: 100%; padding: 20px; }
.sa-controls { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.sa-ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.sa-ctl .select { height: 30px; font-size: 12.5px; padding-top: 0; padding-bottom: 0; }
.sa-compose-wrap { border-top: 1px solid var(--color-border); }
.sa-compose-wrap .sup-compose { border-top: 0; padding-top: 6px; }
.sa-modes { margin: 8px 12px 0; }
.sa-compose-wrap.sa-noting { background: var(--color-warning-soft); }
.sa-compose-wrap.sa-noting textarea { border-color: var(--color-warning); }
.sa-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sa-hint .linklike { font-size: 11.5px; margin-left: auto; }
.sa-ctx { overflow-y: auto; min-height: 0; }
.sa-ctx:empty { visibility: hidden; }
.sa-ctx-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--color-border); }
.sa-ctx-head h3 { margin: 0; font-size: 14px; font-weight: 650; flex: 1; }
.sa-ctx-close, .sa-ctx-btn { display: none; }
.sa-ctx-body { padding: 4px 16px 16px; }
.sa-sec { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.sa-sec:last-child { border-bottom: 0; }
.sa-sec h4 { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--color-text-muted); }
.sa-f { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3px 0; font-size: 13px; }
.sa-f .k { color: var(--color-text-muted); flex: none; }
.sa-f .v { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.sa-f .v a { color: var(--color-primary); }
.sa-other { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 8px; margin: 0 -8px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13px; color: var(--color-text); text-align: left; cursor: pointer; }
.sa-other:hover { background: var(--color-surface-secondary); }
.sa-other span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; font: inherit; font-size: 14px; line-height: 1.45; padding: 10px 12px; }
.sa-check { width: 18px; height: 18px; accent-color: var(--color-primary); flex: none; }

/* Narrower screens: the details panel opens over the chat with the Details button */
@media (max-width: 1280px) {
  .sa-layout { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); }
  .sa-ctx { display: none; }
  .sa-layout.show-ctx .sa-ctx { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 100%); z-index: 6; box-shadow: var(--shadow-lg); }
  .sa-ctx-close, .sa-ctx-btn { display: inline-flex; }
  .kpis.kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .kpis.kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.kpis-5 .kpi:first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .sa-layout { grid-template-columns: minmax(0, 1fr); }
  .sa-layout[data-mode="list"] .sup-main { display: none; }
  .sa-layout[data-mode="thread"] .sup-side { display: none; }
  .sa-controls { padding: 8px 12px; }
}
