/* Console shell and kit (/kit.js) on top of /cdn/main.css. The product colour arrives as --product via theme.js.
   Every console page wears it: the header and its fold, the page's head and tabs, lists, the list + detail split,
   panes, forms, badges, toasts, sheets, the chat and the box people write in. Usable from 360 px wide up. */
:root { --wa: #1f9d55; --ig: #c13584; --mail: #5c6066; --web: #2f5fa8; --info: #2f5fa8; --info-tint: #e7eef9; }

/* ---- header: brand, menu, the person; on a phone the menu folds into one button */
header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 12px var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--hairline); }
header .brand { display: flex; align-items: baseline; gap: 8px; }
header nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; font-size: 14px; }
header nav a { position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--muted);
  padding: 6px 10px; border-radius: var(--r-btn); }
header nav a.current { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
header nav .nav-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--alert);
  color: var(--surface); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
header .who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; }
header .who .btn { padding: 8px 14px; font-size: 13.5px; }
header .who .who-me { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
header .who .who-me .avatar { width: 30px; height: 30px; font-size: 11.5px; }
header .who .company-switch { max-width: 200px; padding: 6px 8px; font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--r-btn); background: var(--surface); }
header .fold { display: none; }
@media (max-width: 960px) {
  header { gap: 10px; }
  header .who { order: 2; margin-left: auto; }
  header .fold { order: 3; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; cursor: pointer;
    border: 1px solid var(--hairline); border-radius: var(--r-btn); background: var(--surface); color: var(--ink); }
  header nav { order: 4; flex-basis: 100%; display: none; flex-direction: column; gap: 2px; padding-top: 4px; }
  header.open nav { display: flex; }
  header nav a { padding: 10px 12px; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; }
  header #who .who-name { display: none; }   /* the photo stays: it opens the person's account */
  header .who .company-switch { max-width: 130px; }
}

/* ---- page */
main { max-width: var(--wrap-narrow); margin: 0 auto; padding: 32px var(--gutter) 72px; }
main.wide { max-width: 1320px; }
main h1 { font-size: 28px; font-weight: 650; letter-spacing: -.03em; margin: 8px 0 6px; }
main h2 { font-size: 18px; font-weight: 600; margin: 40px 0 6px; }
main > .body, .page-head + .body { margin: 0 0 18px; }
@media (max-width: 560px) { main { padding-top: 20px; } main h1 { font-size: 23px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--hairline);
  text-underline-offset: 3px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--hairline);
  margin: 14px 0 22px; }
.tabs a { padding: 10px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.current { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar select { flex: 1 1 140px; }
.chip-toggle { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); white-space: nowrap; }
.chip-toggle[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); background: var(--fill); }
.chip-count { margin-left: 6px; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.chip-count:empty { display: none; }
.note-member { font-size: 13px; color: var(--muted); background: var(--fill); padding: 8px 12px;
  border-radius: var(--r-input); margin: 0 0 14px; }
.locked { cursor: not-allowed; }
.error { color: var(--alert); font-size: 13px; }
[hidden] { display: none !important; }
.verify-banner { margin: 0 0 24px; padding: 12px 16px; border-radius: var(--r-card); font-size: 14px; color: var(--ink);
  background: var(--accent-tint); border: 1px solid var(--hairline); }
.verify-banner a { font-weight: 600; }
/* a session our team opened in the person's name: on top of every page, never scrolled away */
.impersonation-banner { position: sticky; top: 0; z-index: 60; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 8px 16px; padding: 10px 16px; font-size: 14px; color: var(--ink);
  background: var(--alert-tint); border-bottom: 1px solid var(--alert); }
.account { margin-top: 28px; max-width: 520px; }

/* ---- buttons: .btn (/cdn/main.css) in a smaller size, the dangerous ones, icons; plain buttons the shell makes */
.btn-sm { padding: 7px 12px; font-size: 13.5px; }
.btn-danger { background: var(--alert); color: var(--surface); }
.btn-danger:hover { background: color-mix(in srgb, var(--alert) 85%, #000); color: var(--surface); }
.btn-quiet-danger { background: transparent; color: var(--alert);
  border-color: color-mix(in srgb, var(--alert) 45%, transparent); }
.btn-quiet-danger:hover { border-color: var(--alert); color: var(--alert); }
.btn:disabled, .btn[aria-busy="true"], .icon-btn:disabled { opacity: .55; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--hairline); border-radius: var(--r-btn); background: var(--surface); color: var(--muted);
  cursor: pointer; }
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); }
main button:not([class]), main button.primary { font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px;
  border-radius: var(--r-btn); border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  cursor: pointer; }
main button:not([class]):hover { border-color: var(--ink); }
main button.primary { background: var(--primary); color: var(--bg); border-color: var(--primary); }

/* ---- tables (the older pages): they scroll sideways on a phone instead of breaking the page */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--hairline-soft); font-size: 14px;
  vertical-align: top; }
th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
  font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td button + button { margin-left: 6px; }
@media (max-width: 640px) { main table { display: block; overflow-x: auto; white-space: nowrap; } }
.pill { display: inline-block; font-family: var(--font-mono); font-size: 11px; padding: 3px 9px;
  border-radius: var(--r-pill); color: var(--muted); background: var(--hairline-soft); }
.pill.up { color: var(--accent); background: var(--accent-tint); }
.pill.down { color: var(--alert); background: var(--alert-tint); }
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.inline-form input { flex: 1 1 220px; }

/* ---- fields */
/* the same in a sheet over the page (kit.sheet), which lives outside <main> */
main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), main select, main textarea,
.sheet input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), .sheet select, .sheet textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-input); padding: 9px 12px; min-width: 0; max-width: 100%; }
main textarea, .sheet textarea { line-height: 1.5; resize: vertical; }
main select:focus, main textarea:focus, .sheet select:focus, .sheet textarea:focus { outline: none;
  border-color: var(--ink); }
/* the field rule above outweighs a plain input:disabled, so the disabled look names the same inputs */
main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):disabled, main select:disabled,
main textarea:disabled, .sheet input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):disabled,
.sheet select:disabled, .sheet textarea:disabled { background: var(--fill); color: var(--muted); }
main [aria-invalid="true"], .sheet [aria-invalid="true"] { border-color: var(--alert) !important; }
.form { display: grid; gap: 16px; max-width: 680px; }
.form.card { padding: 20px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.field-error { font-size: 12.5px; color: var(--alert); }
.form-error { padding: 10px 12px; border-radius: var(--r-input); background: var(--alert-tint); color: var(--alert);
  font-size: 13.5px; }
.form-error a, p.error a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 12px 16px 16px; margin: 0;
  display: grid; gap: 10px; min-width: 0; }
legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.check input { margin: 3px 0 0; accent-color: var(--accent); }
.switch { display: inline-flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.switch input { appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0;
  border-radius: 99px; background: var(--border); cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- lists */
.list { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; }
.list-rows > .row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; color: var(--ink);
  border-bottom: 1px solid var(--hairline-soft); }
.list-rows > .row:last-child { border-bottom: 0; }
a.row:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); color: var(--ink); }
.row.current { background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  box-shadow: inset 3px 0 0 var(--accent); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.row-top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.row-title { flex: 1; min-width: 0; font-weight: 550; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.row-end { font-size: 12px; color: var(--faint); white-space: nowrap; }
.row-sub { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text { font-size: 13.5px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.row-marks { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.row.unread .row-title { font-weight: 700; }
.row.unread .row-sub { color: var(--ink); }
.unread-dot { flex: none; align-self: center; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.unread-count { flex: none; align-self: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--surface); font-size: 11.5px; font-weight: 600; display: grid;
  place-items: center; }
.load-more { margin: 10px 14px 14px; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty strong { color: var(--ink); font-size: 15px; }
.empty p { margin: 0; font-size: 14px; max-width: 46ch; line-height: 1.55; }
.skeleton-row { padding: 14px; display: grid; gap: 8px; border-bottom: 1px solid var(--hairline-soft); }
.sk-line { display: block; height: 10px; border-radius: 5px; background: var(--fill);
  animation: sk 1.2s ease-in-out infinite; }
.sk-line.short { width: 60%; }
@keyframes sk { 50% { opacity: .45; } }

/* ---- badges and marks */
.badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px;
  padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.tone-ok { color: var(--accent); background: var(--accent-tint); }
.tone-warn, .tone-error { color: var(--alert); background: var(--alert-tint); }
.tone-info { color: var(--info); background: var(--info-tint); }
.tone-muted { color: var(--muted); background: var(--fill); }
.avatar { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid;
  place-items: center; background: var(--fill); color: var(--muted); font-size: 14px; font-weight: 600; }
.avatar-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.account-photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.key-list { display: grid; gap: 2px; }
.key-shown { word-break: break-all; padding: 12px; border: 1px solid var(--hairline); border-radius: var(--r-input); }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.account-photo .avatar { width: 64px; height: 64px; font-size: 20px; }
.avatar-channel { position: absolute; right: -3px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; border: 2px solid var(--surface); }
.ch-whatsapp { background: var(--wa); }
.ch-instagram { background: var(--ig); }
.ch-email { background: var(--mail); }
.ch-webchat { background: var(--web); }

/* ---- the list + detail split: side by side, or one at a time on a phone */
.split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.split-list { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.split-list .list { max-height: calc(100dvh - 230px); overflow-y: auto; }
.split-detail { min-width: 0; }
.split-back { display: none; }
@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-list .list { max-height: none; }
  .split.detail-open .split-list, .split:not(.detail-open) .split-detail { display: none; }
  .split-back { display: inline-grid; }
  body.detail-open main > .page-head, body.detail-open main > .tabs, body.detail-open main > .crumbs { display: none; }
}

/* ---- panes: a detail, its head, its sections */
.pane { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); min-width: 0; }
.pane-head { display: flex; gap: 12px; align-items: center; padding: 12px 14px;
  border-bottom: 1px solid var(--hairline-soft); }
.pane-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pane-title strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-title span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.pane-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.block { padding: 16px; border-top: 1px solid var(--hairline-soft); display: grid; gap: 10px; }
.block:first-child { border-top: 0; }
.block h2 { font-size: 15px; margin: 0; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; font-size: 13.5px;
  line-height: 1.5; border-bottom: 1px solid var(--hairline-soft); color: var(--ink); }
.banner > span { flex: 1 1 220px; }
.banner.tone-warn { background: var(--alert-tint); color: var(--ink); }
.banner.tone-info { background: var(--info-tint); color: var(--ink); }
.banner.tone-muted { background: var(--fill); color: var(--ink); }
.banner.tone-ok { background: var(--accent-tint); color: var(--ink); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.cards > .card { display: flex; flex-direction: column; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 16px 18px 8px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head a { font-size: 13px; color: var(--muted); }
.card .list { border: 0; border-top: 1px solid var(--hairline-soft); border-radius: 0; }
.card-foot { padding: 12px 18px 16px; font-size: 13.5px; color: var(--muted); }
.big-number { font-family: var(--font-mono); font-size: 30px; font-weight: 500; padding: 0 18px 8px; }
.usage { display: grid; gap: 12px; padding: 4px 18px 16px; }
.usage-line { display: grid; gap: 5px; font-size: 13.5px; }
.usage-line .usage-top { display: flex; justify-content: space-between; gap: 8px; }
.usage-line .bar > i { background: var(--accent); }
.usage-line.full .bar > i { background: var(--alert); }

/* ---- toasts, the confirm step, sheets */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px;
  width: min(440px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 10px 10px 14px; border-radius: var(--r-card);
  background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 12px 32px rgb(0 0 0 / .18);
  animation: toast-in .18s ease-out; }
.toast > span { flex: 1; line-height: 1.45; }
.toast.tone-error { background: var(--alert); color: var(--surface); }
.toast button { font: inherit; font-size: 13px; background: none; border: 0; color: inherit; cursor: pointer;
  padding: 4px; display: grid; place-items: center; }
.toast-action { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.confirm-step { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px;
  border-radius: var(--r-btn); background: var(--alert-tint); font-size: 13.5px; }
dialog.sheet { border: 0; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: min(84vh, 760px);
  border-radius: var(--r-frame); background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / .25); }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: rgb(22 24 29 / .45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--hairline-soft); }
.sheet-body { padding: 16px; display: grid; gap: 12px; overflow-y: auto; }
@media (max-width: 560px) {
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r-frame) var(--r-frame) 0 0;
    max-height: 90vh; }
}
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--hairline);
  border-radius: var(--r-input); cursor: pointer; font-size: 14px; }
.choice:has(input:checked) { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---- a company's labels (their colour comes with each one), and a conversation's tools: its state, the person it was
   given to, its contact's labels */
.label-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 160px; font-size: 11px; font-weight: 600;
  line-height: 1.5; padding: 1px 8px; border-radius: var(--r-pill); color: var(--muted); background: var(--fill);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-chip .label-take { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: grid; }
.label-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.label-choice { border: 1px solid var(--hairline); background: var(--surface); border-radius: var(--r-pill);
  padding: 6px 8px; cursor: pointer; }
.label-choice:hover { border-color: var(--ink); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { outline: 2px solid var(--ink); outline-offset: 2px; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.conv-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 14px;
  border-bottom: 1px solid var(--hairline-soft); }
.conv-tools:empty { display: none; }
.conv-tools .assignee { flex: 0 1 200px; padding: 5px 8px; font-size: 13px; }
.conv-labels { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---- a conversation: day marks, messages, what they carry, and the box to write in */
.chat-pane { display: flex; flex-direction: column; height: calc(100dvh - 230px); min-height: 440px; overflow: hidden; }
@media (max-width: 860px) { .chat-pane { height: calc(100dvh - 120px); min-height: 380px; } }
.chat { position: relative; flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column;
  gap: 6px;
  background: color-mix(in srgb, var(--fill) 55%, var(--surface)); }
.chat .load-more { align-self: center; margin: 0 0 6px; }
.msg { max-width: min(80%, 560px); align-self: flex-start; padding: 8px 12px; border-radius: 14px; font-size: 14px;
  line-height: 1.5; background: var(--surface); border: 1px solid var(--hairline); overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; background: var(--accent-tint); border-color: transparent; }
.msg.failed { border-color: var(--alert); }
.msg-text { white-space: pre-wrap; }
.msg-text a { color: inherit; text-decoration: underline; }
.msg-meta { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; font-size: 11px;
  color: var(--muted); }
.msg-note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.msg-note.warn { color: var(--alert); }
.day-mark { align-self: center; margin: 8px 0; padding: 2px 10px; font-size: 11.5px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-pill); }
.new-below { position: sticky; bottom: 4px; align-self: center; display: inline-flex; gap: 6px; align-items: center;
  font: inherit; font-size: 12.5px; padding: 6px 12px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg); box-shadow: 0 6px 16px rgb(0 0 0 / .18); }
.att { display: grid; gap: 4px; margin-bottom: 6px; }
.att img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; cursor: zoom-in;
  background: var(--fill); }
.att audio { width: min(280px, 100%); }
.att video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.att-file { display: inline-flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; font: inherit;
  font-size: 13px; color: var(--ink); background: var(--fill); border: 0; cursor: pointer; text-align: left; }
.att-wait { font-size: 12.5px; color: var(--muted); font-style: italic; }
.att details { font-size: 12.5px; color: var(--muted); }
.att summary { cursor: pointer; }
.composer { position: relative; display: grid; gap: 8px; padding: 10px 12px; background: var(--surface);
  border-top: 1px solid var(--hairline-soft); }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { flex: 1; resize: none; max-height: 180px; min-height: 40px; }
.composer-tools { display: flex; gap: 4px; }
.composer-tools:empty { display: none; }
.composer-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.composer-picked { flex: 1; display: grid; gap: 6px; justify-items: start; padding: 10px 12px;
  border-radius: var(--r-input);
  background: var(--fill); }
.composer-picked-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.composer-preview { margin: 0; font-size: 13.5px; white-space: pre-wrap; color: var(--ink-soft); }
.picker { position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 20; max-height: 280px;
  overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); box-shadow: 0 12px 32px rgb(0 0 0 / .12); }
.pick { display: flex; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0;
  border-radius: var(--r-btn);
  background: none; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.pick strong { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }
.pick span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick[aria-selected="true"], .pick:hover { background: var(--fill); }
.pick-none { padding: 10px; font-size: 13px; color: var(--muted); }

/* ---- pairing a number: the QR and the code */
.qr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.qr img { width: 264px; height: 264px; padding: 10px; background: #fff; border-radius: var(--r-card);
  border: 1px solid var(--hairline); image-rendering: pixelated; }
.code-big { font-family: var(--font-mono); font-size: 26px; letter-spacing: .14em; }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5;
  color: var(--ink); }
@media (max-width: 640px) {
  .qr { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .qr img { width: min(264px, 78vw); height: auto; }
}

/* ---- a week's hours (an agent's behaviour) */
.week { display: grid; gap: 8px; }
.day-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 8px 0; border-bottom: 1px solid var(--hairline-soft); }
.day-row:last-child { border-bottom: 0; }
.spans { display: grid; gap: 6px; }
.span-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.span-row input[type="time"] { width: 112px; }
.chips-edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips-edit .badge button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 2px;
  font: inherit; }
@media (max-width: 560px) { .day-row { grid-template-columns: minmax(0, 1fr); } }

/* ---- two columns of panes (a contact's page): .col-main and .col-more on the left, .col-side on the right; on a
   phone one under the other, the side's panes before .col-more */
.columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); grid-template-rows: auto 1fr;
  grid-template-areas: "main side" "more side"; gap: 16px; align-items: start; }
.columns > * { min-width: 0; }
.col-main { grid-area: main; }
.col-more { grid-area: more; }
.col-side { grid-area: side; display: grid; gap: 16px; }
@media (max-width: 860px) {
  .columns { grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
    grid-template-areas: "main" "side" "more"; }
}
.pane > .list { border: 0; border-radius: 0 0 var(--r-card) var(--r-card); }
.pane-head h2 { flex: 1; margin: 0; font-size: 15px; }
.facts { display: grid; gap: 6px; margin: 0; font-size: 13.5px; }
.facts > div { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.toolbar input[type="search"] { flex: 2 1 220px; }
.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px;
  background: var(--hairline-soft); border: 1px solid var(--hairline); border-radius: var(--r-card); overflow: hidden; }
.numbers > div { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; }
.numbers strong { font-family: var(--font-mono); font-size: 22px; font-weight: 500; }
.numbers span { font-size: 12.5px; color: var(--muted); }

/* ---- choosing a contact (contactPicker): a search, the matches under it, the one chosen */
.contact-pick { position: relative; display: grid; }
.contact-pick input[type="search"] { width: 100%; }
.pick-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 300px;
  overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-card); box-shadow: 0 12px 32px rgb(0 0 0 / .12); }
.pick-results .pick { align-items: center; }
.pick-results .avatar, .pick-chosen .avatar { width: 32px; height: 32px; font-size: 12px; }
.pick-results .pick strong { font-family: inherit; font-size: 13.5px; font-weight: 550; color: var(--ink); }
.pick-results .row-main span { font-size: 12.5px; }
.pick-chosen { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--r-input); background: var(--surface); }

/* ---- a done mark on a row (a task): a round button that completes it, filled once done */
.done-toggle { flex: none; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 1px; padding: 0;
  border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); color: transparent;
  cursor: pointer; }
.done-toggle:hover { border-color: var(--accent); color: var(--accent); }
.done-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.done-toggle:disabled { cursor: default; opacity: .55; }
.row.is-done .row-title { text-decoration: line-through; color: var(--muted); }
