/* =====================================================================
   Screen layouts (page-specific grids). Components live in app.css.
   ===================================================================== */

/* ---- Inbox ---------------------------------------------------------- */
.inbox-panes { grid-template-columns: 360px minmax(0, 1fr) 300px; }
.inbox-panes .ctx-pane { background: var(--color-surface); }
.thread-head { height: auto; min-height: var(--pane-header-h); padding: var(--space-2) var(--space-4); }
.thread-head .th-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.thread-head .th-sub { font-size: var(--text-xs); color: var(--color-ink-3); }
.list-filter { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); flex: none; }
/* the card body already sets the indent and padding (under the title), so the answers add none of their own */
.form-fields { display: grid; grid-template-columns: fit-content(160px) minmax(0,1fr); gap: var(--space-2) var(--space-4); padding: 0; margin: 0; }
.form-fields dt { color: var(--color-ink-3); font-size: var(--text-sm); }
.form-fields dd { margin: 0; }
.queued-msg { opacity: .8; }
@media (max-width: 1199px) { .inbox-panes { grid-template-columns: 320px minmax(0, 1fr); } .inbox-panes .ctx-pane { display: none; } }
@media (max-width: 1023px) and (min-width: 768px) { .inbox-panes { grid-template-columns: 292px minmax(0, 1fr); } }
@media (max-width: 767px) {
  .inbox-panes .list-pane { display: flex; }
  .inbox-panes .thread-pane { display: none; }
  .is-detail .inbox-panes .list-pane { display: none; }
  .is-detail .inbox-panes .thread-pane { display: flex; }
  .thread-head { padding: 0 var(--space-2); gap: var(--space-1); }
  .form-fields { grid-template-columns: 1fr; gap: 2px; }
  .form-fields dd { margin-bottom: var(--space-2); }
  .form-fields dd:last-child { margin-bottom: 0; }
  .reply-as { padding: var(--space-1) var(--space-2); }
}

/* ---- Contacts ------------------------------------------------------- */
.contact-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.contact-side { border-right: 1px solid var(--color-line); overflow: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }
.contact-main { overflow: auto; min-height: 0; }
.contact-main-inner { max-width: 760px; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.c-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.c-actions .btn { flex-direction: column; height: 60px; gap: 4px; font-size: var(--text-sm); }
.note-box { border: 1px solid var(--color-control-border); border-radius: var(--radius-md); }
.note-box textarea { border: 0; width: 100%; resize: none; padding: var(--space-3); min-height: 52px; font-size: var(--text-md); border-radius: var(--radius-md); }
.note-box textarea:focus { outline: none; box-shadow: none; }
/* Inputs are 16px everywhere (no zoom on iPhone). Note templates: one labelled box per heading. */
.note-box textarea { font-size: var(--text-lg); line-height: var(--lh-lg); }
.note-tpl { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3); }
.note-tpl-title { font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--color-ink); display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.note-tpl-title [data-copy-last] { margin-left: auto; font-weight: var(--weight-medium); }
.note-field { display: flex; flex-direction: column; gap: var(--space-1); }
.note-field label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-ink-2); }
.note-box .note-field textarea { border: 1px solid var(--color-control-border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); min-height: 48px; }
.note-box .note-field textarea:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(8, 122, 91, .18); }
.note-foot { flex-wrap: wrap; gap: var(--space-1); }
.note-tpls { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); margin-left: calc(-1 * var(--space-1)); }
.tl-card.note { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl-card.note .note-sec + .note-sec { margin-top: var(--space-3); }
.tl-card.note .note-h { font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--color-ink-2); }
.tl-card.note .note-t { white-space: pre-wrap; }
.tl-card.note:has(.note-sec) { white-space: normal; }
.note-acts { display: flex; gap: var(--space-1); margin-top: var(--space-1); margin-left: calc(-1 * var(--space-2)); }
.contact-tabs { display: none; }
@media (max-width: 1023px) { .contact-wrap { grid-template-columns: 300px minmax(0,1fr); } }
@media (max-width: 1023px) {
  .contact-wrap { display: flex; flex-direction: column; overflow: auto; gap: var(--space-4); padding-bottom: var(--space-6); }
  .contact-side, .contact-main { display: contents; }
  .contact-wrap .c-ident { order: 1; padding: var(--space-4) var(--space-4) 0; }
  .contact-wrap .c-actions { order: 2; padding: 0 var(--space-4); }
  .contact-wrap .contact-tabs { order: 3; }
  .contact-wrap [data-ctab] { order: 4; padding: 0 var(--space-4); }
  .contact-main-inner { padding: 0 var(--space-4); max-width: none; }
  .contact-tabs { display: flex; position: sticky; top: 0; background: var(--color-surface); z-index: 2; }
  .c-actions .btn { height: 64px; font-size: var(--text-md); }
  [data-ctab]:not(.is-on) { display: none; }
  .contact-wrap [data-ctab], .contact-wrap .c-ident, .contact-wrap .c-actions { width: 100%; max-width: 760px; }
  .contact-wrap .c-actions { max-width: 520px; }
}

/* ---- Deals ---------------------------------------------------------- */
.stage-strip { display: none; }
.deal-phone-list { display: none; }
@media (max-width: 767px) {
  .board.desk-board { display: none; }
  .stage-strip { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); flex: none; scrollbar-width: none; background: var(--color-surface); }
  .stage-strip::-webkit-scrollbar { display: none; }
  .stage-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface); font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--color-ink-2); white-space: nowrap; text-decoration: none; }
  .stage-chip[aria-current="true"] { background: var(--color-ink); color: var(--color-ink-inverse); border-color: var(--color-ink); }
  .stage-chip .n { font-size: var(--text-xs); opacity: .8; }
  .deal-phone-list { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-5); overflow: auto; flex: 1; min-height: 0; background: var(--color-canvas); }
  .deal-phone-list .dcard { padding: var(--space-4); }
}

/* ---- Documents list -------------------------------------------------- */
.docs-table td .num-cell { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.doc-cards { display: none; }
@media (max-width: 767px) {
  .docs-table { display: none; }
  .doc-cards { display: block; }
  .doc-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); text-decoration: none; color: inherit; }
  .doc-card:hover { text-decoration: none; background: var(--color-surface-2); }
}

/* ---- Document editor -------------------------------------------------- */
.ed-head { height: auto; min-height: 64px; padding: var(--space-2) var(--space-5); gap: var(--space-3); flex-wrap: nowrap; }
.ed-head .ed-title { display: flex; flex-direction: column; min-width: 0; }
.ed-head .ed-title .t { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: var(--weight-semibold); }
.line-card { display: none; }
@media (max-width: 1023px) { .ed-head { padding: var(--space-2) var(--space-4); } .ed-head .hide-md { display: none; } }
@media (max-width: 1023px) {
  .lines { display: none; }
  .doc-sec .grid-2 { grid-template-columns: 1fr; }
  .line-card { display: block; border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-2); }
  .line-card .lc-top { display: flex; gap: var(--space-3); align-items: flex-start; }
  .line-card .lc-meta { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); font-size: var(--text-md); color: var(--color-ink-2); }
}

/* ---- Bookings --------------------------------------------------------- */
.bk-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.bk-cal { overflow: auto; min-height: 0; }
.bk-side { border-left: 1px solid var(--color-line); overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.bk-agenda { display: none; }
@media (max-width: 1199px) { .bk-wrap { grid-template-columns: minmax(0, 1fr); } .bk-side { display: none; } }
@media (max-width: 1023px) { .bk-wrap { grid-template-columns: minmax(0, 1fr); } .bk-side { display: none; } }
@media (max-width: 767px) {
  .bk-cal { display: none; }
  .bk-agenda { display: block; overflow: auto; flex: 1; min-height: 0; }
  .bk-wrap { display: flex; flex-direction: column; }
}

/* ---- Calls ------------------------------------------------------------ */
.calls-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.calls-log { overflow: auto; min-height: 0; }
.dialler { border-left: 1px solid var(--color-line); overflow: auto; min-height: 0; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); background: var(--color-surface); }
.call-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--color-line); text-decoration: none; color: inherit; }
.call-row:hover { background: var(--color-surface-2); text-decoration: none; }
.call-row .cr-who { font-weight: var(--weight-medium); }
.call-row.missed .cr-who { color: var(--color-bad); font-weight: var(--weight-semibold); }
.call-row .cr-line { font-size: var(--text-xs); color: var(--color-ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dialler-back { display: none; }
.fab { display: none; }
@media (max-width: 1023px) { .calls-wrap { grid-template-columns: minmax(0, 1fr) 340px; } .dialler { padding: var(--space-4); } }
@media (max-width: 767px) {
  .calls-wrap { display: flex; flex-direction: column; position: relative; }
  .calls-log { flex: 1; }
  .dialler { display: none; border: 0; }
  .dialler-back { display: inline-flex; align-self: flex-start; flex-shrink: 0; }
  .is-dial .dialler { display: flex; flex: 1; padding: var(--space-4); }
  .is-dial .calls-log { display: none; }
  .call-row { grid-template-columns: 32px minmax(0, 1fr) auto; padding: var(--space-3) var(--space-4); }
  .call-row .cr-dur { display: none; }
  .fab { display: inline-flex; position: absolute; right: var(--space-4); bottom: var(--space-4); width: 56px; height: 56px; border-radius: 50%; background: var(--color-call); color: #fff; border: 0; align-items: center; justify-content: center; box-shadow: var(--shadow-2); }
  .is-dial .fab { display: none; }
}

/* ---- Orders ----------------------------------------------------------- */
@media (max-width: 767px) { .orders-table { display: none; } }
.composer-box { position: relative; }
.list-pane { position: relative; }
.thread-head { height: var(--pane-header-h); }

.contact-side .dl { grid-template-columns: 72px minmax(0, 1fr); }
.contact-side { padding-bottom: var(--space-7); }
@media (max-width: 767px) {
  .tl-head .meta { display: none; }
  .act-filter { display: flex; width: 100%; } .act-filter button { flex: 1; justify-content: center; }
  .contact-wrap .contact-side .dl { grid-template-columns: 1fr; }
}
/* deals board */
.board { align-items: stretch; position: relative; }
.col { flex: 0 0 252px; width: 252px; min-width: 0; max-height: none; }
.col.is-collapsed { flex: 0 0 48px; width: 48px; }
.dcard { min-width: 0; }
.board::-webkit-scrollbar { height: 12px; }
.board::-webkit-scrollbar-track { background: var(--color-canvas); }
.board::-webkit-scrollbar-thumb { background: var(--color-line-strong); border-radius: 6px; border: 3px solid var(--color-canvas); }
.board { scrollbar-color: var(--color-line-strong) var(--color-canvas); }
.board-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.board-wrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 40px; pointer-events: none; background: linear-gradient(to right, transparent, var(--color-canvas)); }
.dcard .dc-value .meta { font-weight: var(--weight-regular); }
@media (max-width: 767px) { .board-wrap { display: none; } .stage-strip { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent); mask-image: linear-gradient(to right, #000 85%, transparent); } }
/* editor */
.lines tr.line td.amt { padding-top: 16px; }
.lines tr.line td.drag { padding-top: 16px; }
@media (max-width: 767px) { .doc-sheet .textarea { resize: none; } .doc-actions-phone { padding-left: var(--space-4); padding-right: var(--space-4); align-items: center; } .doc-actions-phone .ptotal { flex: 1; display: flex; flex-direction: column; } .doc-actions-phone .btn { flex: none; } }

.dial-wrap { display: flex; align-items: center; gap: var(--space-2); border-bottom: 1px solid var(--color-control-border); padding-bottom: var(--space-1); }
.dial-wrap:focus-within { border-bottom-color: var(--color-accent); }
.dial-wrap .dial-display:focus { outline: none; box-shadow: none; }
.dial-display::placeholder { color: var(--color-ink-3); font-weight: 500; font-size: var(--text-xl); }
.in-call .dialler > *:not(.in-call-note) { opacity: .45; pointer-events: none; }
.callcard { width: 340px; right: 20px; bottom: 20px; }
@media (prefers-reduced-motion: no-preference) {
  .avatar.ring { animation: ring 1.6s ease-out infinite; }
  @keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(19,128,74,.55); } 100% { box-shadow: 0 0 0 28px rgba(19,128,74,0); } }
}
.avatar.ring { box-shadow: 0 0 0 6px rgba(19,128,74,.35); }
@media (max-width: 767px) { .callscreen .avatar.xl { --av: 96px; margin-top: var(--space-8); } }

.inbox-panes:has(> .ctx-pane[hidden]) { grid-template-columns: 360px minmax(0, 1fr); }
@media (max-width: 1199px) { .inbox-panes:has(> .ctx-pane[hidden]) { grid-template-columns: 320px minmax(0, 1fr); } }
@media (max-width: 1023px) and (min-width: 768px) { .inbox-panes:has(> .ctx-pane[hidden]) { grid-template-columns: 292px minmax(0, 1fr); } }
@media (max-width: 767px) { .thread-pane > .empty { display: none !important; } }

.tl-head { flex-wrap: nowrap; min-width: 0; }
.tl-head .t { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* a long line never pushes the time off a phone screen */
.tl-head .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1199px) { .col-email { display: none; } }
@media (max-width: 900px) { .col-last { display: none; } }

.col-co-inline { display: none; }
@media (max-width: 900px) { .col-co { display: none; } .col-co-inline { display: block; } }

.docs-table td { white-space: nowrap; }
.docs-table td .pill + .meta { margin-left: 4px; }
@media (max-width: 1199px) { .col-valid { display: none; } }
@media (max-width: 1439px) { .col-for .truncate { max-width: 220px !important; } }
@media (max-width: 1199px) { .col-for { display: none; } }

.line-desc-input { height: auto; min-height: 28px; padding: 4px var(--space-2); font-size: var(--text-sm); line-height: var(--lh-sm); border-color: transparent; resize: none; field-sizing: content; color: var(--color-ink-2); }
.line-desc-input:hover { border-color: var(--color-line-strong); }
#dactions { margin-right: var(--space-1); flex: none; }
@media (max-width: 767px) { .ed-head { display: none; } }

.line-name-input { height: auto; min-height: 34px; padding: 6px var(--space-3); resize: none; field-sizing: content; font-weight: var(--weight-medium); line-height: var(--lh-md); }
.doc-sheet.is-locked .drag { visibility: hidden; }
.doc-sheet.is-locked textarea { resize: none; }
.doc-sheet.is-locked .addon { background: var(--color-surface-2); border-color: var(--color-line); color: var(--color-ink-3); }
.doc-sheet.is-locked .line-desc-input:placeholder-shown { display: none; }
@media (max-width: 767px) {
  .banner { flex-wrap: wrap; }
  .banner .banner-actions { width: 100%; padding-left: 30px; }
  .banner .banner-actions .btn { height: 44px; }
}

.lines .line-name-input, .lines .line-desc-input { height: auto; }
.lines .line-name-input { min-height: 34px; }
.doc-sec .totals { padding-right: 44px; }
@media (max-width: 1023px) { .doc-sec .totals { padding-right: 0; } }
/* phones: the totals use the full width, so Total lines up with everything else and its rule is one line (SYS-760) */
@media (max-width: 767px) { .doc-sec .totals { width: 100%; column-gap: 0; } .doc-sec .totals > :nth-child(even) { padding-left: var(--space-4); text-align: right; } }

.col-date-inline { display: none !important; }
@media (max-width: 1099px) { .col-items { display: none; } }
@media (max-width: 900px) { .col-date { display: none; } .col-date-inline { display: block !important; } }
.orders-table td { white-space: nowrap; }
@media (max-width: 767px) {
  .doc-card > :nth-child(2), .doc-card > :nth-child(4) { justify-self: end; text-align: right; }
  .drawer-foot { flex-direction: column-reverse; align-items: stretch; padding-bottom: calc(var(--space-3) + var(--safe-bottom)); }
  .drawer-foot .spacer { display: none; }
  .drawer-foot .btn { width: 100%; }
}

.appt .a-sub { font-size: 11px; line-height: 13px; }
.appt:not(.follow):not(.cancelled) .a-sub { font-size: var(--text-xs); }
.range-short { display: none; }
@media (max-width: 1199px) { .range-long { display: none; } .range-short { display: inline; } }
@media (max-width: 1023px) { .bt-label { display: none; } .cal { min-width: 600px; grid-template-columns: 48px repeat(5, minmax(0, 1fr)); } }

.call-row .cr-dur { width: 44px; text-align: right; }
.call-row .cr-line .tag { margin-right: 2px; }
@media (max-width: 767px) { .calls-log { padding-bottom: 96px; } }

.fab { z-index: 5; }
.state-offline .call-row .btn-icon { opacity: .4; pointer-events: none; }
@media (max-width: 767px) { .calls-log > [data-when]:not(.fab) { padding-bottom: 96px; } }

/* =====================================================================
   Round 2 (23 Oct 2026). Inbox: 3-line rows, one unread signal, compact
   composer that grows on focus, actionable contact panel.
   ===================================================================== */
.thread-pane > .conv { flex: 1; min-height: 0; }
.thread-head h2 { font-size: var(--text-lg); line-height: var(--lh-lg); }
.thread-head { gap: var(--space-2); }
.thread { min-height: 100%; justify-content: flex-end; }
.msg-subj { font-weight: var(--weight-semibold); color: var(--color-ink); }
.event.solid { border-style: solid; background: var(--color-surface); color: var(--color-ink); }
.is-focus-row { box-shadow: 0 0 0 2px var(--color-ink); }
.seg-n { font-size: var(--text-xs); color: var(--color-ink-3); font-weight: var(--weight-semibold); }
.item .snip, .item .subj { text-overflow: ellipsis; }
.composer-main { display: flex; align-items: flex-end; gap: var(--space-2); }
.composer-main textarea { flex: 1; }
.composer-main .composer-foot { padding: 0 var(--space-2) var(--space-2) 0; flex: none; }
.composer-box:focus-within textarea { min-height: 96px; }
.ctx { gap: var(--space-4); }
.ctx-reach { display: flex; flex-direction: column; gap: 2px; margin-top: calc(-1 * var(--space-1)); }
.reach-row { display: flex; align-items: center; gap: 2px; min-height: 32px; font-size: var(--text-sm); color: var(--color-ink-2); }
.reach-row > :first-child { flex: 1; min-width: 0; }
.reach-row .btn-icon { width: 32px; height: 32px; color: var(--color-ink-2); }
.link-row.lr-2 { align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lr-sub { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.lr-sub > .meta:first-child { flex: 1; min-width: 0; }
.lr-val { white-space: nowrap; font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-left: auto; }
.lr-val .meta { font-weight: var(--weight-regular); }
.lr-chev { color: var(--color-ink-3); flex: none; }
.wave i.on { background: var(--color-ink-2); }
@media (max-width: 767px) {
  .item { padding: 10px var(--space-4) 10px var(--space-5); }
  .item.unread::after { top: 20px; }
  .composer-box:focus-within textarea { min-height: 72px; }
  .composer-main .composer-foot .btn-primary { min-width: 44px; }
}
.reach-slot { width: 32px; flex: none; }
.item.unread::after { width: 10px; height: 10px; left: 7px; top: 17px; }

/* ---- Deals board, round 2: 5 Sales stages fit at 1440, content-height columns, fixed card anatomy ---- */
.board { align-items: flex-start; gap: var(--space-3); padding: var(--space-4) var(--space-5); }
.col { flex: 0 0 212px; width: 212px; max-height: 100%; background: var(--color-surface-2); border: 0; }
.col-cards { padding: 0 var(--space-2) var(--space-2); }
.col-head { padding: var(--space-3) var(--space-3) var(--space-2); gap: 4px; }
.col-head .col-title { gap: 6px; font-size: var(--text-sm); line-height: var(--lh-sm); }
.col-n { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-ink-2); background: var(--color-surface); border-radius: var(--radius-pill); padding: 0 6px; line-height: 18px; flex: none; }
.col-sum { margin-left: auto; font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-ink); flex: none; }
.col-head .col-auto { color: var(--color-ink-2); line-height: var(--lh-xs); align-items: flex-start; }
.col-head .col-auto .i, .dc-flag .i { color: var(--color-wait); flex: none; margin-top: 0; }
.col-empty { padding: var(--space-4) var(--space-3); text-align: center; font-size: var(--text-xs); color: var(--color-ink-3); border: 1px dashed var(--color-line-strong); border-radius: var(--radius-sm); }
.col.is-collapsed { flex: 0 0 44px; width: 44px; min-height: 180px; background: transparent; border: 1px dashed var(--color-line-strong); text-decoration: none; color: inherit; }
.col.is-collapsed .col-title { font-size: var(--text-sm); }
.dcard { padding: 10px var(--space-3); display: flex; flex-direction: column; gap: 2px; }
.dcard .dc-title { font-size: var(--text-sm); line-height: var(--lh-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * var(--lh-sm)); }
.dcard .dc-co { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); margin-top: 0; }
.dcard .dc-doc { margin-top: 4px; height: 22px; display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-ink-2); }
.dcard .dc-doc .pill { margin-left: auto; height: 20px; }
.dc-flag { display: flex; gap: 4px; align-items: flex-start; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); margin-top: 4px; }
.dcard .dc-foot { margin-top: var(--space-2); gap: 6px; }
.dcard .dc-value { font-size: 15px; line-height: 20px; font-weight: var(--weight-bold); color: var(--color-ink); }
.dc-add { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-ink-3); }
.avatar.owner { background: var(--color-ink-2); color: #fff; font-size: 10px; letter-spacing: 0; }
.p-sum { margin-left: var(--space-2); font-size: var(--text-md); white-space: nowrap; }
.board-wrap::after { display: none; }
.board-wrap.has-more::after { display: block; width: 72px; background: linear-gradient(to right, transparent, var(--color-canvas) 70%); }
.board-more { position: absolute; z-index: 2; right: 10px; top: 16px; display: inline-flex; align-items: center; gap: 4px; writing-mode: vertical-rl; padding: var(--space-3) 0; width: 36px; border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface); color: var(--color-ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); box-shadow: var(--shadow-2); }
.board-more:hover { background: var(--color-surface-2); }
.board-more .i { transform: rotate(-90deg); }
@media (max-width: 767px) { .board-more { display: none !important; } .deal-phone-list .dcard { padding: var(--space-3) var(--space-4); } .deal-phone-list .dcard .dc-title { font-size: var(--text-md); line-height: var(--lh-md); min-height: 0; } .deal-phone-list .dcard .dc-co { font-size: var(--text-sm); } .deal-phone-list .col-auto { display: flex; gap: 4px; font-size: var(--text-sm); color: var(--color-ink-2); } }
@media (max-width: 1199px) { .p-sum .meta { display: none; } }
/* deals r2b: columns sized so whole columns fit (5 at 1440, 4 at 1024, 3 at 768); scroll snaps to column edges; cue lives in its own gutter */
.board-wrap { container-type: inline-size; }
.board { --cols: 5; padding-right: 0; scroll-snap-type: x mandatory; scroll-padding-left: var(--space-5); }
.board-wrap.has-more .board { margin-right: 72px; }
.board .col { flex: 0 0 calc((100cqw - 72px - var(--space-5) - (var(--cols) - 1) * var(--space-3)) / var(--cols)); width: auto; min-width: 188px; scroll-snap-align: start; }
.board .col.is-collapsed { flex: 0 0 44px; min-width: 44px; }
.board::after { content: ""; flex: 0 0 1px; }
@media (max-width: 1199px) { .board { --cols: 4; } }
@media (max-width: 1023px) { .board { --cols: 3; } }
.dcard .dc-title { min-height: 0; }
.col-head .col-sum { margin-left: auto; font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-ink); }
.dc-add { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-accent); }
.avatar.owner { font-size: 10px; }
.board-wrap.has-more::after { display: none; }
.board-more { writing-mode: horizontal-tb; right: 0; top: 0; bottom: 0; width: 72px; border-radius: 0; border: 0; border-left: 1px solid var(--color-line); box-shadow: none; background: var(--color-canvas); flex-direction: column; justify-content: flex-start; padding: var(--space-4) var(--space-1); gap: var(--space-3); }
.board-more .i { transform: none; }
.board-more .bm-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--color-line-strong); background: var(--color-surface); display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1); }
.board-more:hover .bm-btn { background: var(--color-surface-2); }
.board-more .bm-text { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-regular); color: var(--color-ink-2); }
.board-more .bm-text strong { font-size: var(--text-sm); color: var(--color-ink); }
.board-more .bm-sep { height: var(--space-2); }
.board .col { flex-basis: calc((100cqw - 72px - var(--space-5) - var(--space-3) - (var(--cols) - 1) * var(--space-3)) / var(--cols)); border: 1px solid var(--color-line); }
.board-wrap.has-more .board { margin-right: 72px; padding-right: var(--space-3); scroll-padding-right: var(--space-3); }
.dcard .dc-foot .meta { white-space: nowrap; }
.dc-none { color: var(--color-ink-3); font-weight: var(--weight-regular); }
.closed-link { color: var(--color-ink-2); }
.board-more .bm-text > span:not(.bm-sep) { white-space: nowrap; }

/* ---- Document editor, round 2 ---- */
.lines th.th-in { padding-left: calc(var(--space-2) + var(--space-3)); }
.lines th.r.th-in { padding-left: var(--space-2); padding-right: calc(var(--space-2) + var(--space-3)); }
.lines th.r:not(.th-in) { padding-right: var(--space-2); }
.line-desc-input { border-color: var(--color-line); border-style: dashed; }
.line-desc-input:hover, .line-desc-input:focus { border-style: solid; }
.ro-value { display: flex; flex-direction: column; justify-content: center; min-height: var(--control-h); padding: 2px 0; }
.ro-value > span:first-child { font-weight: var(--weight-medium); }
.side-totals { width: 100%; margin: 0; gap: 6px var(--space-3); font-size: var(--text-sm); }
.side-totals .grand { font-size: var(--text-xl); }
.rail-act { padding: var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface-2); }
.doc-header-actions { display: flex; align-items: center; gap: var(--space-2); position: relative; }
.doc-phone-buttons { min-width: 0; }
@media (max-width: 1199px) {
  .doc-actions-phone { max-height: 40dvh; overflow-y: auto; }
  .doc-phone-buttons { flex: 0 1 340px; }
  .doc-phone-buttons .btn { white-space: normal; height: auto; min-height: var(--control-h-touch); padding-top: var(--space-2); padding-bottom: var(--space-2); text-align: center; }
  .doc-phone-buttons .rail-note { display: none; } /* the send sheet already explains the channels */
}
@media (max-width: 767px) {
  .doc-side { display: flex; border-left: 0; border-top: 1px solid var(--color-line); overflow: visible; }
  .doc-side > .stack:has(#sideTotals) { display: none; } /* totals already appear in the form and pinned bar */
  .doc-side .meta { white-space: normal; overflow-wrap: anywhere; }
  .doc-actions-phone .ptotal { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
  .doc-phone-buttons { flex: 1 1 0; }
  .doc-header-actions .doc-preview { width: var(--tap); padding: 0; }
  .doc-header-actions .doc-preview span { display: none; }
}
.rail-note strong { color: var(--color-ink); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.repeat-more { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface-2); }
@media (min-width: 1200px) { .hide-wide { display: none !important; } }
@media (max-width: 1199px) { .rail-act { display: none; } }
.side-totals > :nth-child(even) { text-align: right; justify-self: end; }
.line-desc-input { border-style: solid; border-color: var(--color-line); background: var(--color-surface); }

/* ---- Bookings agenda, round 2 ---- */
.bk-wrap { position: relative; }
.agenda-day { min-height: 36px; }
.agenda-day.is-today { background: var(--color-ink); color: var(--color-ink-inverse); }
.agenda-day .ad-count { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-ink-2); }
.agenda-day.is-today .ad-count { color: #e3e6eb; }
.agenda-item { grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; padding: 10px var(--space-3) 10px var(--space-4); min-height: 60px; }
.agenda-item .t { display: flex; flex-direction: column; line-height: var(--lh-md); }
.agenda-item .ai-len { font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-regular); color: var(--color-ink-3); }
.ai-main { display: flex; flex-direction: column; min-width: 0; }
.ai-name { font-weight: var(--weight-semibold); }
.ai-sub { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); }
.ai-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink); font-weight: var(--weight-medium); }
.ai-note .i { color: var(--color-attn); margin-top: 1px; }
.ai-end { display: flex; align-items: center; gap: var(--space-1); }
.ai-chev { color: var(--color-ink-3); }
.agenda-item.is-past { background: var(--color-surface-2); }
.agenda-item.is-past .t, .agenda-item.is-past .ai-name, .agenda-item.is-past .ai-sub, .agenda-item.is-past .ai-note { color: var(--color-ink-3); }
.agenda-item.is-past .ai-note .i { color: var(--color-ink-3); }
.agenda-item.is-cancelled .ai-name { text-decoration: line-through; color: var(--color-ink-3); }
.agenda-gap { min-height: 32px; padding: 0 var(--space-4) 0 calc(var(--space-4) + 52px + var(--space-3)); gap: 6px; background: var(--color-surface); font-size: var(--text-xs); line-height: var(--lh-xs); }
.agenda-gap .ag-free { margin-left: auto; color: var(--color-good); font-weight: var(--weight-semibold); }
.agenda-gap.is-past { background: var(--color-surface-2); color: var(--color-ink-3); }
.agenda-gap.is-past .ag-free { color: var(--color-ink-3); }
.agenda-gap.ag-off { background: var(--color-surface-2); color: var(--color-ink-2); }
.strip-month { flex: none; font-size: 11px; line-height: 13px; font-weight: var(--weight-semibold); color: var(--color-ink-2); text-align: center; align-self: center; }
.day-chip { gap: 6px; }
.day-chip .today-mark { font-size: 11px; font-weight: var(--weight-semibold); padding: 1px 6px; border-radius: var(--radius-pill); background: var(--color-accent); color: var(--color-on-accent); }
.day-chip[aria-current="true"] .today-mark { background: var(--color-ink-inverse); color: var(--color-ink); }
.fab-primary { background: var(--color-primary); color: var(--color-on-primary); }
@media (max-width: 767px) {
  .bk-agenda { padding-bottom: calc(56px + var(--space-6)); scroll-padding-top: 0; }
  .bk-wrap .fab { z-index: 5; }
}
.agenda-day.is-today { background: var(--color-surface-2); color: var(--color-ink); }
.agenda-day.is-today .ad-count { color: var(--color-ink-2); }
.agenda-day .today-mark { font-size: 11px; font-weight: var(--weight-semibold); padding: 1px 6px; border-radius: var(--radius-pill); background: var(--color-accent); color: var(--color-on-accent); margin-right: var(--space-2); }
.agenda-now { position: relative; height: 0; border-top: 2px solid var(--color-bad); margin: 0 0 0 var(--space-4); z-index: 1; }
.agenda-now span { position: absolute; left: 0; top: -10px; font-size: 11px; line-height: 16px; font-weight: var(--weight-semibold); color: var(--color-ink-inverse); background: var(--color-bad); padding: 0 6px; border-radius: var(--radius-pill); }
@media (max-width: 767px) { .tabbar { box-shadow: 0 -1px 0 var(--color-line), 0 -8px 20px rgba(22, 24, 29, .10); } }

/* ---- Calls, round 2: ringing state, business line first, minimum caller context ---- */
.call-row.missed .cr-who { color: var(--color-ink); }
.ws-mark.md { --m: 32px; }
.ring-dot { width: 10px; height: 10px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 0 rgba(61,220,132,.6); flex: none; }
.cc-ringing, .cs-ringing { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); letter-spacing: .01em; color: #fff; }
.cc-ringing { padding: var(--space-3) var(--space-4) 0; font-size: var(--text-sm); }
.cc-lineblock { display: flex; gap: var(--space-3); align-items: center; margin: var(--space-3) var(--space-4) 0; padding: var(--space-3); border-radius: var(--radius-md); background: rgba(255,255,255,.08); font-size: var(--text-sm); color: #dfe3ea; }
.cc-lineblock .strong { color: #fff; font-size: var(--text-md); }
.cc-ctx { display: grid; grid-template-columns: 92px 1fr; gap: 4px var(--space-3); margin: 0 var(--space-4) var(--space-4); font-size: var(--text-sm); }
.cc-ctx dt { color: #b9bfca; } .cc-ctx dd { margin: 0; color: #fff; }
.avatar.ring { box-shadow: 0 0 0 6px rgba(255,255,255,.14); }
@media (prefers-reduced-motion: no-preference) {
  .avatar.ring { animation: ring2 1.8s ease-out infinite; }
  .ring-dot { animation: ringdot 1.2s ease-out infinite; }
  @keyframes ring2 { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 100% { box-shadow: 0 0 0 26px rgba(255,255,255,0); } }
  @keyframes ringdot { 0% { box-shadow: 0 0 0 0 rgba(61,220,132,.6); } 100% { box-shadow: 0 0 0 10px rgba(61,220,132,0); } }
}
@media (max-width: 767px) {
  .callscreen.cs-incoming { padding-top: calc(var(--space-6) + var(--safe-top)); }
  .cs-ringing { font-size: var(--text-lg); }
  .cs-lineblock { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: rgba(255,255,255,.10); font-size: var(--text-md); color: #dfe3ea; width: 100%; max-width: 340px; }
  .cs-lineblock .cs-linename { font-size: var(--text-xl); line-height: var(--lh-xl); font-weight: var(--weight-semibold); color: #fff; }
  .callscreen.cs-incoming .avatar.xl { --av: 88px; margin-top: var(--space-6); }
  .callscreen.cs-incoming .cs-name { margin-top: var(--space-4); }
  .cs-ctx { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--space-3); margin: var(--space-5) 0 0; padding: var(--space-3) var(--space-4); width: 100%; max-width: 340px; text-align: left; font-size: var(--text-md); border-top: 1px solid rgba(255,255,255,.14); }
  .cs-ctx dt { color: #b9bfca; } .cs-ctx dd { margin: 0; color: #fff; }
  .round-label { color: #fff; }
  .callscreen .cs-sub { color: #d5d9e0; }
}
.dd-sub { display: block; color: #b9bfca; font-size: var(--text-sm); }
@media (max-width: 767px) {
  .callscreen.cs-incoming { padding-top: calc(var(--space-8) + var(--safe-top)); }
  .callscreen.cs-incoming .avatar.xl.cs-push { margin-top: auto; }
  .callscreen.cs-incoming .cs-bottom { margin-top: auto !important; }
  .cs-lineblock .num { font-size: var(--text-sm); color: #b9bfca; }
}
.rl-sub { font-size: var(--text-xs); color: #b9bfca; margin-top: -6px; }
/* In the phone app the system's incoming-call banner (caller, business, Answer/Decline) covers the top ~200px while
   it rings: the in-app card starts below it, and on short screens the avatar shrinks so the buttons still fit. */
@media (max-width: 767px) {
  .cs-native .callscreen.cs-incoming { padding-top: calc(212px + var(--safe-top)); }
}
@media (max-width: 767px) and (max-height: 780px) {
  .cs-native .callscreen.cs-incoming .avatar.xl { --av: 64px; }
  .cs-native .callscreen.cs-incoming .cs-name { margin-top: var(--space-2); }
  .cs-native .cs-ctx { margin-top: var(--space-3); }
}
/* short phones: the banner already says it is ringing, so the card opens on the business itself */
@media (max-width: 767px) and (max-height: 700px) {
  .cs-native .callscreen.cs-incoming { padding-top: calc(214px + var(--safe-top)); }
  .cs-native .callscreen.cs-incoming .cs-ringing { display: none; }
  .cs-native .callscreen.cs-incoming .cs-lineblock { margin-top: 0; padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .cs-native .callscreen.cs-incoming .avatar.xl { --av: 56px; margin-top: var(--space-6); }
  .cs-native .callscreen.cs-incoming .cs-name { font-size: var(--text-xl); margin-top: var(--space-4); }
  /* company and history: the banner above carries the company, so the short screen keeps to who and which business */
  .cs-native .callscreen.cs-incoming .cs-ctx { display: none; }
  .cs-native .callscreen.cs-incoming .cs-bottom { padding-top: var(--space-5); }
}
.thread .day-sep { position: sticky; top: 0; z-index: 2; background: var(--color-surface); padding: 6px 0; margin: -6px 0; }
.side-totals { column-gap: 0; }
.side-totals > :nth-child(even) { padding-left: var(--space-3); }
.rail-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.rail-list strong { color: var(--color-ink); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.board-more .bm-text > span.bm-name { white-space: normal; font-size: 11px; line-height: 13px; color: var(--color-ink-2); margin-top: 2px; }
.dcard .dc-foot .meta { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dcard .dc-foot .dc-value { flex: none; padding-left: var(--space-1); }
.board-more .bm-text > span.bm-name { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--color-line); width: 56px; }
.board-more .bm-text > span.bm-sep + span.bm-name { border-top: 0; padding-top: 0; }
.dc-age { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.dc-age .i { width: 12px; height: 12px; flex: none; }
.dcard .dc-foot { gap: 4px; }
.bm-name b { color: var(--color-ink); }
.board-more .bm-text > span.bm-name { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink); }
.cr-follow { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.call-row .cr-line + .cr-follow { display: inline-block; margin-top: 2px; }
@media (min-width: 768px) and (max-width: 1199px) { .from-btn { height: auto; min-height: 36px; padding: 4px var(--space-2); } .from-btn .fb-text { flex-direction: column; gap: 0; align-items: flex-start; line-height: 16px; } .from-btn .fb-addr { font-size: var(--text-xs); } }
.call-row.missed .cr-line { color: var(--color-attn); font-weight: var(--weight-medium); }

/* =====================================================================
   Round 3 (23 Oct 2026). Density and weight rules (DESIGN.md 2.1a):
   list rows use at most two weights (regular + one emphasis), no boxed
   icon tiles in rows, secondary text regular ink-2/ink-3, rows 44 to 56px.
   ===================================================================== */

/* ---- Inbox list: two-line rows. Unread = dot in a fixed gutter + semibold name; read = regular ---- */
.item.r3 { grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--space-3); padding: 9px var(--space-4) 9px 28px; align-items: baseline; }
.item.r3 .who { font-weight: var(--weight-regular); color: var(--color-ink); }
.item.r3.unread .who { font-weight: var(--weight-semibold); }
.item.r3.unread::after { left: 11px; top: 16px; width: 8px; height: 8px; }
.item.r3 .l2 { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-3); }
.item.r3 .l2 .g { flex: none; width: 14px; height: 14px; color: var(--color-ink-3); stroke-width: 2; }
.item.r3 .l2 .g.attn { color: var(--color-attn); }
.item.r3 .l2 .tx { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item.r3 .l2 .s { color: var(--color-ink-2); }
@media (max-width: 767px) {
  .item.r3 { padding: 11px var(--space-4) 11px 28px; }
  .item.r3.unread::after { top: 19px; }
  .item.r3 .l2 { font-size: var(--text-md); line-height: var(--lh-md); }
}

/* ---- Thread: dividers scroll with the content (no sticky label over half-cut text) ---- */
.thread .day-sep { position: static; margin: var(--space-1) 0 0; padding: 0; background: none; }
/* one email card style; your own messages carry a 3px left rule and "(you)" */
.msg.out { background: var(--color-surface); border-color: var(--color-line); margin-left: var(--space-7); }
.msg.out .avatar { background: var(--color-surface-3); color: var(--color-ink-2); box-shadow: none; }
.msg-subj { font-weight: var(--weight-regular); color: var(--color-ink); }
/* calls and other events: one muted line, no card */
.tl-ev { display: flex; align-items: center; gap: var(--space-3); min-height: 28px; padding: 0 calc(var(--space-4) + 1px) 0 calc(var(--space-4) + 1px); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); }
.tl-ev > .i { width: 14px; height: 14px; color: var(--color-ink-3); flex: none; }
.tl-ev .tx { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tl-ev .meta { flex: none; }
.tl-ev + .tl-card.note { margin-top: calc(-1 * var(--space-2)) !important; margin-left: calc(var(--space-4) + 22px); }
/* suggested action strip above the composer (replaces a primary button in the thread header) */
.suggest { display: flex; align-items: center; gap: var(--space-3); max-width: 820px; margin: 0 auto var(--space-2); padding: 6px 6px 6px var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface-2); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); }
.suggest > .i { color: var(--color-ink-2); flex: none; }
.suggest .sg-text { flex: 1; min-width: 0; }
.suggest .sg-text strong { color: var(--color-ink); font-weight: var(--weight-semibold); }
.suggest .sg-btn { flex: none; color: var(--color-accent); border-color: var(--color-line-strong); background: var(--color-surface); }
@media (max-width: 767px) { .suggest { flex-wrap: wrap; } .suggest .sg-btn { width: 100%; height: 44px; justify-content: center; } }

/* ---- Inbox context: one card for the deal and its documents (value shown once) ---- */
.ctx-name { font-weight: var(--weight-semibold); }
.dk-card { border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; }
.dk-head { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-2) 2px var(--space-3); color: inherit; text-decoration: none; }
.dk-head:hover { text-decoration: none; background: var(--color-surface-2); }
.dk-title { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); }
.dk-meta { display: flex; align-items: baseline; gap: var(--space-2); padding: 0 var(--space-3) var(--space-3); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); }
.dk-meta > span:first-child { flex: 1; min-width: 0; }
.dk-val { white-space: nowrap; color: var(--color-ink); }
.dk-docs { border-top: 1px solid var(--color-line); }
.dk-doc { display: flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-2) 0 var(--space-3); font-size: var(--text-sm); color: inherit; text-decoration: none; }
.dk-doc + .dk-doc { border-top: 1px solid var(--color-line); }
.dk-doc:hover { background: var(--color-surface-2); text-decoration: none; }
.dk-none { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); }

.thread-pane .pane-body { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px); mask-image: linear-gradient(to bottom, transparent 0, #000 28px); }
.tl-ev + .tl-card.note { margin-left: calc(var(--space-4) + 9px + 14px + var(--space-3)) !important; }

/* older messages in a thread collapse to their header and a one-line peek; the latest is open */
button.msg-head { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: var(--radius-md); }
button.msg-head:hover { background: var(--color-surface-2); }
.msg-peek { display: none; }
.msg.is-collapsed .msg-body { display: none; }
.msg.is-collapsed .msg-addr { display: none; }
.msg.is-collapsed .msg-peek { display: block; font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item.r3 .l2 .g { color: var(--color-ink-2); }
.item.r3 .l2 .g.ch-mail { color: var(--color-ink-3); }
.sg-btn.btn-primary { color: var(--color-on-primary); background: var(--color-primary); border-color: var(--color-primary); }

/* sidebar: the current area is a filled neutral row, not a white box that looks like the search field */
.nav a[aria-current="page"] { background: var(--color-surface-3); box-shadow: none; color: var(--color-ink); font-weight: var(--weight-semibold); }
.nav a[aria-current="page"] .i { color: var(--color-ink); }

/* suggested action sits inside the message it is based on */
.msg > .suggest { margin: 0 var(--space-4) var(--space-4) calc(var(--space-4) + 32px + var(--space-3)); max-width: none; }
.msg > .suggest .sg-text .meta { display: block; }
@media (max-width: 767px) { .msg > .suggest { margin: 0 var(--space-3) var(--space-3); } .msg.out { margin-left: var(--space-6); } }

.dk-doc .num, .suggest strong, .sg-btn { white-space: nowrap; }

/* ---- Settings, round 3: phone numbers and email senders ---- */
.nc-ico { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-ink-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.nc-ico .i { width: 16px; height: 16px; }
.num-card .perm-row { grid-template-columns: minmax(0, 300px) 96px 112px; justify-content: start; }
.pr-who { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.perm-row .c { flex-direction: column; align-items: center; gap: 2px; }
.perm-row.is-off .pr-who { color: var(--color-ink-2); }
.pr-why { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); white-space: nowrap; }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.nc-dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--space-3) var(--space-4); margin: var(--space-4) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--color-line); font-size: var(--text-md); }
.nc-dl dt { color: var(--color-ink-2); font-weight: var(--weight-medium); padding-top: 6px; }
.nc-dl dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: 32px; color: var(--color-ink); }
.select-sm { height: 32px; width: auto; padding-top: 0; padding-bottom: 0; font-size: var(--text-md); }
.sv-val { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.auth-grid { display: grid; grid-template-columns: repeat(3, auto auto); justify-content: start; align-items: center; gap: var(--space-2) var(--space-2); }
.auth-grid > span:nth-child(odd) { font-weight: var(--weight-medium); }
.auth-grid > span:nth-child(odd):not(:first-child) { margin-left: var(--space-4); }
.sv-dmarc-note { display: flex; flex-direction: column; gap: var(--space-2); color: var(--color-ink); background: var(--color-bad-bg); border-radius: var(--radius-sm); padding: var(--space-3); }
.sv-dmarc-note[hidden] { display: none; }
.ok-txt { display: inline-flex; align-items: center; gap: 4px; color: var(--color-good); font-weight: var(--weight-medium); font-size: var(--text-sm); }
.pr-why { padding: 3px 8px; border-radius: var(--radius-pill); background: var(--color-surface-2); }
.set-inner > .banner { margin: 0; }
.pick-row { gap: var(--space-3); cursor: pointer; margin-top: var(--space-2); }
.pick-row input { accent-color: var(--color-accent); width: 18px; height: 18px; }
.chip-x { width: 28px; height: 28px; margin: -4px -6px -4px 0; }
.phone-status.is-off .ps-text { color: var(--color-ink-2); font-weight: var(--weight-regular); }
@media (max-width: 767px) {
  .num-card .perm-row { grid-template-columns: minmax(0, 1fr) 64px 84px; }
  .nc-dl { grid-template-columns: 1fr; gap: 4px; }
  .nc-dl dt { padding-top: var(--space-2); }
  .auth-grid { grid-template-columns: auto auto; }
  .auth-grid > span:nth-child(odd):not(:first-child) { margin-left: 0; }
  .select-sm { height: 44px; font-size: var(--text-lg); max-width: 100%; }
}


.sv-val .meta, .nc-head .meta { color: var(--color-ink-2); }
.sv-dmarc-note { background: var(--color-attn-bg); }
.noring-note { margin: 0; }

.switch.is-locked span { opacity: .4; background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(255,255,255,.55) 3px 5px); }
.sv-val .email, .sv-val .sv-from, .sv-val .sv-acct { white-space: nowrap; }

.token-input { display: flex; align-items: center; gap: 6px; cursor: text; }
.token { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--color-accent-weak); color: var(--color-accent-ink); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.tok-text { flex: 1; min-width: 0; }
.tok-add { margin-right: -6px; color: var(--color-ink-2); }

/* ---- Deals board, round 3: every Sales stage fits at 1360+; column total smaller and lighter than card values ---- */
.board { --gap: var(--space-2); gap: var(--gap); padding: var(--space-4) var(--space-5); }
.board .col { flex: 0 0 calc((100cqw - 2 * var(--space-5) - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 150px; }
.board-wrap.has-more .board { margin-right: 120px; padding-right: var(--space-3); }
.board-wrap.has-more .board .col { flex-basis: calc((100cqw - 120px - var(--space-5) - var(--space-3) - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.col-head { padding: var(--space-2) var(--space-2) var(--space-2) 10px; gap: 2px; }
.col-head .col-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.col-head .col-sum, .col-sum { margin: 0; font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-regular); color: var(--color-ink-2); }
.col-cards { padding: 0 6px 6px; }
.dcard { padding: var(--space-2) 10px; }
.dcard .dc-title { text-wrap: balance; overflow-wrap: normal; word-break: normal; hyphens: manual; font-weight: var(--weight-medium); }
.dcard .dc-co { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-xs); color: var(--color-ink-2); }
.dcard .dc-doc { color: var(--color-ink-2); }
.dc-age { font-size: var(--text-xs); color: var(--color-ink-2); }
.dc-age .i { color: var(--color-ink-2); }
.dcard .dc-value { font-size: var(--text-md); line-height: var(--lh-md); font-weight: var(--weight-bold); }
.dc-none { font-size: var(--text-xs); font-weight: var(--weight-regular); color: var(--color-ink-2); }
.p-sum { display: inline-flex; align-items: baseline; flex-wrap: wrap; }
.p-sub { color: var(--color-ink-2); white-space: pre; }
.closed-link { color: var(--color-ink-2); }
/* off-screen stages gutter (1024 and 768 only): readable, each stage a link */
.board-more { width: 120px; padding: var(--space-3) var(--space-2); gap: var(--space-2); align-items: stretch; }
.board-more .bm-btn { align-self: center; }
.bm-head { text-align: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-ink); }
.bm-stage { display: flex; flex-direction: column; gap: 0; padding: 6px var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--color-line); background: var(--color-surface); color: var(--color-ink); text-decoration: none; font-size: var(--text-sm); line-height: var(--lh-sm); }
.bm-stage:hover { background: var(--color-surface-2); text-decoration: none; }
.bm-stage .bm-n { font-weight: var(--weight-medium); }
.bm-stage .bm-v { color: var(--color-ink-2); font-size: var(--text-sm); }
.modal-wide { width: min(640px, 100%); }
.closed-list { list-style: none; margin: var(--space-3) 0; padding: 0; }
.closed-list li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-line); }
.cl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.closed-list .num { font-weight: var(--weight-semibold); }
@media (max-width: 767px) { .closed-list li { flex-wrap: wrap; } .closed-list .btn { height: 44px; } }

.board { --slim: 0; }
.board { --split: 0; }
.board .col { flex-basis: calc((100cqw - 2 * var(--space-5) - var(--slim) * (96px + var(--gap)) - var(--split) * (17px + var(--gap)) - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.board-wrap.has-more .board { padding-right: 0; }
.board-wrap.has-more .board .col { flex-basis: calc((100cqw - 120px - var(--space-5) - var(--cols) * var(--gap)) / var(--cols)); }
.board .col.is-slim { flex: 0 0 96px; min-width: 96px; background: transparent; border: 1px dashed var(--color-line-strong); }
.col.is-slim .slim-note { align-items: flex-start; line-height: var(--lh-xs); margin-top: 2px; }
.board-split { flex: 0 0 17px; align-self: stretch; position: relative; display: flex; justify-content: center; }
.board-split::before { content: ""; width: 1px; background: var(--color-line-strong); position: absolute; top: 26px; bottom: 0; }
.board-split span { position: absolute; top: 0; left: 50%; transform: translateX(-2px); font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); font-weight: var(--weight-semibold); white-space: nowrap; }
.board-wrap.has-more .board-split { display: none; }
.slim-in { writing-mode: vertical-rl; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) 0; margin: 0 auto; font-size: var(--text-sm); }
.slim-name { font-weight: var(--weight-semibold); color: var(--color-ink); }
.slim-in .col-n { writing-mode: horizontal-tb; }
.slim-note { display: inline-flex; align-items: center; gap: 4px; color: var(--color-ink-2); font-size: var(--text-xs); }
.slim-note .i { color: var(--color-wait); flex: none; }
.dcard .dc-doc { flex-wrap: wrap; height: auto; min-height: 22px; row-gap: 4px; }
.dcard .dc-doc .num { white-space: nowrap; }
.dcard .dc-doc .pill { margin-left: auto; }
.avatar.owner { background: var(--color-surface-3); color: var(--color-ink); font-weight: var(--weight-semibold); }

.board .col { flex-basis: calc((100cqw - 2 * var(--space-5) - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.board .col:nth-child(n) { min-width: 156px; }
.dcard .dc-co { font-size: var(--text-sm); line-height: var(--lh-sm); }

.dcard .dc-title { text-wrap: pretty; }
.col-auto.col-foot { display: flex; gap: 6px; align-items: flex-start; padding: 2px 10px 10px; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); }
.col-auto.col-foot .i { color: var(--color-wait); flex: none; margin-top: 1px; }
.dcard.is-overdue { box-shadow: inset 3px 0 0 var(--color-attn); }

/* ---- Bookings agenda, round 3 ---- */
.day-strip { display: none; }
@media (max-width: 767px) {
  .day-strip { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0 var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); background: var(--color-surface); flex: none; }
  .day-scroll { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-left: 0; }
  .day-scroll::-webkit-scrollbar { display: none; }
  .day-scroll.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .day-scroll.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px); mask-image: linear-gradient(to right, transparent, #000 32px); }
  .day-scroll.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent); }
  .day-chips { display: inline-flex; gap: var(--space-2); padding-right: var(--space-4); }
  .day-chip { flex: none; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface); font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--color-ink-2); white-space: nowrap; text-decoration: none; }
  .day-chip[aria-current="true"] { background: var(--color-ink); color: var(--color-ink-inverse); border-color: var(--color-ink); }
  /* FAB never covers the last row: list pads by FAB 56 + 16 gap + 16 margin + safe area (tab bar sits outside the scroller) */
  .bk-agenda { padding-bottom: calc(56px + var(--space-4) + var(--space-4) + var(--safe-bottom)); }
}
/* one free-time colour (green) everywhere; travel sits right before the visit it leads to */
.agenda-gap .ag-free { margin-left: 0; color: var(--color-good); font-weight: var(--weight-semibold); }
.agenda-gap.ag-free-row { color: var(--color-ink-2); }
.agenda-gap.ag-free-row > .i { color: var(--color-good); }
.agenda-gap.ag-free-row .meta { margin-left: auto; color: var(--color-ink-2); }
.agenda-gap .ag-leave { margin-left: auto; font-weight: var(--weight-semibold); color: var(--color-ink); }
.agenda-gap { color: var(--color-ink-2); }
/* past rows: dimmed by background and weight, text stays at 4.5:1 or better */
.agenda-item.is-past { background: var(--color-surface-2); }
.agenda-item.is-past .t, .agenda-item.is-past .ai-name { color: var(--color-ink-2); }
.agenda-item.is-past .ai-name { font-weight: var(--weight-regular); }
.agenda-item.is-past .ai-sub, .agenda-item.is-past .ai-len { color: var(--color-ink-2); }
.agenda-gap.is-past { background: var(--color-surface-2); color: var(--color-ink-2); }

/* phone: New booking lives in the header (like New contact and New deal), so nothing floats over the agenda */
.phone-new { height: 36px; padding: 0 var(--space-3); margin-right: var(--space-1); }
@media (max-width: 767px) { .bk-agenda { padding-bottom: calc(var(--space-6) + var(--safe-bottom)); } }
.agenda-item.is-past .t, .agenda-item.is-past .ai-name { color: var(--color-ink); }
.agenda-item.is-past .t { font-weight: var(--weight-medium); }

/* past rows stay white; they dim through muted text and regular weight, never a grey band (grey is for day headers) */
.agenda-item.is-past, .agenda-gap.is-past { background: var(--color-surface); }
.agenda-item.is-past .t, .agenda-item.is-past .ai-name { color: var(--color-ink-2); }
.agenda-item.is-past .ai-sub, .agenda-item.is-past .ai-len { color: var(--color-ink-3); }
@media (max-width: 767px) {
  .day-scroll.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 20px); mask-image: linear-gradient(to right, transparent, #000 20px); }
  .day-scroll.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 32px), transparent); }
}

/* ---- Document editor, round 3: wider item column, multi-line descriptions, sticky subtotal, save state beside Send ---- */
@media (min-width: 1200px) { .doc-wrap { grid-template-columns: minmax(0, 1fr) 312px; } .doc-main { padding: var(--space-4); } }
.doc-sheet { max-width: 920px; }
.doc-sec { padding: var(--space-5) var(--space-4); }
.lines td { padding-left: 6px; padding-right: 6px; }
.line-desc-input { min-height: 30px; field-sizing: content; resize: none; color: var(--color-ink-2); white-space: pre-wrap; }
.lines tfoot td { position: sticky; bottom: calc(-1 * var(--space-4)); z-index: 2; background: var(--color-surface); border-top: 1px solid var(--color-line-strong); padding-top: var(--space-3); padding-bottom: var(--space-3); box-shadow: 0 -6px 10px -8px rgba(22,24,29,.18); }
.lines tfoot .tf-label { font-size: var(--text-sm); color: var(--color-ink-2); font-weight: var(--weight-medium); padding-left: calc(6px + var(--space-3)); }
.lines tfoot .tf-sum { font-weight: var(--weight-bold); white-space: nowrap; }
.rail-save { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); flex-wrap: wrap; }
.rail-save > .i { flex: none; margin-top: 1px; }
.rail-save > span { flex: 1; min-width: 0; }
.rail-save.is-saved > .i { color: var(--color-good); }
.rail-save.is-queued { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--color-attn-bg); color: var(--color-ink); }
.rail-save.is-queued > .i { color: var(--color-attn); }
.rail-save.is-failed { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--color-bad-bg); color: var(--color-ink); }
.rail-save.is-failed > .i { color: var(--color-bad); }
.rail-save > span { flex-basis: calc(100% - 24px); }
.rail-save.is-failed .btn { margin-left: 22px; }
.rail-save strong { font-weight: var(--weight-semibold); }

/* the sticky subtotal reads as a bar pinned to the bottom edge, flush with the viewport */
.lines tfoot td { background: var(--color-surface-2); border-top: 1px solid var(--color-line-strong); box-shadow: 0 -8px 16px -10px rgba(22,24,29,.28); padding-top: 10px; padding-bottom: calc(10px + var(--space-4)); }
.lines tfoot td:first-child { border-bottom-left-radius: var(--radius-sm); }
.line-desc-input { color: var(--color-ink); }
.line-desc-input::placeholder { color: var(--color-ink-3); }
.doc-side .meta { white-space: nowrap; }

.lines tfoot td::before { content: ""; position: absolute; left: 0; right: 0; top: -28px; height: 28px; background: linear-gradient(to bottom, transparent, var(--color-surface)); pointer-events: none; }
.lines th { padding-left: 6px; padding-right: 6px; }
.lines th.th-in { padding-left: 18px; }
.lines th.r.th-in { padding-left: 6px; padding-right: 18px; }
.lines th.r:not(.th-in) { padding-right: 6px; }

.tf-more { color: var(--color-ink); font-weight: var(--weight-semibold); }

.rail-list .email, .rail-note .email { white-space: nowrap; }
.rail-list strong, .rail-note strong { white-space: nowrap; }
.rail-list .email wbr, .rail-note .email wbr, .sv-val .email wbr { display: none; }
.doc-sec h4, .doc-sec > .row-flex > h4 { font-size: var(--text-md); line-height: var(--lh-md); color: var(--color-ink); font-weight: var(--weight-semibold); }

/* ---- Systemic density and weight (round 3): contacts, quotes and invoices, orders, calls ----
   Rows 44px; two weights per row (one medium/semibold identifier, the rest regular); secondary
   columns 13px ink-2; no boxed icon tiles; empty cells say "None" in ink-3. */
.table td { height: 44px; }
.table td.t2, .table td.meta, .table td.muted { font-size: var(--text-sm); color: var(--color-ink-2); }
.table .c-name { color: var(--color-ink); font-weight: var(--weight-medium); }
.table .none { color: var(--color-ink-3); }
.table .avatar.sm { --av: 24px; background: var(--color-surface-2); color: var(--color-ink-2); font-weight: var(--weight-medium); }
.docs-table td .num-cell { font-weight: var(--weight-medium); }
.table td.o-id { font-weight: var(--weight-medium); white-space: nowrap; }
.table tbody tr.clickable:hover td:last-child { box-shadow: inset -3px 0 0 var(--color-line-strong); }
.table td .c2 > span:first-child { font-weight: var(--weight-medium); }
/* calls log: one line per call, glyph not tile */
.call-row { grid-template-columns: 20px minmax(0, 1fr) auto auto; gap: var(--space-3); padding: 6px var(--space-4) 6px var(--space-5); min-height: 44px; }
.call-row .chan { width: 20px; height: 20px; background: none; color: var(--color-ink-3); }
.call-row .chan.missed { background: none; color: var(--color-attn); }
.call-row > .stack { flex-direction: row; align-items: baseline; gap: var(--space-3); min-width: 0; flex-wrap: nowrap; }
.call-row .cr-who { flex: none; max-width: 45%; font-weight: var(--weight-medium); }
.call-row .cr-line { flex: 0 1 auto; min-width: 0; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-sm); color: var(--color-ink-2); }
.call-row.missed .cr-line { color: var(--color-attn); font-weight: var(--weight-medium); }
.call-row .cr-line + .cr-follow { display: inline; margin: 0; flex: none; font-size: var(--text-sm); }
.call-row .cr-dur { font-size: var(--text-sm); color: var(--color-ink-2); }
.call-row .btn-icon { width: 32px; height: 32px; }
.calls-log .agenda-day { min-height: 32px; font-size: var(--text-sm); }
@media (max-width: 767px) {
  .call-row { padding: 10px var(--space-4); }
  .call-row > .stack { flex-direction: column; align-items: flex-start; gap: 2px; }
  .call-row .cr-who { max-width: 100%; }
  .call-row .btn-icon { width: 44px; height: 44px; }
}

.cell-link { color: inherit; text-decoration: none; }
.cell-link:hover { color: var(--color-accent); }
.call-row { grid-template-columns: 44px 20px minmax(0, 1fr) auto 32px; }
.call-row .cr-time { font-size: var(--text-sm); color: var(--color-ink-2); }
.call-row .cr-act:empty { display: block; width: 0; }
.call-row .btn-icon { color: var(--color-ink-3); }
@media (max-width: 767px) { .call-row { grid-template-columns: 40px 20px minmax(0, 1fr) 44px; } .call-row .cr-act { display: none; } .call-row .btn-icon { width: 44px; height: 44px; } }

.dcard .dc-co { font-size: var(--text-xs); line-height: var(--lh-xs); }
.dcard.is-overdue { box-shadow: inset 3px 0 0 #c77700; }
.phone-status { font-size: var(--text-xs); font-weight: var(--weight-regular); min-height: 32px; }
.phone-status:hover { background: none; color: var(--color-ink); }
/* settings header: title, description and the shared save state on the left; the one action top right */
.set-title .set-save { display: block; margin-top: var(--space-2); }
.set-title .set-save .savestate { height: auto; padding: 0; }
.set-inner.narrow { max-width: 784px; }
.num-card .perm-row { grid-template-columns: minmax(0, 260px) 96px 96px; }

.dcard .dc-foot { display: flex; align-items: center; min-width: 0; }
.dcard .dc-foot .dc-value { margin-left: auto; white-space: nowrap; flex: none; }
.dcard .dc-foot .dc-age { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.p-legend { display: inline-flex; align-items: center; gap: 4px; margin-left: var(--space-4); font-size: var(--text-xs); color: var(--color-ink-2); }
.p-legend .i { width: 12px; height: 12px; }
@media (max-width: 1199px) { .p-legend { display: none; } }
.nc-sub { grid-column: 1 / -1; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-ink); margin-bottom: calc(-1 * var(--space-1)); }

.p-main { font-weight: var(--weight-medium); color: var(--color-ink); }
.num-card .perm-row { padding: var(--space-2) 0; }
.num-card .perm-row.head { padding-bottom: var(--space-1); }
.num-card .pr-who .meta { font-size: var(--text-sm); color: var(--color-ink-2); }
.num-card .nc-head .meta { font-size: var(--text-sm); }
.nc-dl { gap: var(--space-2) var(--space-4); margin-top: var(--space-3); padding-top: var(--space-3); }
.perm-row .c.c-locked { flex-direction: row; gap: 6px; }
.perm-row .c.c-locked .switch span { opacity: .35; background-image: none; }
.lock-i { width: 14px; height: 14px; color: var(--color-ink-2); }

.dcard .dc-doc { flex-wrap: nowrap; gap: 4px; }
.dcard .dc-doc .pill { margin-left: auto; flex: none; padding: 0 6px; }

.col-overdue { color: var(--color-attn); font-weight: var(--weight-semibold); }
.col-cards { padding: 0 4px 4px; }
.dcard { padding: var(--space-2) 9px; }

/* company: full width, wraps to a second line before it ever truncates */
.dcard .dc-co { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.p-item::before { content: "·"; margin: 0 6px; color: var(--color-ink-3); }
.p-item { white-space: nowrap; }
.perm-row .c.c-locked { position: relative; flex-direction: column; }
.perm-row .c.c-locked .lock-i { position: absolute; left: calc(50% + 26px); top: 50%; transform: translateY(-50%); }
.pr-name { min-width: 0; }
@media (max-width: 767px) {
  .num-card .nc-head { flex-wrap: nowrap; }
  .num-card .nc-head > .stack { flex: 1 1 0 !important; }
  .hide-phone { display: none; }
  .perm-row .c.c-locked .lock-i { left: calc(50% + 22px); }
  .call-row .cr-act, .call-row .cr-act:empty { display: none; }
}

@media (max-width: 767px) {
  .set-inner .num-card .nc-head { flex-wrap: nowrap; }
  .set-inner .num-card .nc-head > .stack { flex: 1 1 0 !important; min-width: 0; }
  .set-inner .num-card .perm-row { grid-template-columns: minmax(0, 1fr) 64px 76px; }
  .is-dial .phone-head .phone-new { display: none; }
}
@media (max-width: 767px) { .nc-dl { grid-template-columns: minmax(0, 1fr); } .nc-dl dd { min-width: 0; } .nc-dl dd .select { width: 100%; min-width: 0; text-overflow: ellipsis; } }

/* the Now line gets its own 20px band so it never reads as the bottom edge of the row above */
.agenda-now { margin: 10px 0 10px var(--space-4); }

.msg-exp { color: var(--color-ink-2); flex: none; margin-top: 2px; transition: transform var(--dur-fast); }
.msg:not(.is-collapsed) .msg-exp { transform: rotate(180deg); }
.msg-subj { font-weight: var(--weight-medium); }
.composer textarea { min-height: 52px; }
.suggest .btn-icon { flex: none; margin-left: -4px; color: var(--color-ink-2); }

/* ===== Settings (ported from design/settings.html inline styles) ===== */
.perm-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
.perm-row.head { font-size: var(--text-xs); color: var(--color-ink-3); font-weight: 600; padding-top: 0; }
.perm-row .c { display: flex; justify-content: center; }
.nc-body .perm-row:last-of-type { border-bottom: 0; }
.num-card { border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.num-card .nc-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--color-line); flex-wrap: wrap; }
.num-card .nc-body { padding: var(--space-2) var(--space-4) var(--space-4); }
.conn-card { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: var(--space-3); align-items: center; padding: var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.conn-card > :last-child { justify-content: flex-end; min-width: 196px; }
.conn-logo { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--color-surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--text-sm); color: var(--color-ink-2); }
.form-row { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: var(--space-4); align-items: start; padding: var(--space-4) 0; border-bottom: 1px solid var(--color-line); }
.form-row > .label { padding-top: 8px; }
.form-row .hint { margin-top: 6px; }
.tpl-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
.set-back { display: none; }
.role-sel { width: auto; height: 32px; }
@media (max-width: 767px) { .role-sel { height: 40px; font-size: var(--text-md); max-width: 128px; } .num-card .nc-head > .stack { flex: 1 1 calc(100% - 44px) !important; } .table .c2 { min-width: 0; } .table .c2 .meta, .table .c2 .strong { overflow-wrap: anywhere; } #users-table { table-layout: fixed; width: 100%; } #users-table td { padding-bottom: 14px; } #users-table th:last-child, #users-table td:nth-child(2) { width: 136px; } }
.form-row.text > .label { padding-top: 0; }
.rule .switch + .sw-label { font-size: var(--text-xs); color: var(--color-ink-3); }
.set-title { flex-wrap: wrap; }
@media (max-width: 767px) { .stage-row { grid-template-columns: 20px minmax(0,1fr) 96px 44px; gap: var(--space-2); padding: var(--space-2); } .stage-row .btn-icon { width: 44px; height: 44px; } .set-title > .btn:not(.btn-icon), .set-title > a.btn:not(.btn-icon) { width: 100%; } .set-title > a.btn-icon { display: none; } .set-title > .spacer { display: none; } }
/* SYS-434: on phones the top bar already names the settings section, so its heading is not repeated under it */
@media (max-width: 767px) { .is-detail .set-title > div:first-child > h2:first-child { display: none; } .is-detail .set-title > div:first-child:has(> h2:only-child) { display: none; } .is-detail .set-title:has(> div:first-child > h2:only-child) { margin-bottom: calc(-1 * var(--space-3)); } .is-detail .set-title > .savestate { padding-left: 0; } }
@media (max-width: 1199px) { .form-row { grid-template-columns: 1fr; gap: var(--space-2); } .form-row > .label { padding-top: 0; } }
@media (max-width: 767px) {
  .settings .set-nav { display: block; }
  .is-detail .settings .set-nav { display: none; }
  .settings .set-body { display: none; }
  .is-detail .settings .set-body { display: block; }
  .form-row { grid-template-columns: 1fr; gap: var(--space-2); }
  .form-row > .label { padding-top: 0; }
  .perm-row { grid-template-columns: minmax(0,1fr) 64px 64px; }
  .conn-card { grid-template-columns: 40px minmax(0,1fr); }
  .conn-card > :last-child { grid-column: 1 / -1; }
}
.input-ghost { border-color: transparent; background: transparent; padding-left: 0; height: 32px; font-weight: var(--weight-semibold); }
.input-ghost:hover { border-color: var(--color-line); }
.input-ghost:focus { border-color: var(--color-accent); background: var(--color-surface); padding-left: var(--space-2); }
.input-sm, .select-sm { height: 32px; font-size: var(--text-sm); }
.btn-xs { width: 24px; height: 18px; min-height: 0; padding: 0; font-size: 9px; line-height: 1; }
.stage-row { display: grid; grid-template-columns: 28px minmax(0,1fr) 200px 36px; gap: var(--space-3); align-items: center; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); }
.sender-card .nc-head .pill { margin-left: auto; }
.sender-card .form-row { padding: var(--space-3) 0; }
.sv-val { display: flex; flex-direction: column; gap: var(--space-2); }
.auth-grid { display: grid; grid-template-columns: 72px auto; gap: 6px var(--space-3); align-items: center; }
.stage-row { grid-template-columns: 28px minmax(0,1fr) 200px 56px; }
@media (max-width: 767px) {
  .settings.is-home .set-nav a[aria-current="page"] { background: none; }
  .settings .set-nav a::after { content: "›"; margin-left: auto; color: var(--color-ink-3); font-size: var(--text-xl); }
}
.table .c2 .meta { white-space: nowrap; }
.settings .table td:nth-child(4) { min-width: 200px; }


/* =====================================================================
   CLIENT SPIKE BRAND + SAAS SETTINGS (Oct 2026)
   ===================================================================== */
.btn-primary.is-loading::after { border-color: #000 #000 transparent transparent; }
.btn-danger-outline { background: var(--color-surface); color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger-outline:hover { background: var(--color-bad-bg); }

/* ---- sign in ---- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; background: var(--color-surface); padding-top: var(--safe-top); }
.auth-brand { position: relative; overflow: hidden; background: var(--brand-black); color: #fff; padding: var(--space-8) clamp(var(--space-6), 9vw, 140px); display: flex; flex-direction: column; justify-content: center; gap: var(--space-5); }
.auth-logo { width: min(340px, 80%); height: auto; margin-left: -6px; }
.auth-tag { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.75rem, 5vw, 4.5rem); line-height: .95; letter-spacing: .01em; text-transform: uppercase; color: var(--brand-mint); max-width: 12ch; }
.auth-sub { color: #c9cdd5; max-width: 42ch; font-size: var(--text-lg); line-height: var(--lh-lg); }
.auth-teeth { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 56 28%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27M0 28 28 0 56 28z%27 fill=%27%234ae1b4%27/%3E%3C/svg%3E") 0 0 / 56px 28px round; }
.auth-form-wrap { display: grid; place-items: center; padding: var(--space-6) var(--space-5); }
.auth > .auth-form-wrap:only-child { padding-top: calc(var(--space-6) + var(--safe-top)); padding-bottom: calc(var(--space-6) + var(--safe-bottom)); }
.auth-form { width: min(380px, 100%); display: flex; flex-direction: column; gap: var(--space-4); }
.auth-form h1 { font-size: var(--text-2xl); line-height: var(--lh-2xl); }
.auth-icon { display: none; width: 56px; height: 56px; margin-bottom: var(--space-2); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth { padding-top: 0; }
  .auth-brand { padding: calc(var(--space-6) + var(--safe-top)) var(--space-5) calc(var(--space-6) + 20px); gap: var(--space-3); }
  .auth-logo { width: 150px; margin-left: 0; } .auth-tag { font-size: 2.5rem; } .auth-sub { display: none; }
  .auth-icon { display: none; }
  .auth-teeth { height: 18px; background-size: 36px 18px; }
}
/* iPhone QA 24 Nov 2026: with the keyboard up (or on a short screen) the black header folds to the logo, so Email,
   Password and Sign in stay above the keyboard (viewport.js also scrolls the box and the button into view) */
@media (max-width: 860px) and (max-height: 640px) {
  .auth-brand { padding: calc(var(--space-3) + var(--safe-top)) var(--space-5) calc(var(--space-3) + 18px); }
  .auth-tag { display: none; } .auth-logo { width: 96px; }
}
@media (max-width: 860px) {
  .kb-up .auth-brand { padding: calc(var(--space-3) + var(--safe-top)) var(--space-5) calc(var(--space-3) + 18px); }
  .kb-up .auth-tag { display: none; } .kb-up .auth-logo { width: 88px; }
  .kb-up .auth-form-wrap { place-items: start center; padding-top: var(--space-4); }
}
/* keyboard up: the keyboard covers the home indicator, so nothing at the bottom (composer, sheet) keeps its inset */
.kb-up .app, .kb-up .scrim { --safe-bottom: 0px; }

/* ---- workspace tile with an uploaded logo ---- */
.ws-mark.has-logo { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line); padding: 2px; overflow: hidden; }
.ws-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* ---- dark theme: wide logos sit on a white chip so a dark logo stays visible ---- */
:root[data-theme="dark"] :is(.ws-wide, .bk-wide-logo) { background: #fff; border-radius: var(--radius-sm); padding: 3px 6px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.ws-wide, .bk-wide-logo) { background: #fff; border-radius: var(--radius-sm); padding: 3px 6px; }
}
/* ---- public booking + form pages: the workspace's brand colour, lifted in dark so it still reads ---- */
:is(.public-book, .public-form)[style*="--pub-brand"] { --color-primary: var(--pub-brand); --color-primary-hover: var(--pub-brand); --color-accent: var(--pub-brand); --color-on-primary: var(--pub-on-brand); --color-on-accent: var(--pub-on-brand); }
:root[data-theme="dark"] :is(.public-book, .public-form)[style*="--pub-brand"] { --color-primary: var(--pub-brand-dark); --color-primary-hover: var(--pub-brand-dark); --color-accent: var(--pub-brand-dark); --color-on-primary: var(--pub-on-brand-dark); --color-on-accent: var(--pub-on-brand-dark); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.public-book, .public-form)[style*="--pub-brand"] { --color-primary: var(--pub-brand-dark); --color-primary-hover: var(--pub-brand-dark); --color-accent: var(--pub-brand-dark); --color-on-primary: var(--pub-on-brand-dark); --color-on-accent: var(--pub-on-brand-dark); }
}
/* dark: the feedback tab is a raised neutral tab (brand black would vanish into the dark page) */
:root[data-theme="dark"] .help-tab { background: var(--color-surface-3); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .help-tab { background: var(--color-surface-3); color: var(--color-ink); box-shadow: inset 0 0 0 1px var(--color-line-strong); } }
.me[aria-current="page"] .meta { color: var(--color-ink-2); }   /* meta on the selected account row: 4.4:1 was just under AA */
/* dark: the "4 left" line on the selected day keeps full strength on the lifted brand colour */
:root[data-theme="dark"] .public-book [aria-pressed="true"] .meta { opacity: 1 !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .public-book [aria-pressed="true"] .meta { opacity: 1 !important; } }
.ws-mark.xl { --m: 72px; border-radius: var(--radius-md); font-size: 28px; }
.menu-brand { display: flex; align-items: center; gap: var(--space-3); }
.menu-brand img { flex: none; }

/* ---- settings: shared pieces ---- */
.set-inner.wide { max-width: 1180px; }
.set-card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.set-card > h3, .set-card h3 { font-size: var(--text-lg); line-height: var(--lh-lg); }
.set-card h4 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--color-ink-3); margin-top: var(--space-2); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--color-ink-2); font-weight: var(--weight-medium); margin-bottom: calc(var(--space-6) * -1 + var(--space-2)); align-self: flex-start; }
.back-link:hover { color: var(--color-ink); }
.dl-mini { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.dl-mini dt { color: var(--color-ink-3); } .dl-mini dd { margin: 0; color: var(--color-ink); min-width: 0; overflow-wrap: anywhere; }
.dl-mini.wide { grid-template-columns: 160px 1fr; font-size: var(--text-md); }
.list-rows { display: flex; flex-direction: column; border: 1px solid var(--color-line); border-radius: var(--radius-sm); }
.list-rows .lr { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 56px; }
.list-rows .lr + .lr { border-top: 1px solid var(--color-line); }
.list-rows .lr > .i { color: var(--color-ink-3); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.form-grid .field > span, .field > span:first-child { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-ink-2); }
.add-row { align-items: flex-end; padding-top: var(--space-3); border-top: 1px solid var(--color-line); }
.color-input { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--color-control-border); border-radius: var(--radius-sm); background: var(--color-surface); }

/* ---- General: logo ---- */
.logo-row { display: flex; align-items: center; gap: var(--space-4); }
.logo-drop { width: 200px; height: 96px; flex: none; border-radius: var(--radius-md); border: 1px dashed var(--color-line-strong); display: grid; place-items: center; background: repeating-conic-gradient(var(--color-surface-2) 0 25%, var(--color-surface) 0 50%) 0 0 / 16px 16px; overflow: hidden; }
.logo-drop.has-logo { border-style: solid; border-color: var(--color-line); }
.logo-drop img { max-width: 100%; max-height: 100%; object-fit: contain; padding: var(--space-2); }
.logo-drop.is-over { border-color: var(--color-accent); box-shadow: var(--focus-ring); }
@media (max-width: 640px) { .logo-row { align-items: flex-start; } }

/* ---- Integrations catalogue ---- */
.int-hero { display: flex; align-items: flex-end; gap: var(--space-4); justify-content: space-between; flex-wrap: wrap; }

.int-hero p { color: var(--color-ink-2); }
.int-tools { display: flex; flex-direction: column; gap: var(--space-3); position: sticky; top: 0; z-index: var(--z-sticky); background: var(--color-surface); padding: var(--space-3) 0; margin: calc(var(--space-3) * -1) 0; border-bottom: 1px solid transparent; }
.int-search { display: flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-3); border: 1px solid var(--color-control-border); border-radius: var(--radius-sm); background: var(--color-surface); max-width: 520px; color: var(--color-ink-3); }
.int-search:focus-within { box-shadow: var(--focus-ring); border-color: var(--color-accent); }
.int-search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: var(--text-md); color: var(--color-ink); min-width: 0; }
.int-cats { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.int-cat { flex: none; height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.int-cat span { color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.int-cat:hover { border-color: var(--color-ink-3); color: var(--color-ink); }
.int-cat[aria-pressed="true"] { background: var(--color-strong); border-color: var(--color-strong); color: var(--color-on-strong); }
.int-cat[aria-pressed="true"] span { color: var(--color-strong-accent); }
.int-section { display: flex; flex-direction: column; gap: var(--space-3); }
.int-sec-head { display: flex; align-items: baseline; gap: var(--space-2); }
.int-sec-head h3 { font-size: var(--text-lg); }
.int-sec-head .count { font-size: var(--text-sm); color: var(--color-ink-3); font-variant-numeric: tabular-nums; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.int-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-ink); text-decoration: none; min-height: 168px; transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast); }
.int-card:hover { text-decoration: none; border-color: var(--color-ink-3); box-shadow: var(--shadow-1); }
.int-card:focus-visible { box-shadow: var(--focus-ring); outline: 0; }
.ic-top { display: flex; align-items: center; gap: var(--space-3); }
.ic-blurb { color: var(--color-ink-2); font-size: var(--text-sm); line-height: var(--lh-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: calc(var(--lh-sm) * 2); flex: none; }
.ic-foot { margin-top: auto; justify-content: space-between; }
.ic-foot { display: flex; align-items: center; gap: var(--space-2); }
.ic-line { margin-left: auto; font-size: var(--text-sm); color: var(--color-ink-3); display: block; text-align: right; min-width: 0; max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-line .i { vertical-align: -3px; }
.int-card:hover .ic-line { color: var(--color-accent); }
.int-logo { --s: 40px; width: var(--s); height: var(--s); flex: none; border-radius: var(--radius-sm); border: 1px solid var(--color-line); background: var(--color-surface); display: grid; place-items: center; overflow: hidden; }
.int-logo img { width: 62%; height: 62%; object-fit: contain; }
.int-logo.is-text { background: var(--lb); color: var(--lf); border-color: transparent; font-weight: var(--weight-bold); font-size: calc(var(--s) * .38); letter-spacing: .02em; }
.int-logo.lg { --s: 64px; border-radius: var(--radius-md); }
.int-none { padding: var(--space-7) 0; }

/* ---- one integration ---- */
.int-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.int-head h2 { font-size: var(--text-2xl); line-height: var(--lh-2xl); }
.int-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-5); align-items: start; }
.int-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.int-side { position: sticky; top: var(--space-4); }
.int-about p { color: var(--color-ink-2); font-size: var(--text-sm); line-height: var(--lh-sm); }
.ticks { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); }
.ticks li { display: flex; gap: var(--space-2); align-items: flex-start; } .ticks .i { color: var(--color-accent); flex: none; margin-top: 2px; }
.connect-panel { gap: var(--space-4); border-color: var(--color-ink-3); }
.steps-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-4); }
.steps-list li { display: flex; gap: var(--space-3); align-items: flex-start; }
.sl-n { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--color-strong); color: var(--color-strong-accent); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.perm-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-ink-2); }
.perm-list li { display: flex; gap: var(--space-2); align-items: flex-start; } .perm-list .i { color: var(--color-ink-3); flex: none; margin-top: 2px; }
.cp-action { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.cp-action form { flex: 1; min-width: 0; }
.danger-zone { flex-direction: row; align-items: center; gap: var(--space-4); border-color: var(--color-bad-bg); }
@media (max-width: 1100px) { .int-layout { grid-template-columns: 1fr; } .int-side { position: static; } }
@media (max-width: 640px) {
  .int-grid { grid-template-columns: 1fr; }
  .int-card { min-height: 0; }
  .danger-zone { flex-direction: column; align-items: stretch; }
  .dl-mini.wide { grid-template-columns: 1fr; gap: 2px var(--space-3); } .dl-mini.wide dd { margin-bottom: var(--space-2); }
  .back-link { margin-bottom: 0; }
  .add-row { flex-direction: column; align-items: stretch; }
}

.ticks, .steps-list, .perm-list { padding: 0; margin: 0; }
.set-card h4 { font-size: var(--text-md); text-transform: none; letter-spacing: 0; color: var(--color-ink); font-weight: var(--weight-semibold); margin-top: var(--space-2); }
.dl-mini a, .ext-link { display: inline-flex; align-items: center; gap: 4px; }
.ext-link { font-size: var(--text-sm); font-weight: var(--weight-medium); margin-top: 2px; }
.int-about .dl-mini { margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--color-line); }
.int-about { gap: var(--space-2); }
.field.is-unset .select { border-color: var(--color-attn); background-color: var(--color-attn-bg); }
.hint.is-attn { color: var(--color-attn); display: inline-flex; align-items: center; gap: 4px; }
.danger-zone { border-color: var(--color-danger-zone-line); background: var(--color-danger-zone-bg); }
.danger-zone h3 { color: var(--color-bad); }
.connect-panel { border-color: var(--color-line-strong); }
.int-card .ic-top .meta { color: var(--color-ink-3); }

.ws-wide { display: block; height: 34px; width: auto; max-width: 168px; object-fit: contain; object-position: left center; }
.auth-tag { font-size: clamp(3rem, 6vw, 5.5rem); }
.ws-mark.ws-rail-only { display: none; }
@media (max-width: 1199px) and (min-width: 768px) { .ws-mark.ws-rail-only { display: inline-flex; } }
@media (max-width: 767px) {
  .int-cats { margin: 0 calc(var(--space-4) * -1); padding: 0 var(--space-4) 2px; scroll-padding: var(--space-4);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
}
.int-tools { border-bottom: 1px solid var(--color-line); margin-bottom: 0; padding-bottom: var(--space-3); }
@media (min-width: 768px) { .int-cats { flex-wrap: wrap; overflow: visible; } }
.pill.pill-na { background: transparent; color: var(--color-ink-3); box-shadow: inset 0 0 0 1px var(--color-line-strong); }
.row-static { min-height: var(--control-h); display: inline-flex; align-items: center; }
.banner-info { background: var(--color-surface-2); } .banner-info > .i { color: var(--color-ink-2); }
.me { text-decoration: none; color: var(--color-ink); }
.me:hover { background: var(--color-surface-2); text-decoration: none; }
.me[aria-current="page"] { background: var(--color-surface-3); }

.lr-link { color: var(--color-ink); text-decoration: none; } .lr-link:hover { background: var(--color-surface-2); text-decoration: none; }
.account-body { overflow: auto; flex: 1; min-height: 0; } .account-body .set-inner { max-width: 760px; }
.me[aria-current="page"] .avatar { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line); }
.pay-choice { max-width: 520px; }
.radio-card { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-sm); cursor: pointer; background: var(--color-surface); }
.radio-card:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-weak); }
.radio-card.is-off { cursor: not-allowed; background: var(--color-surface-2); }
.radio-card.is-off .strong { color: var(--color-ink-3); }
.radio-card.is-off .meta { color: var(--color-ink-2); }
.radio-card input { margin-top: 3px; accent-color: var(--color-accent); }

/* ---- feedback ---- */
.nav-btn { display: flex; align-items: center; gap: var(--space-3); width: 100%; height: 36px; padding: 0 var(--space-2) 0 var(--space-3); border: 0; background: transparent; border-radius: var(--radius-sm); color: var(--color-ink-2); font: inherit; font-weight: var(--weight-medium); cursor: pointer; text-align: left; }
.nav-btn:hover { background: var(--color-surface-2); color: var(--color-ink); }
@media (max-width: 1199px) and (min-width: 768px) { .nav-btn { flex-direction: column; height: auto; padding: var(--space-2) 0; gap: 4px; justify-content: center; font-size: 11px; line-height: 13px; text-align: center; } .nav-btn .nav-label { font-size: 0; } .nav-btn .nav-label::after { content: attr(data-short); font-size: 11px; } }
.fb-kinds { display: flex; gap: var(--space-2); flex-wrap: nowrap; background: transparent; padding: 0; }
.fb-kinds label { flex: 1 1 0; min-width: 0; }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds span { display: flex; align-items: center; justify-content: center; height: 40px; padding: 0 var(--space-3); border: 1px solid var(--color-line-strong); border-radius: var(--radius-sm); font-weight: var(--weight-medium); color: var(--color-ink-2); cursor: pointer; background: var(--color-surface); }
.fb-kinds input:checked + span { background: var(--color-strong); border-color: var(--color-strong); color: var(--color-on-strong); }
.fb-kinds input:focus-visible + span { box-shadow: var(--focus-ring); }
.fb-list-wrap { gap: var(--space-4); }
.fb-kind { width: 32px; height: 32px; border-radius: 50%; background: var(--color-surface-2); display: grid; place-items: center; flex: none; color: var(--color-ink-2); }
.fb-kind-lg { width: 48px; height: 48px; }
.fb-kind-lg svg { width: 24px; height: 24px; }
.fb-list-wrap > .seg { align-self: flex-start; width: auto; }
.fb-shot .meta { color: var(--color-accent-ink); }
.fb-shot { display: flex; flex-direction: column; gap: var(--space-1); align-self: flex-start; max-width: 680px; text-decoration: none; }
#feedbackModal input[type=file] { padding: 6px; height: auto; }
#feedbackModal input[type=file]::file-selector-button { font: inherit; font-weight: var(--weight-medium); height: 32px; padding: 0 var(--space-3); margin-right: var(--space-3); border: 1px solid var(--color-line-strong); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-ink); cursor: pointer; }
.fb-thread { gap: var(--space-4); }
.fb-msg { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-2); max-width: 680px; }
.fb-msg.is-team { background: var(--brand-mint-weak); align-self: flex-end; border: 1px solid var(--brand-mint-line); }
.fb-who { display: flex; align-items: center; gap: var(--space-2); }
.fb-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-shot img { width: 100%; max-height: 360px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); }
.fb-reply { padding-top: var(--space-3); border-top: 1px solid var(--color-line); }

/* booking page settings */
.bk-link { flex-wrap: wrap; }
.bk-link-base { color: var(--color-ink-2); font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-sm); white-space: nowrap; }
.bk-link .input { flex: 1 1 180px; min-width: 160px; max-width: 260px; }
.bk-link .btn-icon { width: 40px; height: 40px; flex: none; }
.bk-embed { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 18px; word-break: break-all; }
@media (max-width: 767px) { .bk-link-base { flex-basis: 100%; white-space: normal; word-break: break-all; } .bk-link .input { max-width: none; } }

/* public booking page shown inside another website */
html.is-embed, html.is-embed body { background: transparent; }
html.is-embed .public-book { padding: var(--space-2) var(--space-2) var(--space-4) !important; max-width: 820px !important; }
.public-book .slot[aria-pressed="true"], .public-book [aria-current="true"] { color: var(--color-on-primary, #fff) !important; }
html.is-embed .public-book > header .ws-mark, html.is-embed .public-book > header .bk-wide-logo { display: none; }
.bk-wide-logo { height: 48px; width: auto; max-width: 260px; object-fit: contain; align-self: flex-start; }

/* ---- usability round 24 Oct: narrow-screen layouts (kept at the end so they win over the base rules above) ---- */
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (min-width: 1100px) { .narrow-only { display: none !important; } }
@media (max-width: 1099px) { .wide-only { display: none !important; } }
@media (max-width: 767px) {
  /* pipeline stages: name on its own line, type + count under it, arrows down the left */
  .stage-row { grid-template-columns: 44px minmax(0,1fr) auto; grid-template-areas: "mv name name" "mv type cnt"; row-gap: var(--space-2); }
  .stage-row > :nth-child(1) { grid-area: mv; } .stage-row > :nth-child(2) { grid-area: name; } .stage-row > :nth-child(3) { grid-area: type; min-width: 0; } .stage-row > :nth-child(4) { grid-area: cnt; }
  /* logo: preview, then buttons, then help, all full width */
  .logo-row { flex-wrap: wrap; } .logo-row > * { min-width: 0; } .logo-row > :last-child { flex: 1 1 100%; }
  /* sender cards: address gets the full width, status and test button on the next line */
  .sender-card .nc-head { flex-wrap: wrap !important; } .sender-card .nc-head > .stack { flex: 1 1 calc(100% - 52px) !important; }
  /* list rows with a status + button (Gmail mailboxes, calendar hosts): text first, controls underneath */
  .set-card .list-rows .lr { flex-wrap: wrap; } .set-card .list-rows .lr > .stack { flex: 1 1 100% !important; }
  select.select { max-width: 100%; }
}
.pw-wrap { position: relative; } .pw-wrap .input { padding-right: 72px; } .pw-wrap .pw-show { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; }
.th-name-link { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: inherit; text-decoration: none; }
.th-name-link:hover h2 { color: var(--color-accent); }
@media (min-width: 1200px) { .th-name-link svg { display: none; } }
.prod-sku { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-1); }
.prod-sku .input { max-width: 180px; min-height: 28px; height: 28px; }
.prod-sku-ro { display: block; }
.prod-table td:first-child { padding-top: var(--space-2); padding-bottom: var(--space-2); }
/* Phone: each product is a small card (name, SKU, then price and VAT side by side) so nothing runs off the screen. */
@media (max-width: 767px) {
  .prod-table, .prod-table tbody { display: block; }
  .prod-table thead { display: none; }
  .prod-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); align-items: end; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); }
  .prod-table tr:last-child { border-bottom: 0; }
  .prod-table td, .prod-table td.r { display: block; height: auto; padding: 0 !important; border: 0; text-align: left; }
  .prod-table td:first-child { grid-column: 1 / -1; }
  .prod-table td.only-desk { display: none; }
  .prod-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--text-xs); color: var(--color-ink-3); margin-bottom: 2px; }
  .prod-table td.r .input { max-width: none !important; width: 100%; text-align: left !important; }
  .prod-table .prod-name { min-width: 0; width: 100%; }
  .prod-table .prod-sku .input { max-width: none; flex: 1; }
}
.prod-name { field-sizing: content; min-height: 32px; resize: none; line-height: 18px; padding-top: 6px; padding-bottom: 6px; min-width: 220px; }

/* ---- feedback: side tab + panel (like the EFS exhibitor help) and ticket thread ---- */
.help-tab { position: fixed; right: 0; top: 50%; transform: translateY(-50%); width: 26px; padding-left: 0 !important; padding-right: 0 !important; z-index: calc(var(--z-sticky) + 1); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--brand-black); color: #fff; box-shadow: var(--shadow-2, 0 4px 12px rgba(0,0,0,.18)); cursor: pointer; opacity: .9; }
.help-tab:hover, .help-tab:focus-visible { opacity: 1; padding-right: 9px; }
.help-tab span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: var(--weight-semibold); letter-spacing: .02em; }
@media print { .help-tab { display: none; } }
@media (min-width: 768px) {
  .help-scrim { justify-content: flex-end; align-items: stretch; }
  .help-panel { width: min(440px, 100vw); max-height: none; height: 100%; border-radius: 0; margin: 0; display: flex; flex-direction: column; }
  .help-panel .modal-body { flex: 1; overflow: auto; }
}
@media (max-width: 767px) { .help-tab { top: auto; bottom: calc(var(--tabbar-h, 64px) + 96px + var(--safe-bottom)); transform: none; padding: 8px 5px; } }
.fb-shot-pick { display: flex; flex-direction: column; gap: var(--space-2); }
.fb-shot-preview { border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-surface-2); min-height: 64px; display: grid; place-items: center; padding: var(--space-2); }
.fb-shot-preview img { max-width: 100%; max-height: 180px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.fb-event { display: flex; align-items: center; gap: var(--space-2); color: var(--color-ink-2); font-size: var(--text-sm); padding: 0 var(--space-2); }
.fb-msg.is-question { border: 1px solid var(--color-ask-line); background: var(--color-ask-bg); }
.fb-list .lr.is-unread .strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); margin-right: 6px; vertical-align: middle; }
@media (min-width: 768px) { body.has-help-tab .main { margin-right: 26px; } } /* the tab has its own strip, so it never covers content */
.fb-shot-preview img { width: 100%; max-height: 240px; object-fit: contain; object-position: top; }

.fb-who { flex-wrap: wrap; row-gap: 4px; }
.fb-who .strong { white-space: nowrap; }
.fb-who .meta { white-space: nowrap; }
@media (max-width: 767px) { .fb-who .pill { order: 9; flex-basis: auto; } .fb-thread { padding-left: var(--space-3); padding-right: var(--space-3); } .help-tab { opacity: .75; } }
body:has(.scrim:not([hidden])) .help-tab, body:has(.drawer) .help-tab { display: none; }
@media (min-width: 768px) {
  .help-scrim { padding: 0 !important; }
  .help-panel { position: fixed; top: 0; right: 0; bottom: 0; margin: 0 !important; max-height: 100vh; border-radius: 0 !important; }
}
/* Automations: rule pills grow with their text on narrow screens; builder step cards */
.rule-line .chip { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.rule-line .kw { line-height: 28px; }
.rule-steps { display: flex; flex-wrap: wrap; gap: var(--space-2); flex: 1 1 0; min-width: 0; }
.step-card { border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4) var(--space-4); background: var(--color-surface); }
.step-card.is-invalid { border-color: var(--color-bad); }
.step-card.is-invalid::after { content: "Needs a quote: start the automation when a quote is sent or accepted."; display: block; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-bad); }
.step-head { display: flex; align-items: center; gap: var(--space-2); margin: 0 calc(-1 * var(--space-2)) var(--space-2) 0; }
.step-head .btn-icon:disabled { opacity: .4; }
.step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--color-surface-2); border: 1px solid var(--color-line); display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.add-steps { display: flex; flex-direction: column; gap: var(--space-2); }
.auto-builder code { font-size: var(--text-xs); background: var(--color-surface-2); padding: 1px 4px; border-radius: 4px; }
@media (max-width: 767px) { .add-steps > .row-flex { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; } .add-steps .btn-sm { height: auto; min-height: 40px; min-width: 0; padding-block: 6px; white-space: normal; text-align: left; line-height: 1.25; font-size: var(--text-md); justify-content: flex-start; } .step-head .btn-icon { width: 44px; height: 44px; } }
.rule-name { font-weight: var(--weight-semibold); color: var(--color-ink); text-decoration: none; overflow-wrap: anywhere; }
.rule-name:hover { color: var(--color-accent); }

/* Website forms (Settings) and the public form page (/f/<form>) */
.choice-card { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; text-align: left; padding: var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-lg, 12px); background: var(--color-surface, #fff); color: inherit; font: inherit; cursor: pointer; }
.choice-card:hover, .choice-card:focus-visible { border-color: var(--color-primary); }
.choice-card .meta { color: var(--color-ink-2); line-height: 1.45; }
.row-flex.wrap { flex-wrap: wrap; }
.pf-card .pf-q { padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md, 8px); display: flex; flex-direction: column; gap: var(--space-2); }
.pf-card .pf-q .row-flex > .input { flex: 1; min-width: 0; }
.pf-card .pf-more { padding-top: var(--space-3); }
.pf-card .pf-more > summary { cursor: pointer; color: var(--color-ink-2); }
.i-up { transform: rotate(180deg); }
html.is-embed .public-form { padding: 3px 3px var(--space-2) !important; max-width: none !important; }   /* lines up with the website's own content; 3px keeps focus rings visible */

/* phone numbers: call handling (FB-16) */
.ring-order { list-style: none; margin: 0; padding: 0; border: 1px solid var(--color-line-strong, var(--color-line)); border-radius: var(--radius-md); }
.ring-order li { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-1) 0 var(--space-3); height: 44px; }
.ring-order li .btn { flex: none; }
.ring-order li + li { border-top: 1px solid var(--color-line); }
.ring-order .ro-n { width: 20px; color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.ring-order .ro-name { flex: 1; min-width: 0; }
.rec-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.rec-row audio { height: 36px; max-width: 100%; flex: 1 1 220px; }
.rec-up { align-self: flex-start; cursor: pointer; }
.rec-up.is-busy { opacity: .6; pointer-events: none; }
.hours-row { display: grid; grid-template-columns: 64px 112px 20px 112px; justify-content: start; align-items: center; gap: var(--space-2); }
.hours-row .check { align-items: center; }
.hours-row > span { text-align: center; }
.nc-dl dd .select-sm, .nc-dl dd .input-sm { max-width: 100%; }
@media (max-width: 767px) {   /* a long form name keeps the full width; its status sits under it */
  .set-inner .num-card.pf-card .nc-head { flex-wrap: wrap; }
  .set-inner .num-card.pf-card .nc-head > .stack { flex: 1 1 calc(100% - 40px) !important; }
  .set-inner .num-card.pf-card .nc-head > .pill { margin-left: 40px; }
}

/* Get a number (Settings › Phone numbers) and DNS records (Email senders), FB-11 */
.buy-list { display: flex; flex-direction: column; border: 1px solid var(--color-line); border-radius: var(--radius-sm); }
.buy-row { padding: var(--space-3); border-bottom: 1px solid var(--color-line); }
.buy-row:last-child { border-bottom: 0; }
.buy-confirm { margin-top: var(--space-3); }
.dns-recs { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; }
.dns-rec { border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.dns-kv { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.dns-kv code { font-size: var(--text-sm); overflow-wrap: anywhere; word-break: break-all; background: var(--color-surface-2, #f4f5f7); padding: 2px 6px; border-radius: 4px; }
@media (max-width: 560px) { .dns-kv { grid-template-columns: minmax(0, 1fr) auto; } .dns-kv > .meta { grid-column: 1 / -1; } }
/* an open dialog covers the whole screen: the Feedback tab steps aside so it never sits on top of the dialog's fields */
body:has(.scrim:not([hidden])) .help-tab { display: none; }

/* ---- usability round 2 ---- */
/* tablet (768-1199): quote/invoice actions and side panel sit below the form, primary action pinned at the bottom */
@media (min-width: 768px) and (max-width: 1199px) {
  .doc-wrap { display: block; overflow: auto; }
  .doc-main { overflow: visible; }
  .doc-side { display: flex; border-left: 0; border-top: 1px solid var(--color-line); overflow: visible; max-width: 920px; margin: 0 auto var(--space-6); }
  .rail-act { display: none; } /* all actions are in the pinned bar, without duplicates */
  .doc-actions-phone { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-2) var(--space-5); border-top: 1px solid var(--color-line); background: var(--color-surface); }
  .doc-actions-phone .ptotal { margin-right: auto; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
}
.bk-phone-tools { display: flex; gap: var(--space-2); padding: var(--space-2) var(--space-4) 0; flex-wrap: wrap; }
@media (min-width: 768px) { .bk-phone-tools { display: none !important; } }
#lineSheet .modal-foot, #paySheet .modal-foot { display: flex; gap: var(--space-2); }
/* Admin panel (Client Spike team): section strip on phones, tables as small cards so nothing runs off the screen. */
.adm-tabs { display: flex; gap: var(--space-1); overflow-x: auto; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); background: var(--color-surface); }
.adm-tabs a { flex: none; height: 36px; display: inline-flex; align-items: center; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--color-ink-2); text-decoration: none; font-weight: var(--weight-medium); }
.adm-tabs a[aria-current="page"] { background: var(--color-surface-2); color: var(--color-ink); }
@media (max-width: 767px) {
  .adm-table, .adm-table tbody { display: block; }
  .adm-table thead { display: none; }
  .adm-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); }
  .adm-table tr:last-child { border-bottom: 0; }
  .adm-table td, .adm-table td.r { display: block; height: auto; padding: 0 !important; border: 0; text-align: left; min-width: 0; }
  .adm-table td:first-child { grid-column: 1 / -1; }
  .adm-table td:empty { display: none; }
  .adm-table td[data-label]::before { content: attr(data-label); display: block; font-size: var(--text-xs); color: var(--color-ink-3); margin-bottom: 2px; }
  .adm-table .select, .adm-table .input { max-width: none !important; width: 100%; }
}
/* ---------- Letters (FB-18) ---------- */
.letter-form { max-width: 720px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); display: flex; flex-direction: column; gap: var(--space-4); }
.letter-to { border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4) var(--space-4); margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.letter-to > legend { width: auto; float: none; display: table; padding: 0 var(--space-1); margin-left: calc(-1 * var(--space-1)); } /* the notch only around the word, so the box's top edge stays whole */
.letter-form input, .letter-form textarea { font-size: max(16px, var(--text-md)); } /* 16px: no iPhone zoom while typing */
/* the address is its own small section inside the To box: a divider above, its heading inside the line */
.letter-addr { margin-top: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.letter-addr fieldset.field-group > legend { font-weight: var(--weight-semibold); }
.letter-ro { margin: 0; padding: var(--space-2) var(--space-3); background: var(--color-surface-2); border-radius: var(--radius-sm); }
.letter-body { min-height: 280px; line-height: var(--lh-lg); resize: vertical; }
.letter-form textarea[readonly], .letter-form input[readonly] { background: var(--color-surface-2); }
.letter-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding-top: var(--space-4); border-top: 1px solid var(--color-line); }
.combo { position: relative; }
.combo .search { display: flex; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: var(--space-1); list-style: none; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); box-shadow: var(--shadow-2); max-height: 320px; overflow: auto; }
.combo-list li { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); cursor: pointer; min-height: 44px; justify-content: center; }
.combo-list li[data-i]:hover, .combo-list li[data-i]:focus { background: var(--color-surface-2); }
.btn-link { background: none; border: 0; padding: 0; color: var(--color-accent); font: inherit; cursor: pointer; }
.letter-drafts { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
@media (max-width: 720px) {
  .letter-form { padding: var(--space-4) var(--space-3) var(--space-6); }
  /* phones: Send full width first, Preview and Download side by side, the quieter actions last */
  .letter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .letter-actions .spacer { display: none; }
  .letter-actions [data-send] { grid-column: 1 / -1; order: -1; min-height: 48px; }
  .letter-actions [data-copy], .letter-actions [data-cancel-link], .letter-actions [data-discard] { grid-column: 1 / -1; }
}

.bubble { overflow-wrap: anywhere; }
.bubble a { color: inherit; text-decoration: underline; }
.tl:has(> li.meta)::before { display: none; } /* no timeline rail through the empty-state text */
@media (max-width: 767px) {
  /* phones show the same detail line as desktop (the date of the visit, who was told), under the title */
  .tl-head { flex-wrap: wrap; }
  .tl-head .t { white-space: normal; flex: 1 1 0; min-width: 0; }
  .tl-head .meta { display: block !important; order: 3; flex-basis: 100%; white-space: normal; }
}

/* close-deal choice: the picked option is filled, like the feedback kinds */
[data-lost-form] .seg input:checked + .seg-btn { background: var(--color-strong); border-color: var(--color-strong); color: var(--color-on-strong); font-weight: var(--weight-semibold); }
.dcard.is-dragging { opacity: .5; }
.col.is-drop { outline: 2px dashed var(--color-accent); outline-offset: -2px; background: var(--color-accent-weak); }

.doc-details { display: flex; flex-direction: column; }
.doc-details-sum { display: none; }
@media (max-width: 767px) {
  .doc-details-sum { display: flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); font-weight: var(--weight-medium); cursor: pointer; list-style: none; }
  .doc-details-sum::after { content: "▾"; margin-left: auto; color: var(--color-ink-3); }
  .doc-details[open] .doc-details-sum::after { content: "▴"; }
}

.dc-foot .dc-age { flex: none; white-space: nowrap; }
.dc-foot .dc-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Settings › Billing and the add-a-card prompt (SYS-157) */
.app-banner { margin: var(--space-3) var(--space-5); flex: none; }
.bill-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.bill-stat { border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: var(--color-surface); }
.bill-big { font-size: 28px; line-height: 34px; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.bill-card { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); }
.bill-card.is-empty { border-style: dashed; background: var(--color-surface-2); }
.bill-card-i { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-2); flex: none; }
@media (max-width: 767px) { .app-banner { margin: var(--space-3); } .bill-card { padding: var(--space-4); } .bill-card-i { display: none; } .bill-card form, .bill-card form .btn, .bill-card > .btn { width: 100%; } .bill-stat { padding: var(--space-3) var(--space-4); } }

/* first steps in a new workspace */
.first-steps { padding: var(--space-5) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.fs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.fs-list a { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); color: inherit; text-decoration: none; background: var(--color-surface); min-height: 56px; }
.fs-list a:hover { border-color: var(--color-ink-3); }
.fs-list a > :last-child { margin-left: auto; color: var(--color-ink-3); flex: none; }
.fs-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-line); display: grid; place-items: center; flex: none; }
.fs-list .is-done .fs-tick { background: var(--color-good, #1f8a4c); border-color: var(--color-good, #1f8a4c); color: var(--color-ink-inverse); }
.fs-list .is-done .strong { color: var(--color-ink-2); font-weight: var(--weight-medium); }
.fs-list li:not(.is-done) a { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); } /* what's left stands out */

/* phones: a narrower, lighter Feedback tab so it covers as little of a card's edge as possible */
@media (max-width: 767px) { body.has-help-tab .help-tab { width: 22px; opacity: .8; } }

/* phones: list searches get their own full-width row above the filter chips, so the placeholder fits */
@media (max-width: 767px) {
  form.toolbar { flex-wrap: wrap; }
  form.toolbar > .search, .toolbar > form.search { flex: 1 1 100% !important; max-width: none !important; }
}
/* Date fields show the date in the workspace's language (client.js dateFaces), whatever the phone's region */
.date-wrap { position: relative; }
.date-wrap.has-value > input[type="date"] { color: transparent; }
.date-wrap.has-value > input[type="date"]::-webkit-datetime-edit { color: transparent; }
.date-wrap > .date-face { position: absolute; left: var(--space-3); right: 40px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: var(--text-md); color: var(--color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a mouse and keyboard edit the field's own parts, so show them while it has focus */
@media (pointer: fine) {
  .date-wrap.has-value > input[type="date"]:focus, .date-wrap.has-value > input[type="date"]:focus::-webkit-datetime-edit { color: var(--color-ink); }
  .date-wrap > input[type="date"]:focus + .date-face { display: none; }
}
/* Speaking notes (FB-19): microphone by note boxes; red while listening */
.note-field-head { display: flex; align-items: center; gap: var(--space-2); }
.note-field-head label { flex: 1; }
.dictate-btn.is-listening { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.dictate-btn.is-listening svg { animation: dictate-pulse 1.2s ease-in-out infinite; }
@keyframes dictate-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dictate-btn.is-listening svg { animation: none; } }

/* ---------- Documents area ---------- */
.doc-links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.doc-links:not(:has(.chip:not([hidden]), .meta)) { margin-bottom: 0; }
.doc-links .chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 6px 0 12px; border: 1px solid var(--color-line); border-radius: var(--radius-pill); background: var(--color-surface-2); font-size: var(--text-sm); max-width: 100%; }
.doc-links .chip [data-chip-text] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-links .chip-x { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: none; border-radius: 50%; color: var(--color-ink-2); cursor: pointer; }
.doc-links .chip-x:hover { background: var(--color-line); }
.sign-check { align-items: flex-start; padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.doc-filter-wrap { padding: 0 var(--space-5) var(--space-3); overflow-x: auto; }
.doc-filter { flex-wrap: nowrap; display: inline-flex; width: max-content; max-width: none; }
.doc-filter .btn-seg { white-space: nowrap; }
@media (max-width: 767px) { .doc-filter-wrap { padding: 0 var(--space-4) var(--space-3); } }
/* the public page where a document is read and signed */
.sign-wrap { max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); display: flex; flex-direction: column; gap: var(--space-5); }
.sign-paper { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,.05)); }
.sign-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.sign-head > :first-child { flex: 1; min-width: 0; }
.sign-date { white-space: nowrap; flex: none; padding-top: 4px; }
.nowrap { white-space: nowrap; }
.sign-contact { text-align: center; }
.doc-st { font-weight: var(--weight-medium); }
.doc-st-awaiting { color: var(--color-attn, #9a5b00); }
.doc-st-signed { color: var(--color-good, #0a7a4f); }
.sign-logo { max-height: 56px; max-width: 200px; object-fit: contain; object-position: left center; display: block; }
.sign-biz { font-size: var(--text-xl); }
.sign-title { font-size: var(--text-2xl, 1.6rem); margin: 0 0 var(--space-3); }
.sign-to { margin: 0 0 var(--space-4); color: var(--color-ink-2); }
.sign-h { font-size: var(--text-lg); margin: var(--space-3) 0; }
.sign-body p { margin: 0 0 var(--space-3); line-height: 1.6; overflow-wrap: anywhere; }
.sign-box { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-6); }
.sign-box input { font-size: max(16px, var(--text-md)); }
@media (max-width: 600px) { .sign-paper, .sign-box { padding: var(--space-4); } .sign-wrap { padding: var(--space-3) var(--space-3) var(--space-6); } }
/* the customer's quote page (/d/, SC-151): the quote as the PDF shows it, then Accept */
.quote-wrap .sign-head { align-items: center; }
.q-facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: 0 0 var(--space-5); }
.q-facts div { min-width: 0; }
.q-facts dt, .q-label { font-size: var(--text-xs); color: var(--color-ink-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.q-facts dd { margin: 0; font-weight: var(--weight-medium); }
.q-for .sign-to { margin-bottom: var(--space-4); color: var(--color-ink); }
.q-lines { width: 100%; border-collapse: collapse; margin: var(--space-3) 0 var(--space-4); }
.q-lines th { font-size: var(--text-xs); color: var(--color-ink-2); font-weight: var(--weight-semibold); text-align: left; padding: 0 var(--space-2) var(--space-2) 0; border-bottom: 1px solid var(--color-line); }
.q-lines td { padding: var(--space-3) var(--space-2) var(--space-3) 0; border-bottom: 1px solid var(--color-line); vertical-align: top; }
.q-lines th:last-child, .q-lines td:last-child { padding-right: 0; }
.q-lines .num, .q-totals dd { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-name { display: block; font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.q-desc { display: block; color: var(--color-ink-2); font-size: var(--text-sm); line-height: 1.4; margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.q-pill { vertical-align: middle; font-size: var(--text-sm); margin-left: var(--space-2); }
.q-totals { margin: 0 0 var(--space-4) auto; max-width: 320px; display: flex; flex-direction: column; gap: var(--space-1); }
.q-totals div { display: flex; justify-content: space-between; gap: var(--space-4); }
.q-totals dt { color: var(--color-ink-2); }
.q-totals dd { margin: 0; }
.q-totals .q-total { border-top: 1px solid var(--color-line); padding-top: var(--space-2); margin-top: var(--space-1); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.q-totals .q-total dt { color: var(--color-ink); }
.q-note { color: var(--color-ink-2); font-size: var(--text-sm); }
.q-note p:last-child, .sign-paper > :last-child { margin-bottom: 0; }
.q-meta { display: none; color: var(--color-ink-2); font-size: var(--text-sm); margin-top: 2px; }
.q-totals div:not(.q-total) { padding: 2px 0; }
@media (max-width: 600px) {
  .q-facts { display: grid; grid-template-columns: 1fr 1fr; }
  .q-lines thead, .q-lines td.num:not(.q-amt) { display: none; }
  .q-lines, .q-lines tbody { display: block; width: 100%; }
  .q-lines tr { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
  .q-lines td { border: 0; padding: 0; }
  .q-lines .q-item { flex: 1; min-width: 0; }
  .q-meta { display: block; }
  .q-totals { max-width: none; }
}
.bill-big.is-neg { color: var(--color-bad); }

/* users table: the forwarded-calls mobile has its own column only on wide screens */
@media (max-width: 1499px) { .xwide-only { display: none !important; } }
.mid-only { display: none !important; }
@media (min-width: 1100px) and (max-width: 1499px) { .mid-only { display: flex !important; } }

/* tablet: the deal panel leaves room for the board, and its buttons are easy to tap */
@media (min-width: 768px) and (max-width: 1199px) {
  .drawer { width: min(400px, 46vw) !important; }
  .drawer .btn-sm, .doc-sec .btn-sm { min-height: 40px; }
}
/* FB-56 task drawer: notes fill the space left under the fields; Expand widens it up to the sidebar,
   notes on the left taking most of the room, the fields in a column on the right */
.task-drawer .task-side { display: flex; flex-direction: column; gap: var(--space-5); }
.task-drawer .task-notes { flex: 1 0 auto; display: flex; flex-direction: column; }
.task-drawer .task-notes .textarea { flex: 1 1 auto; min-height: 8.5rem; }
.task-wide-btn .if-wide, .task-drawer.is-wide .task-wide-btn .if-narrow { display: none; }
.task-drawer.is-wide .task-wide-btn .if-wide { display: inline-block; }
@media (min-width: 768px) {
  .task-drawer.is-wide { width: calc(100vw - var(--sidebar-w)) !important; }
  .task-drawer.is-wide .drawer-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "title title" "notes side" "notes made"; column-gap: var(--space-6); row-gap: var(--space-5); align-content: stretch; }
  .task-drawer.is-wide .task-f-title { grid-area: title; }
  .task-drawer.is-wide .task-side { grid-area: side; }
  .task-drawer.is-wide .task-side .grid-2 { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-5); } /* Due over Time: the full date fits */
  .task-drawer.is-wide .task-made { grid-area: made; align-self: start; margin: 0; }
  .task-drawer.is-wide .task-notes { grid-area: notes; min-height: 0; }
  .task-drawer.is-wide .task-notes .textarea { min-height: 18rem; height: 100%; resize: none; line-height: 1.6; }
}
@media (min-width: 768px) and (max-width: 1199px) { .task-drawer.is-wide { width: calc(100vw - var(--rail-w)) !important; } }
@media (min-width: 768px) and (max-width: 979px) {
  .task-drawer.is-wide .drawer-body { grid-template-columns: minmax(0, 1fr) 280px; }
}
/* search results: the phone/email line wraps rather than being cut off */
.menu-item .meta.truncate { white-space: normal; overflow-wrap: anywhere; }
.menu-item .stack.truncate > .meta { white-space: normal; overflow-wrap: break-word; }   /* "...from every workspace" wraps, not cut at "from ev" (SYS-420) */
/* Recorded notes (FB-19): Record button while recording, and one line per recording under the note box */
.record-btn.is-listening { color: #b42318; background: #fef3f2; border-color: #fecdca; font-variant-numeric: tabular-nums; }
.rec-status { display: flex; flex-direction: column; gap: var(--space-1); padding: 0 var(--space-3) var(--space-2); }
.rec-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-ink-2); min-height: 32px; }
.rec-row .rec-text { min-width: 0; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-ink-3, #8a8f98); flex: none; }
.rec-row[data-state="working"] .rec-dot, .rec-row[data-state="sending"] .rec-dot { background: #b54708; animation: dictate-pulse 1.2s ease-in-out infinite; }
.rec-row[data-state="done"] .rec-dot { background: var(--color-accent); }
.rec-row[data-state="failed"] { color: #b42318; }
.rec-row[data-state="failed"] .rec-dot { background: #b42318; }
.note-rec { display: block; width: 100%; max-width: 360px; height: 36px; margin-top: var(--space-2); }
.note-foot { flex-wrap: wrap; }
.note-actions { display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto; }

/* Sales tax rates in Business details (SYS-176): one aligned row per rate (kind, rate %, own name, move up, remove);
   an Exempt or Not charged row keeps the rate's space so every column lines up. Phones: kind + rate, then name + actions. */
.tax-row { display: grid; grid-template-columns: 150px 120px minmax(0, 220px) 32px 32px; grid-template-areas: "kind pct name up rm"; gap: var(--space-2); align-items: center; }
.tax-row .tax-kind { grid-area: kind; width: 100%; }
.tax-row .tax-pct { grid-area: pct; }
.tax-row .tax-name { grid-area: name; width: 100%; min-width: 0; }
.tax-row .tax-up { grid-area: up; }
.tax-row .tax-rm { grid-area: rm; }
.tax-pct[data-off] { visibility: hidden; }
.tax-pct .input { min-width: 0; width: 100%; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.tax-pct .addon { border: 1px solid var(--color-control-border); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.tax-up-i { display: inline-flex; transform: rotate(180deg); }
.tax-row:first-child .tax-up { visibility: hidden; }
@media (max-width: 767px) {
  .tax-row { grid-template-columns: minmax(0, 1fr) 52px 52px; grid-template-areas: "kind pct pct" "name up rm"; row-gap: var(--space-1); padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-line); }
  .tax-row .tax-up, .tax-row .tax-rm { width: 44px; height: 44px; justify-self: center; }
}

/* Custom fields: readable cards and private attachment previews at every width. */
.cf-section { display:flex; flex-direction:column; gap:var(--space-4); }
.cf-card { border:1px solid var(--color-line); border-radius:var(--radius-md); padding:var(--space-3); background:var(--color-surface); min-width:0; }
.cf-card-head { display:flex; gap:var(--space-3); align-items:flex-start; justify-content:space-between; flex-wrap:wrap; }
.cf-card-head > .stack { flex:1; min-width:160px; overflow-wrap:anywhere; }
.cf-actions { display:flex; gap:var(--space-1); flex-wrap:wrap; }
.cf-config { padding-top:var(--space-3); }
.cf-card details { margin-top:var(--space-2); }
.cf-group { min-width:0; padding-block:var(--space-2); }
.cf-group-title { border-top:1px solid var(--color-line); padding-top:var(--space-3); font-weight:600; }
.cf-group .field { min-width:0; }
.cf-group select[multiple] { min-height:120px; }
.cf-upload { display:flex; flex-direction:column; gap:var(--space-2); align-items:flex-start; min-width:0; }
.cf-files { display:flex; flex-wrap:wrap; gap:var(--space-2); width:100%; }
.cf-file { display:flex; flex-direction:column; gap:var(--space-1); border:1px solid var(--color-line); border-radius:var(--radius-sm); padding:var(--space-2); max-width:100%; width:180px; overflow-wrap:anywhere; }
.cf-file img { width:100%; max-height:160px; object-fit:contain; border-radius:var(--radius-sm); background:var(--color-surface); }
.cf-file-link { overflow-wrap:anywhere; font-size:var(--text-sm); }
.cf-upload-status { overflow-wrap:anywhere; }
.cf-archived > .cf-card { margin-top:var(--space-2); }
@media(max-width:767px) { .cf-config .grid-2 { grid-template-columns:1fr; } .cf-card-head { flex-direction:column; } .cf-file { width:calc(50% - var(--space-2)); min-width:120px; } }

/* Contact deletion stays reachable above the detail tabs on phones. */
@media (max-width: 767px) { .contact-wrap .c-delete { order: 2; padding: 0 var(--space-4); } }

/* Emails shown as written (SYS-246) */
.msg-body { min-width: 0; overflow-wrap: anywhere; }
.msg-body .email-frame { display: block; width: 100%; height: 48px; border: 0; background: transparent; }
.msg-body .email-frame.is-paper { background: #fff; border-radius: var(--radius-sm); }
.msg-body .msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body .msg-text a { overflow-wrap: anywhere; }
.msg-body .cs-quote { margin-top: var(--space-2); }
.msg-body .cs-quote > summary { display: inline-block; list-style: none; cursor: pointer; padding: 0 var(--space-2); border-radius: var(--radius-sm); background: var(--color-line); color: var(--color-ink); font-weight: 700; letter-spacing: 2px; line-height: 18px; user-select: none; }
.msg-body .cs-quote > summary::-webkit-details-marker { display: none; }
.msg-body .cs-quote .quoted { margin-top: var(--space-2); padding-left: var(--space-3); border-left: 2px solid var(--color-line-strong); color: var(--color-ink-2); }
.msg-body .msg-attach { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.msg-body .msg-attach .attach { margin-top: 0; max-width: 100%; min-width: 0; color: inherit; text-decoration: none; }
.msg-body .msg-attach .attach .meta { flex: none; }

/* long conversations open on the latest messages (SYS-246) */
.thread .earlier { display: flex; justify-content: center; padding: var(--space-2) 0 var(--space-3); }
.thread .msg-anchor { display: block; height: 0; scroll-margin-top: var(--space-3); }

/* Conversations read like a chat (SYS-246): what they sent sits on the left, what we sent on the right. Only the card
   and the avatar move; the text inside always reads left to right. */
.thread .msg.in { margin-right: var(--space-7); }
.thread .msg.out { margin-left: var(--space-7); margin-right: 0; background: color-mix(in srgb, var(--ws, var(--color-ink)) 7%, var(--color-surface)); border-color: color-mix(in srgb, var(--ws, var(--color-ink)) 28%, var(--color-line)); }
.msg .msg-head[data-msg-toggle] { cursor: pointer; }
.msg-who { flex: 1; min-width: 0; }
.msg-head > .meta { margin-top: 3px; }
.msg.out .msg-head > .avatar { order: 3; }
.msg.out .msg-head > .meta { order: 2; }
.msg.out .msg-body { padding-left: var(--space-4); padding-right: calc(var(--space-4) + 32px + var(--space-3)); }
.msg.is-collapsed .msg-peek { display: block; width: 100%; white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; word-break: normal; }
.msg.is-collapsed .msg-head { padding-bottom: var(--space-1); }
.msg-peek .email { white-space: nowrap; }
.msg-peek wbr { display: none; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding: 0 var(--space-4) var(--space-3) calc(var(--space-4) + 32px + var(--space-3)); }
.msg.out .msg-foot { padding-left: var(--space-4); padding-right: calc(var(--space-4) + 32px + var(--space-3)); }
.msg-more { border: 0; background: none; padding: 0; font: inherit; font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); color: var(--color-ink-2); cursor: pointer; }
.msg-more:hover { color: var(--color-ink); }
.tl-ev.out { flex-direction: row-reverse; }
.thread .vm-card { margin-right: var(--space-7); }
@media (max-width: 767px) {
  .thread { padding-bottom: var(--space-5); }
  .thread .msg.in, .thread .vm-card { margin-right: var(--space-6); }
  .thread .msg.out { margin-left: var(--space-6); }
  /* an opened email gets the whole width to be read in */
  .thread .msg:not(.is-collapsed) { margin-left: 0; margin-right: 0; }
  .msg.out .msg-body { padding: 0 var(--space-3) var(--space-3); }
  .msg-foot { padding: 0 var(--space-3) var(--space-3) calc(var(--space-3) + 32px + var(--space-3)); }
  .msg.out .msg-foot { padding: 0 calc(var(--space-3) + 32px + var(--space-3)) var(--space-3) var(--space-3); }
  .msg:not(.is-collapsed) .msg-foot { padding-left: var(--space-3); }
}

/* ---------- Public legal pages (/privacy, /delete-account): readable text column, no app chrome ---------- */
.legal { max-width: 720px; margin: 0 auto; padding: max(var(--space-6), calc(var(--safe-top) + var(--space-2))) var(--space-4) calc(var(--space-8) + var(--safe-bottom)); font-size: var(--text-lg); line-height: 1.6; }
.legal-brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); text-decoration: none; color: inherit; margin-bottom: var(--space-5); }
.legal h1 { font-size: var(--text-2xl); margin: 0 0 var(--space-2); }
.legal h2 { font-size: var(--text-xl); margin: var(--space-6) 0 var(--space-2); }
.legal p, .legal ul, .legal ol { margin: 0 0 var(--space-3); }
.legal ul, .legal ol { padding-left: var(--space-5); }
.legal li { margin-bottom: var(--space-1); }

/* Kinds of activity (SYS-246): each has its own colour and icon, the same in conversations, the Inbox list and a
   contact's history (src/server/views/kinds.ts) */
.k-email { --k: #2563eb; } .k-sms { --k: #16a34a; } .k-call { --k: #0d9488; } .k-voicemail { --k: #d97706; }
.k-chat { --k: #7c3aed; } .k-facebook { --k: #1877f2; } .k-instagram { --k: #db2777; } .k-form { --k: #4f46e5; }
.k-visit { --k: #0284c7; } .k-order { --k: #ea580c; } .k-payment { --k: #059669; } .k-document { --k: #0891b2; }
.k-booking { --k: #c026d3; } .k-deal { --k: #b45309; } .k-note { --k: #64748b; } .k-other { --k: var(--color-ink-3); }
[data-theme="dark"] .k-email, [data-theme="dark"] .k-facebook { --k: #60a5fa; } [data-theme="dark"] .k-sms { --k: #4ade80; } [data-theme="dark"] .k-call { --k: #2dd4bf; }
[data-theme="dark"] .k-voicemail { --k: #fbbf24; } [data-theme="dark"] .k-chat { --k: #a78bfa; } [data-theme="dark"] .k-instagram { --k: #f472b6; } [data-theme="dark"] .k-form { --k: #818cf8; }
[data-theme="dark"] .k-visit { --k: #38bdf8; } [data-theme="dark"] .k-order { --k: #fb923c; } [data-theme="dark"] .k-payment { --k: #34d399; } [data-theme="dark"] .k-document { --k: #22d3ee; }
[data-theme="dark"] .k-booking { --k: #e879f9; } [data-theme="dark"] .k-deal { --k: #fbbf24; } [data-theme="dark"] .k-note { --k: #94a3b8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .k-email, :root:not([data-theme="light"]) .k-facebook { --k: #60a5fa; } :root:not([data-theme="light"]) .k-sms { --k: #4ade80; } :root:not([data-theme="light"]) .k-call { --k: #2dd4bf; }
  :root:not([data-theme="light"]) .k-voicemail { --k: #fbbf24; } :root:not([data-theme="light"]) .k-chat { --k: #a78bfa; } :root:not([data-theme="light"]) .k-instagram { --k: #f472b6; } :root:not([data-theme="light"]) .k-form { --k: #818cf8; }
  :root:not([data-theme="light"]) .k-visit { --k: #38bdf8; } :root:not([data-theme="light"]) .k-order { --k: #fb923c; } :root:not([data-theme="light"]) .k-payment { --k: #34d399; } :root:not([data-theme="light"]) .k-document { --k: #22d3ee; }
  :root:not([data-theme="light"]) .k-booking { --k: #e879f9; } :root:not([data-theme="light"]) .k-deal { --k: #fbbf24; } :root:not([data-theme="light"]) .k-note { --k: #94a3b8; }
}
.k-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; border-radius: 50%; color: var(--k); background: color-mix(in srgb, var(--k) 15%, transparent); }
.k-ic .i { width: 16px; height: 16px; }
.k-ic.k-sm { width: 22px; height: 22px; } .k-ic.k-sm .i { width: 13px; height: 13px; }
.k-ic.k-missed { color: var(--color-attn); background: var(--color-attn-bg); }
.tl-icon.k-ic { width: 32px; height: 32px; border: 0; color: var(--k); background: color-mix(in srgb, var(--k) 15%, transparent); }
.k-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--k); font-weight: var(--weight-medium); white-space: nowrap; }
.k-tag .i { width: 12px; height: 12px; flex: none; }
.tl-head .w { display: inline-flex; align-items: center; gap: var(--space-2); }
.msg-when { display: inline-flex; align-items: center; gap: var(--space-2); }
.tl-ev > .k-ic { margin-left: -4px; }
.tl-ev.out > .k-ic { margin-left: 0; margin-right: -4px; }
.item.r3 .l2 .g[class*="k-"] { color: var(--k); }
.item.r3 .l2 .g.attn[class*="k-"] { color: var(--color-attn); }
.item.r3 .l2 .tx .email { white-space: nowrap; }
.item.r3 .l2 .tx wbr { display: none; }
@media (max-width: 767px) {
  /* on a phone the kind and time go on the line under what happened, so the title keeps the width */
  .tl-head .w { order: 4; flex-basis: 100%; margin-left: 0; }
}
@media (max-width: 767px) { .tl-ev .tx { white-space: normal; } } /* a call line never loses its end (missed, who answered) on a phone */

/* ---------- Dashboard (FB-31): each person's own widgets ---------- */
.dash-page .page-body { padding: var(--space-5); }
.dash-date { margin: 0 0 var(--space-3); }
/* two independent columns on wide screens (no gaps under short widgets); one column in the chosen order on narrower ones */
.dash-grid { display: flex; flex-direction: column; gap: var(--space-4); max-width: 1400px; }
.dash-col { display: contents; }
@media (min-width: 1100px) { .dash-grid { flex-direction: row; align-items: flex-start; } .dash-col { display: flex; flex-direction: column; gap: var(--space-4); flex: 1 1 0; min-width: 0; } }
.dw .card-head { gap: var(--space-2); }
.dw .card-head h3 { white-space: nowrap; flex: none; }
.dw-icon { color: var(--color-ink-2); flex: none; }
.dw-count { font-size: var(--text-sm); color: var(--color-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dw-link { margin-left: auto; white-space: nowrap; flex: none; padding-left: var(--space-2); }
/* phones: the count ("£5,700.00 owed · 1 overdue") gets its own line under the title instead of being cut to
   "£5,700.00 o..." by the Open link (iPhone QA 24 Nov 2026) */
@media (max-width: 767px) {
  .dw .card-head { flex-wrap: wrap; row-gap: 0; }
  .dw-count { order: 3; flex: 1 0 100%; padding-left: calc(16px + var(--space-2)); white-space: normal; }
}
.dw-body { padding: var(--space-1) 0 var(--space-2); }
.dw-list { list-style: none; margin: 0; padding: 0; }
.dw-row { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; padding: var(--space-2) var(--space-4); color: inherit; text-decoration: none; position: relative; }
.dw-row:hover { background: var(--color-surface-2); text-decoration: none; }
.dw-row.is-unread .dw-title { font-weight: var(--weight-semibold); }
.dw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dw-row.is-unread .dw-dot { background: var(--color-accent); }
.dw-row.has-dot .dw-sub { padding-left: 16px; }
.dw-row.is-past .dw-title, .dw-row.is-past .dw-sub, .dw-row.is-past .dw-end { color: var(--color-ink-3); }
.dw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dw-title { font-size: var(--text-md); line-height: var(--lh-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-sub { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-sub .i { vertical-align: -3px; margin-right: 6px; }
.dw-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; font-size: var(--text-sm); color: var(--color-ink-2); }
.dw-end .num { color: var(--color-ink); font-weight: var(--weight-semibold); }
.dw-age { font-size: var(--text-xs); color: var(--color-ink-3); }
.dw-end .pill { font-size: var(--text-xs); }
.dw-group { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--color-ink-3); padding: var(--space-2) var(--space-4) var(--space-1); margin: 0; }
.dw-group ~ .dw-group { margin-top: var(--space-2); border-top: 1px solid var(--color-line); padding-top: var(--space-3); }
.dw-empty { color: var(--color-ink-2); font-size: var(--text-sm); padding: var(--space-2) var(--space-4); margin: 0; }
.dw-empty:empty { display: none; }
.dw-more { display: block; font-size: var(--text-sm); padding: var(--space-2) var(--space-4) var(--space-1); }
.dc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.dc-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); }
.dc-move { display: flex; flex-direction: column; gap: 0; flex: none; margin: -4px 0 0 -4px; }
.dc-move .btn:disabled { opacity: .45; }
.dc-up { transform: rotate(180deg); }
.dc-text { flex: 1; min-width: 0; gap: 2px; }
.dc-opts { flex-wrap: wrap; margin-top: var(--space-1); }
.dc-opts label { display: inline-flex; align-items: center; gap: 6px; color: var(--color-ink-2); }
@media (max-width: 767px) { .dash-page .page-body { padding: var(--space-3); } .dash-grid { gap: var(--space-3); } }
.dc-stages { border: 0; padding: 0; margin: var(--space-1) 0 0; display: flex; flex-direction: column; gap: var(--space-1); width: 100%; }
.dc-stages legend { padding: 0 0 var(--space-1); color: var(--color-ink-2); font-weight: var(--weight-semibold); }
.dc-pipe { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-1) var(--space-3); margin-bottom: var(--space-2); }
.dc-pipe > .meta { grid-column: 1 / -1; font-weight: var(--weight-semibold); color: var(--color-ink-2); }
.dc-item .switch { margin-top: 2px; }
/* ---------- Tasks (SYS-384): one row per task, tick box first, then the title with when it's due and what it's for
   underneath; the same rows on the Tasks page, the dashboard, a deal and a quote/invoice ---------- */
.task-page { padding-bottom: var(--space-6); }
.task-group-h { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--color-ink-3); padding: var(--space-4) var(--space-5) var(--space-2); margin: 0; }
.task-group-h .seg-n { margin-left: 4px; }
.task-group-h.is-late, .task-group-h.is-late .seg-n { color: var(--color-bad); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: flex; align-items: flex-start; gap: var(--space-2); border-bottom: 1px solid var(--color-line); padding: 0 var(--space-5) 0 var(--space-4); }
/* the tick box sits beside the first line of the title, however many lines the row has */
.task-tick { display: flex; align-items: center; justify-content: center; width: 28px; height: calc(var(--lh-md) + 2 * var(--space-3)); flex: none; cursor: pointer; }
.task-tick input { width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent); cursor: pointer; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) 0; color: inherit; text-decoration: none; }
.task-main:hover { text-decoration: none; }
.task-main:hover .task-title { color: var(--color-accent); }
.task-title { font-size: var(--text-md); line-height: var(--lh-md); overflow-wrap: anywhere; }
.task-sub { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); overflow-wrap: anywhere; }
.task-row.is-late .task-due { color: var(--color-bad); font-weight: var(--weight-semibold); }
.task-status { font-size: var(--text-xs); height: 18px; margin-right: 6px; vertical-align: 1px; }
.task-who { flex: none; display: flex; align-self: center; }
.task-row.is-current { background: var(--color-surface-2); }
.task-row.is-done .task-title { color: var(--color-ink-3); text-decoration: line-through; }
/* on a deal or a quote/invoice: each task a small card, like the quotes above it */
.task-list-tight { display: flex; flex-direction: column; gap: var(--space-2); }
.task-list-tight .task-row { border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: 0 var(--space-3) 0 var(--space-2); }
.task-list-tight .task-tick { height: calc(var(--lh-sm) + 2 * var(--space-3)); }
.task-list-tight .task-title { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-semibold); }
.task-list-tight .task-sub { font-size: var(--text-xs); }
/* dashboard card: rows like the other widgets (no rules, aligned with the card's own padding) */
.dw-tasks .task-row { border-bottom: 0; gap: 6px; padding: 0 var(--space-4); }
.dw-tasks .task-tick { width: 18px; justify-content: flex-start; }
.dw-tasks .task-tick input { width: 18px; height: 18px; }
.dw-tasks .task-row:hover { background: var(--color-surface-2); }
.task-cal { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-3) var(--space-5); border-bottom: 1px solid var(--color-line); color: var(--color-ink-2); }
.task-cal > span { flex: 1; min-width: 200px; }
@media (max-width: 767px) { .task-cal { padding: var(--space-3) var(--space-4); } }
.dw-ws { display: flex; align-items: center; gap: var(--space-2); text-transform: none; letter-spacing: 0; font-size: var(--text-sm); color: var(--color-ink); font-weight: var(--weight-semibold); }
.dw-ws-count { font-weight: 400; color: var(--color-ink-3); white-space: nowrap; }
.dw-ws-link { margin-left: auto; font-weight: 400; white-space: nowrap; }
.dash-all-note { margin: 0 0 var(--space-4); max-width: 1400px; }
.task-title-input { font-size: var(--text-lg); font-weight: var(--weight-semibold); resize: none; min-height: 0; overflow: hidden; }
[data-task-status].seg { align-self: flex-start; width: max-content; max-width: 100%; }
.drawer-title-sm { font-size: var(--text-md); font-weight: var(--weight-semibold); margin: 0; }
.task-doc { gap: var(--space-2); padding-right: var(--space-1); }
@media (max-width: 767px) {
  .task-row { padding: 0 var(--space-4) 0 var(--space-3); }
  .task-group-h { padding-left: var(--space-4); }
}

/* ---------- Notifications (FB-30): bell, popover, list, settings grid ---------- */
.nav-bell { margin-bottom: var(--space-2); }
.bell-btn { position: relative; }
/* the badge starts at the icon top-right and grows outwards, so a long count (99+) never covers the icon */
.bell-btn .badge { position: absolute; top: 2px; left: calc(50% + 2px); right: auto; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; pointer-events: none; box-shadow: 0 0 0 2px var(--color-surface); }
/* SYS-589: the bell keeps one height on Unread and All (the list scrolls inside, an empty one is centred), so switching never makes it jump */
.notif-pop { position: fixed; width: 380px; max-width: calc(100vw - 16px); height: min(560px, calc(100dvh - 16px)); max-height: min(560px, calc(100dvh - 16px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.notif-pop-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); }
.notif-pop-head h2 { font-size: var(--text-lg); }
.notif-pop-show { padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); }
.notif-pop .notif-list { overflow-y: auto; flex: 1; min-height: 0; }
.notif-pop .notif-list > .empty { margin: auto; }
.notif-pop-foot { display: block; padding: var(--space-3); text-align: center; border-top: 1px solid var(--color-line); font-weight: var(--weight-medium); font-size: var(--text-sm); }
.notif-sheet { position: relative; width: 100%; max-width: none; height: 85dvh; max-height: 85dvh; }
.notif-sheet .notif-pop-head { padding-top: var(--space-1); }
.notif-list { display: flex; flex-direction: column; }
.notif-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-line); color: var(--color-ink); text-decoration: none; min-width: 0; }
.notif-row:last-child { border-bottom: 0; }
.notif-row:hover { background: var(--color-surface-2); text-decoration: none; }
/* a row = the link + the Mark read tick beside it (a sibling, never a button inside a link); read rows keep the same
   space so the times line up */
.notif-item { display: flex; align-items: flex-start; border-bottom: 1px solid var(--color-line); min-width: 0; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--color-surface-2); }
.notif-item > .notif-row { flex: 1; border-bottom: 0; padding-right: var(--space-1); }
.notif-item > .notif-row:hover { background: transparent; }
.notif-read, .notif-read-slot { flex: none; width: 40px; height: 40px; margin: 6px var(--space-2) 0 0; }
.notif-read { display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-accent); cursor: pointer; }
.notif-read .i { width: 18px; height: 18px; }
.notif-read:hover, .notif-read:focus-visible { background: var(--color-surface); color: var(--color-ink); }
.notif-read:disabled { opacity: .5; }
.notif-row .ws-mark { margin-top: 2px; flex: none; }
.notif-row .unread-dot { margin-top: 8px; flex: none; }
.notif-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-top { display: flex; gap: var(--space-2); align-items: baseline; min-width: 0; }
.notif-top > .meta:first-child { flex: 1; min-width: 0; }
.notif-title { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.notif-row:not(.is-unread) .notif-title { font-weight: var(--weight-regular, 400); color: var(--color-ink-2); }
.notif-body { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.notif-page { display: flex; flex-direction: column; gap: var(--space-4); }
.notif-page .notif-list { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; }
.notif-grid-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-5)); }
.notif-grid td, .notif-grid th { height: auto; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.notif-grid .c { text-align: center; width: 1%; white-space: nowrap; }
.notif-grid tbody tr:hover td { background: transparent; }
.unread-dot.is-read { visibility: hidden; }   /* keeps the time in line whether read or not */
.notif-grid .nl-short { display: none; }
.notif-grid td:first-child { white-space: normal; }
.notif-ws { flex-wrap: nowrap; align-items: center; gap: var(--space-3); }
@media (max-width: 767px) {
  /* phones: each kind is a block, its four switches labelled underneath, so nothing scrolls sideways */
  .notif-grid-wrap { margin: 0; overflow: visible; }
  .notif-grid, .notif-grid tbody { display: block; }
  .notif-grid thead { display: none; }
  .notif-grid tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2) var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
  .notif-grid tr:last-child { border-bottom: 0; }
  .notif-grid td, .notif-grid td:first-child, .notif-grid td:last-child { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; height: auto; border: 0; width: auto; }
  .notif-grid td:first-child { grid-column: 1 / -1; align-items: flex-start; }
  .notif-grid td.c { width: auto; }
  .notif-grid td.c::before { content: attr(data-label); font-size: var(--text-xs); color: var(--color-ink-3); white-space: nowrap; }
  .notif-row { padding: var(--space-3); }
}
/* the four channel columns fit without a sideways scroll on a desktop */
.account-body .set-inner.notif-set { max-width: 880px; }
/* phones: each workspace's name and hint get the full row, its choice sits underneath (SYS-360) */
@media (max-width: 767px) {
  .set-card .list-rows .lr.notif-ws { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-2) var(--space-3); }
  .set-card .list-rows .lr.notif-ws > .stack { flex: none !important; }
  .notif-ws > select { grid-column: 2; width: 100%; }
}
/* a short screen (e.g. a 1024x768 tablet) scrolls the sidebar instead of cutting off Your account at the bottom */
.sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
@media (max-width: 1199px) and (min-width: 768px) { .nav-bell { margin-bottom: 0; } }

/* Signed in, a legal page opened from the app offers the way back (the phone app has no browser back button) */
.legal-back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 var(--space-3); font-weight: var(--weight-semibold); color: var(--color-accent); text-decoration: none; }
.legal-back + .legal-brand { display: flex; width: max-content; }
/* iOS gives a date field a minimum width of its own, so on phones it ran past the right edge: hold it to its column */
input.input[type="date"] { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; -webkit-appearance: none; appearance: none; text-align: left; }
input.input[type="date"]::-webkit-date-and-time-value { text-align: left; }
/* Feedback on phones: "Send feedback" in the More sheet (shell.ts), not the edge tab, which covered the right edge of
   fields, buttons and help text, and not a top-bar icon, which looked like team chat (SYS-387) */
@media (max-width: 767px) {
  .help-tab { display: none !important; }
}

/* ---- Tasks board (SYS-386): columns by status, drag a card to change it ---- */
.task-page-board { padding-bottom: 0; }
.tboard { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-6); align-items: start; overflow-x: auto; scrollbar-color: var(--color-line-strong) var(--color-canvas); }
.tcol { background: var(--color-surface-2); border: 1px solid var(--color-line); border-radius: var(--radius-md); display: flex; flex-direction: column; min-width: 0; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.tcol .col-head { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 44px; }
.tcol .col-head .meta { font-size: var(--text-xs); }
.tcol .col-title { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.tcol-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-ink-3); flex: none; }
.tcol-dot.is-waiting { background: var(--color-wait); }
.tcol-dot.is-stuck { background: var(--color-bad); }
.tcol-dot.is-done { background: var(--color-good); }
.tcol-cards { display: flex; flex-direction: column; gap: var(--space-2); padding: 0 var(--space-2) var(--space-2); min-height: 56px; }
.tcol.is-drop { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.tcard { padding: 10px var(--space-3); display: flex; flex-direction: column; gap: 2px; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.tcard .dc-title { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); overflow-wrap: break-word; text-wrap: wrap; hyphens: manual; -webkit-line-clamp: 3; line-clamp: 3; }
.tcard .dc-co { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); margin-top: 0; overflow-wrap: anywhere; }
.tc-foot { display: flex; align-items: center; gap: var(--space-2); margin-top: 6px; min-height: 24px; }
.tc-due { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-2); }
.tcard.is-late .tc-due { color: var(--color-bad); font-weight: var(--weight-semibold); }
.tcard.is-done .dc-title { color: var(--color-ink-3); text-decoration: line-through; }
.tcard.is-dragging { opacity: .35; }
.tcard-ghost { position: fixed; z-index: var(--z-toast); pointer-events: none; margin: 0; box-shadow: var(--shadow-3); transform: rotate(1.5deg); }
.tcol-more { padding: 0 var(--space-3) var(--space-3); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tcol-more .btn { margin-left: auto; }
body.is-task-dragging, body.is-task-dragging * { cursor: grabbing !important; }
/* snapping would pull the board back while it scrolls itself under a dragged card */
.tboard.is-dragging { scroll-snap-type: none; }
@media (max-width: 1023px) { .tboard { grid-template-columns: repeat(4, minmax(240px, 1fr)); scroll-snap-type: x proximity; scroll-padding-left: var(--space-5); } .tcol { scroll-snap-align: start; } }
@media (max-width: 767px) {
  /* phone toolbar: Mine/Everyone and List/Board on one line, the person picker under them full width */
  .task-for { order: 3; flex: 1 1 100%; } .task-for .select { width: 100% !important; }
  .tboard { grid-template-columns: repeat(4, 78vw); padding: var(--space-3) var(--space-4) var(--space-6); scroll-padding-left: var(--space-4); }
  .tcard { padding: var(--space-3); }
  .tcard .dc-title { font-size: var(--text-md); line-height: var(--lh-md); }
  .tcard .dc-co, .tc-due { font-size: var(--text-sm); line-height: var(--lh-sm); }
}

/* ---- Team chat (SYS-386; its own page since FB-41): chats | the chat | people and files, like the Inbox ---- */
.tp-foot { flex: none; border-top: 1px solid var(--color-line); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-3); background: var(--color-surface); }
.tp-foot[hidden] { display: none; }
.tp-foot > .meta { margin: 0; }
.tp-empty { margin: auto; padding: var(--space-6) var(--space-5); }
.tp-wide { width: 100%; }
.tp-list { list-style: none; margin: 0; padding: 0; }
.tp-list > li { border-bottom: 1px solid var(--color-line); }
.tp-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 64px; padding: var(--space-2) var(--space-4); border: 0; background: none; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.tp-row:hover { background: var(--color-surface-2); }
.tp-row:focus-visible { box-shadow: inset var(--focus-ring); }
.tp-row .avatar, .tp-row .tc-mark { flex: none; }
.tp-row > .avatar { --av: 40px; }
.tc-mark { width: 40px; height: 40px; position: relative; display: block; }
.tc-mark .avatar { --av: 25px; font-size: 10px; position: absolute; box-shadow: 0 0 0 2px var(--color-surface); margin: 0 !important; }
.tc-mark .avatar:nth-child(2) { z-index: 1; }
.tc-mark .avatar:first-child { left: 0; top: 0; } .tc-mark .avatar:nth-child(2) { right: 0; bottom: 0; }
.tc-mark .avatar:only-child { --av: 40px; position: static; }
.tp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-row-top, .tp-row-last { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.tp-row-name { flex: 1; min-width: 0; font-size: var(--text-md); line-height: var(--lh-md); font-weight: var(--weight-medium); }
.tp-row-last { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--color-ink-2); }
.tp-row-last .truncate { flex: 1; min-width: 0; }
.tp-row.is-unread .tp-row-name { font-weight: var(--weight-semibold); }
.tp-row.is-unread .tp-row-last .truncate { color: var(--color-ink); }
.tp-row-last .badge { flex: none; }
/* people picker */
.tp-search { position: sticky; top: 0; z-index: 1; background: var(--color-surface); padding: var(--space-3) var(--space-4) var(--space-2); display: flex; align-items: center; }
.tp-search .i { position: absolute; left: calc(var(--space-4) + 10px); color: var(--color-ink-3); pointer-events: none; }
.tp-search .input { padding-left: 34px; }
.tp-person { position: relative; }
.tp-person input { position: absolute; opacity: 0; pointer-events: none; }
.tp-person:has(input:focus-visible) { box-shadow: inset var(--focus-ring); }
.tp-tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--color-control-border); display: inline-flex; align-items: center; justify-content: center; flex: none; color: transparent; }
.tp-person.is-picked .tp-tick { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.tp-person.is-picked { background: var(--color-accent-weak); }
.tp-none { padding: var(--space-3) var(--space-4); margin: 0; }
.tp-gname { gap: 6px; }
.tp-form { padding: var(--space-4); }
/* messages */
.tp-msgs { flex: 1 0 auto; padding: var(--space-3) var(--space-3) var(--space-4); display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; background: var(--color-canvas); }
.tp-day { display: flex; justify-content: center; margin: var(--space-3) 0 var(--space-2); }
.tp-day span { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-ink-2); background: var(--color-surface-2); border-radius: var(--radius-pill); padding: 2px 10px; }
.tp-event { text-align: center; font-size: var(--text-xs); line-height: var(--lh-xs); margin: var(--space-2) var(--space-4); }
.tp-msg { display: flex; align-items: flex-end; gap: 6px; margin-top: var(--space-2); max-width: 100%; }
.tp-msg.is-run { margin-top: 2px; }
.tp-msg.is-mine { flex-direction: row-reverse; }
.tp-msg > .avatar { --av: 24px; font-size: 10px; }
.tp-msg.is-last:has(.tp-state) > .avatar { margin-bottom: 18px; }
.tp-av-gap { width: 24px; flex: none; }
.tp-bubble-wrap { display: flex; flex-direction: column; min-width: 0; max-width: 78%; }
.tp-bubble-wrap { align-items: flex-start; }   /* a short message hugs its words, even under a wide photo */
.tp-msg.is-mine .tp-bubble-wrap { align-items: flex-end; }
.tp-who { font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-semibold); color: var(--color-ink-2); margin: 0 0 2px 10px; }
.tp-bubble { padding: 7px 11px; border-radius: 16px; background: var(--color-surface); border: 1px solid var(--color-line); color: var(--color-ink); font-size: var(--text-md); line-height: var(--lh-md); white-space: pre-wrap; overflow-wrap: anywhere; }
.tp-msg.is-mine .tp-bubble { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.tp-msg.is-mine .tp-bubble a { color: inherit; text-decoration: underline; }
.tp-msg.is-pending .tp-bubble { opacity: .7; }
.tp-time { flex: none; font-size: 11px; line-height: 16px; margin-bottom: 2px; opacity: 0; transition: opacity var(--dur-fast); }
.tp-msg:hover .tp-time, .tp-msg:focus-within .tp-time, .tp-msg.is-last .tp-time { opacity: 1; }
.tp-compose .btn:disabled { opacity: .5; }
:root[data-theme="dark"] .tp-msg:not(.is-mine) .tp-bubble { border-color: var(--color-line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tp-msg:not(.is-mine) .tp-bubble { border-color: var(--color-line-strong); } }
.tp-state { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--color-ink-3); margin-top: 2px; }
.tp-state.is-failed { color: var(--color-bad); font-weight: var(--weight-medium); display: inline-flex; align-items: center; gap: var(--space-2); margin-top: 4px; }
.tp-msg.is-failed .tp-bubble { opacity: .75; }
.tp-msg.is-pending .tp-time, .tp-msg.is-failed .tp-time { display: none; }

.tp-compose { display: flex; align-items: flex-end; gap: var(--space-2); }
.tp-compose .textarea { flex: 1; min-height: 40px; max-height: 132px; resize: none; padding-top: 9px; padding-bottom: 9px; line-height: var(--lh-md); overflow-y: auto; }
.tp-compose .btn { flex: none; width: 40px; height: 40px; }
.nav-bell a + a { margin-top: 2px; }
.phone-head .bell-btn { position: relative; }
.nav-bell a + a { margin-top: 2px; }
/* the page */
.team-panes .list-pane .pane-body { padding: 0; }
.team-panes .tp-row[aria-current="true"] { background: var(--color-accent-weak); }
.team-panes .tp-row[aria-current="true"]:hover { background: var(--color-accent-weak); }
.tc-filter { padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-line); }
.tc-filter[hidden] { display: none; }
.tc-main { position: relative; background: var(--color-canvas); }
.tc-main > .empty { flex: 1; width: 100%; height: 100%; justify-content: center; background: var(--color-canvas); }
.tc-head { gap: var(--space-3); background: var(--color-surface); }
.tc-head-mark { display: flex; flex: none; }
.tc-head-mark > .avatar { --av: 36px; }
.tc-head-mark .tc-mark { width: 40px; height: 36px; } .tc-head-mark .tc-mark .avatar { --av: 26px; }
.tc-back-phone { display: none; }
.tc-info-btn { display: none; }
@media (max-width: 1199px) { .tc-info-btn { display: inline-flex; } }
.tc-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; background: var(--color-canvas); -webkit-mask-image: none !important; mask-image: none !important; }
.tc-scroll .tp-msgs { max-width: 920px; width: 100%; margin: 0 auto; padding: var(--space-4) var(--space-5) var(--space-5); }
.tc-scroll .tp-bubble-wrap { max-width: min(78%, 560px); }
.tc-pick { padding: 0; background: var(--color-surface); }
.tc-pick .tp-list, .tc-pick .tp-search { max-width: 720px; margin: 0 auto; }
.tc-pick-foot { max-width: 720px; width: 100%; margin: 0 auto; border-top: 1px solid var(--color-line); }
.tc-pick ~ .tc-pick-foot { border-top: 1px solid var(--color-line); }
.tc-main .tp-form { max-width: 520px; }
/* composer: files picked for the next message sit above the box */
.tc-compose { flex: none; flex-direction: column; align-items: stretch; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-line); background: var(--color-surface); }
.tc-compose > * { max-width: 888px; width: 100%; margin-left: auto; margin-right: auto; }
.tc-row { display: flex; align-items: flex-end; gap: var(--space-2); }
.tc-compose .tc-attach { color: var(--color-ink-2); }
.tc-hint { margin: 0; font-size: var(--text-xs); line-height: var(--lh-xs); }
.tc-hint[hidden] { display: none; }
.tc-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tc-chips[hidden] { display: none; }
.tc-chip { position: relative; display: flex; align-items: center; gap: var(--space-2); height: 64px; max-width: 240px; padding: 0 30px 0 6px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-surface-2); overflow: hidden; }
.tc-chip.is-media { width: 64px; padding: 0; }
.tc-chip-thumb { flex: none; width: 52px; height: 52px; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--color-ink-2); background: var(--color-surface); position: relative; }
.tc-chip.is-media .tc-chip-thumb { width: 100%; height: 100%; border-radius: 0; }
.tc-chip-thumb img, .tc-chip-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-chip-play { position: absolute; left: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(15,23,42,.72); }
.tc-chip-play .i { width: 10px; height: 10px; fill: currentColor; }
.tc-chip-text { display: flex; flex-direction: column; min-width: 0; }
.tc-chip-x, .tc-chip-retry { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); display: inline-flex; align-items: center; justify-content: center; background: rgba(15,23,42,.72); color: #fff; cursor: pointer; padding: 0; }
.tc-chip-retry { top: auto; bottom: 4px; background: var(--color-bad); }
.tc-chip-x:focus-visible, .tc-chip-retry:focus-visible { box-shadow: var(--focus-ring); }
.tc-chip-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(15,23,42,.18); }
.tc-chip-bar i { display: block; height: 100%; background: var(--color-accent); transition: width .2s; }
.tc-chip.is-up .tc-chip-thumb { opacity: .65; }
.tc-chip.is-failed { border-color: var(--color-bad); }
.tc-drop { position: absolute; inset: 8px; z-index: 5; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--color-accent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-surface) 88%, transparent); pointer-events: none; }
.tc-drop[hidden] { display: none; }
.tc-drop span { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); color: var(--color-accent); }
/* files in a message */
.tc-files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 2px; width: 100%; min-width: 0; }
.tp-msg .tc-files + .tp-bubble { margin-top: 2px; }
.tc-files.is-mine { align-items: flex-end; }
.tc-pics { display: grid; gap: 3px; border-radius: 14px; overflow: hidden; width: min(360px, 100%); }
.tc-pics.is-one { width: auto; max-width: min(360px, 100%); }
.tc-pics.is-two { grid-template-columns: 1fr 1fr; }
.tc-pics.is-three { grid-template-columns: 1fr 1fr 1fr; }
.tc-pic { display: block; padding: 0; border: 0; background: var(--color-surface-2); cursor: zoom-in; overflow: hidden; }
.tc-pics:not(.is-one) .tc-pic { aspect-ratio: 1; }
.tc-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tc-pics.is-one .tc-pic { max-width: 100%; min-height: 60px; }
.tc-pics.is-one .tc-pic:not([style]) { width: 240px; aspect-ratio: 4 / 3; }
.tc-pic:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.tc-video { display: block; width: min(360px, 100%); max-height: 360px; border-radius: 14px; background: #000; }
.tc-audio { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 14px; border: 1px solid var(--color-line); background: var(--color-surface); width: min(320px, 100%); }
.tc-audio audio { width: 100%; height: 36px; }
.tc-file { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: 14px; border: 1px solid var(--color-line); background: var(--color-surface); color: var(--color-ink); text-decoration: none; width: min(320px, 100%); }
.tc-file:hover { border-color: var(--color-line-strong); background: var(--color-surface-2); }
.tc-file > .i:first-child { flex: none; color: var(--color-accent); }
.tc-file-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tc-file-sm { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 6px; }
/* emoji and reactions (FB-53) */
.tc-compose .tc-emoji { color: var(--color-ink-2); }
.tc-compose .tc-emoji[aria-expanded="true"] { color: var(--color-accent); background: var(--color-accent-weak); }
.tp-bubble.is-emoji { background: none; border-color: transparent; padding: 0; font-size: 40px; line-height: 1.15; font-family: var(--font-emoji); }
.tp-msg.is-run .tp-bubble.is-emoji, .tp-bubble-wrap > .tp-bubble.is-emoji { margin-top: 4px; }
.tp-msg.is-mine .tp-bubble.is-emoji { background: none; border-color: transparent; color: inherit; }
:root[data-theme="dark"] .tp-msg:not(.is-mine) .tp-bubble.is-emoji { border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tp-msg:not(.is-mine) .tp-bubble.is-emoji { border-color: transparent; } }
.tp-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tp-react-e, .rq-e, .ep-e, .ep-tab, .ep-tone { font-family: var(--font-emoji); }
.tp-reacts:empty { display: none; }
.tp-msg.is-mine .tp-reacts { justify-content: flex-end; }
.tp-react { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 7px; border-radius: var(--radius-pill); border: 1px solid var(--color-line); background: var(--color-surface); color: var(--color-ink-2); font: inherit; font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1; cursor: pointer; }
.tp-react:hover { border-color: var(--color-line-strong); background: var(--color-surface-2); }
.tp-react.is-mine { background: var(--color-accent-weak); border-color: var(--color-accent); color: var(--color-ink); }
.tp-react:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.tp-react-e { font-size: 15px; line-height: 1; }
.tp-react-add { flex: none; align-self: flex-end; margin-bottom: -5px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-ink-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity var(--dur-fast); }
.tp-msg:hover .tp-react-add, .tp-react-add:focus-visible, .tp-react-add[aria-expanded="true"] { opacity: 1; }
.tp-react-add:hover, .tp-react-add[aria-expanded="true"] { background: var(--color-surface-2); color: var(--color-ink); }
.tp-react-add:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.tp-msg.is-pending .tp-react-add, .tp-msg.is-failed .tp-react-add { display: none; }
@media (pointer: coarse) {
  .tp-react-add { display: none; }   /* phones and tablets: a long press on the message */
  .tc-compose .tc-emoji { display: none; }   /* their own keyboard has emoji */
  .tp-reacts { gap: 6px; }
  .tp-react { height: 32px; padding: 0 11px 0 9px; }   /* big enough for a finger */
  .tp-react-e { font-size: 17px; }
  .tc-scroll .tp-msg[data-mid] .tp-bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
/* the reaction bar, and the message it's for */
.tp-msg.is-reacting .tp-bubble:not(.is-emoji), .tp-msg.is-reacting .tc-files { box-shadow: 0 0 0 3px var(--color-accent-weak), 0 0 0 4px var(--color-accent); }
.tp-msg.is-reacting .tp-bubble.is-emoji { transform: scale(1.08); transition: transform var(--dur-fast); }
.rq { position: fixed; z-index: var(--z-popover); display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-pill); box-shadow: var(--shadow-3); }
.rq-e { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 23px; line-height: 1; cursor: pointer; transition: transform var(--dur-fast), background var(--dur-fast); }
.rq-e:hover, .rq-e:focus-visible { background: var(--color-surface-2); transform: scale(1.12); outline: none; }
.rq-e.is-mine { background: var(--color-accent-weak); }
.rq-more { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--color-surface-2); color: var(--color-ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.rq-more:hover, .rq-more:focus-visible { color: var(--color-ink); background: var(--color-line); outline: none; }
.rq-copy { height: 36px; padding: 0 14px; margin-left: 4px; border: 0; border-radius: var(--radius-pill); background: var(--color-surface-2); color: var(--color-ink); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; }
/* the emoji picker: by its button (computers), or a sheet from the bottom for more reactions (phones) */
.ep { position: fixed; z-index: var(--z-popover); width: 360px; max-width: calc(100vw - 16px); height: 420px; max-height: calc(100vh - 16px); display: flex; flex-direction: column; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); box-shadow: var(--shadow-3); overflow: hidden; }
.ep.is-sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: none; height: min(440px, 62vh); border-radius: var(--radius-md) var(--radius-md) 0 0; z-index: var(--z-sheet); padding-bottom: var(--safe-bottom); }
.ep-handle { display: none; }
.ep.is-sheet .ep-handle { display: block; flex: none; }
.ep-scrim { position: fixed; inset: 0; z-index: calc(var(--z-sheet) - 1); background: var(--color-scrim); }
.ep-top { flex: none; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); }
.ep-search { flex: 1; min-width: 0; position: relative; display: block; }
.ep-search > .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-ink-3); pointer-events: none; }
.ep-search .input { width: 100%; height: 36px; padding-left: 32px; }
.ep-tone { flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 20px; line-height: 1; cursor: pointer; }
.ep-tone[aria-expanded="true"] { border-color: var(--color-accent); }
.ep-tones { flex: none; display: flex; justify-content: flex-end; gap: 2px; padding: 0 var(--space-2) var(--space-2); }
.ep-tones[hidden], .ep-tabs[hidden] { display: none; }
.ep-tabs { flex: none; display: flex; padding: 0 var(--space-1) 2px; border-bottom: 1px solid var(--color-line); }
.ep-tab { flex: 1; min-width: 0; height: 34px; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 17px; line-height: 1; cursor: pointer; opacity: .5; filter: grayscale(1); }
.ep-tab:hover { opacity: .85; filter: none; }
.ep-tab[aria-selected="true"] { opacity: 1; filter: none; background: var(--color-surface-2); }
.ep-tab:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.ep-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--space-2) var(--space-2); }
.ep-sec h5 { position: sticky; top: 0; z-index: 1; margin: 0; padding: 8px 4px 4px; background: var(--color-surface); font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-semibold); color: var(--color-ink-2); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.ep-e { height: 38px; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 24px; line-height: 1; cursor: pointer; }
.ep-e:hover, .ep-e:focus-visible { background: var(--color-surface-2); outline: none; }
.ep-none { margin: 0; padding: var(--space-5) var(--space-3); text-align: center; }
/* people and files (right-hand panel, or the Details screen) */
.tc-side .pane-body { padding: 0; }   /* .ctx brings its own padding, as in the Inbox */
.tc-main .tc-details { max-width: 720px; background: var(--color-surface); min-height: 100%; }
.tc-details .ctx-section h4 { margin: 0 0 var(--space-2); }
.tc-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.tc-people li { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.tc-acts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.tc-leave { color: var(--color-bad); }
.tc-shared { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tc-thumb { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--color-surface-2); cursor: zoom-in; color: var(--color-ink-2); }
.tc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-thumb-video { background: #0f172a; color: #fff; cursor: pointer; }
/* the picture viewer, over the page */
.tc-viewer { position: fixed; inset: 0; z-index: var(--z-modal); background: #08090c; display: flex; flex-direction: column; }
.tc-viewer[hidden] { display: none; }
body.tc-viewing { overflow: hidden; }
.tc-v-bar { flex: none; display: flex; align-items: center; gap: var(--space-3); padding: calc(var(--space-2) + var(--safe-top)) var(--space-3) var(--space-2); color: #fff; }
.tc-v-bar .btn { color: #fff; background: rgba(255,255,255,.12); border-color: transparent; }
.tc-v-bar .btn:hover { background: rgba(255,255,255,.2); }
.tc-v-name { flex: 1; min-width: 0; font-size: var(--text-sm); opacity: .85; }
.tc-v-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: var(--space-3); }
.tc-v-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.tc-v-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tc-v-nav:hover { background: rgba(255,255,255,.24); }
.tc-v-nav[hidden] { display: none; }
.tc-v-prev { left: var(--space-3); } .tc-v-next { right: var(--space-3); }
@media (max-width: 767px) {
  .tc-back-phone { display: inline-flex; }
  .tc-head { padding: 0 var(--space-2); gap: var(--space-2); }
  .tc-head-mark > .avatar { --av: 32px; }
  .tp-row { min-height: 68px; }
  .tc-scroll .tp-msgs { padding: var(--space-3) var(--space-3) var(--space-4); }
  .tc-scroll .tp-bubble-wrap { max-width: 82%; }
  .tc-compose { padding: var(--space-2) var(--space-3) calc(var(--space-2) + var(--safe-bottom)); }
  .tp-compose .textarea { font-size: 16px; }   /* no zoom on iPhone */
  .tc-chip { height: 56px; } .tc-chip.is-media { width: 56px; } .tc-chip-thumb { width: 44px; height: 44px; }
  .tc-v-nav { display: none; }
  .team-panes .thread-pane { display: none; }
  .is-detail .team-panes .thread-pane { display: flex; }
}

/* notification kinds: a long hint wraps rather than being cut off at the screen edge (seen on phones, SYS-393 QA) */
.notif-grid .c2 .meta { white-space: normal; }

/* ---------- Time tracking (FB-40) ---------- */
.time-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-good); flex: none; box-shadow: 0 0 0 3px var(--color-good-bg); }
@media (prefers-reduced-motion: no-preference) { .time-dot { animation: time-pulse 2s ease-in-out infinite; } }
@keyframes time-pulse { 50% { box-shadow: 0 0 0 5px var(--color-good-bg); } }
/* the running timer in the sidebar: what is timed and for how long, with Stop */
/* flex: none: the sidebar is a scrolling column, and a long menu squeezed the card (it clips what overflows) to a line (FB-64) */
.nav-timer { flex: none; flex-direction: row; align-items: center; gap: 0; margin: 0 0 var(--space-2); border: 1px solid color-mix(in srgb, var(--color-good) 35%, transparent); border-radius: var(--radius-sm); background: var(--color-good-bg); overflow: hidden; }
.nav-timer[hidden] { display: none; }
.nav-timer > a { flex: 1; min-width: 0; height: auto; min-height: 48px; padding: 6px 0 6px var(--space-3); color: var(--color-ink); background: transparent !important; box-shadow: none !important; }
.nav-timer > a > .time-dot { margin: 0 4px; }
.nav-timer .timer-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.nav-timer .timer-title { display: block; font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-timer .timer-clock { font-size: var(--text-md); line-height: var(--lh-md); color: var(--color-good); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.nav-timer .timer-stop { flex: none; width: 36px; height: 36px; margin-right: 6px; border: 1px solid color-mix(in srgb, var(--color-good) 45%, transparent); background: var(--color-surface); color: var(--color-good); }
.nav-timer .timer-stop:hover { background: var(--color-raised); }
.nav-timer .timer-stop svg, [data-time-task] .t-stop { fill: currentColor; stroke: none; }
@media (max-width: 1199px) and (min-width: 768px) {
  .nav-timer { flex-direction: column; padding-bottom: 6px; }
  .nav-timer > a { padding: 6px 0 2px; justify-content: center; min-height: 0; }
  .nav-timer > a > .time-dot { display: none; }
  .nav-timer .timer-title { display: none; }
  .nav-timer .timer-clock { font-size: 11px; line-height: 13px; text-align: center; }
  .nav-timer .timer-stop { margin: 0; width: 32px; height: 32px; }
}
/* phones: a slim bar under the top bar */
.timer-bar { display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-4); background: var(--color-good-bg); border-bottom: 1px solid var(--color-line); flex: none; }
.timer-bar[hidden] { display: none !important; }
.timer-bar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2); color: var(--color-ink); text-decoration: none; min-height: 32px; }
.timer-bar-main .timer-title { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.timer-bar-main .timer-clock { font-size: var(--text-md); color: var(--color-good); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.timer-bar .btn { color: var(--color-good); border-color: color-mix(in srgb, var(--color-good) 45%, transparent); }
/* a task's play button (list rows, board cards, the task drawer); the running task shows a stop square */
[data-time-task] .t-stop { display: none; }
[data-time-task].is-running .t-play { display: none; }
[data-time-task].is-running .t-stop { display: inline-block; }
.task-timer { flex: none; align-self: center; color: var(--color-ink-3); }
.task-timer:hover { color: var(--color-ink); }
.task-timer.is-running, .tcard .tc-timer.is-running, .tc-timer.is-running { color: var(--color-good); background: var(--color-good-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-good) 40%, transparent); }
.tcard:has(.tc-timer.is-running) { box-shadow: inset 3px 0 0 var(--color-good); }
.task-row:has(.task-timer.is-running) { box-shadow: inset 3px 0 0 var(--color-good); }
.tc-timer { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: var(--radius-sm); color: var(--color-ink-3); cursor: pointer; margin-right: 4px; }
.tc-timer:hover { background: var(--color-surface-2); color: var(--color-ink); }
.tc-timer:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.task-time-btn::after { content: "Start timer"; }
.task-time-btn.is-running::after { content: "Stop timer"; }
.task-time-btn.is-running { color: var(--color-good); border-color: var(--color-good); background: var(--color-good-bg); }
/* the Time page */
.time-wrap { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); }
.time-now { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.time-now-form { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.time-now-form .input { flex: 1 1 260px; }
.time-now-run { display: flex; align-items: center; gap: var(--space-3); }
.time-now-run .time-clock { font-size: var(--text-xl); font-weight: var(--weight-semibold); }
.time-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.time-stat { padding: var(--space-4); display: flex; flex-direction: column; gap: 4px; }
.time-big { font-size: 28px; line-height: 34px; font-weight: var(--weight-semibold); color: var(--color-ink); }
.time-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--space-4); align-items: start; }
.time-table td, .time-table th { height: 44px; }
.time-table tfoot th { border-bottom: 0; border-top: 1px solid var(--color-line); color: var(--color-ink); font-size: var(--text-md); position: static; }
.time-table tbody tr:last-child td { border-bottom: 0; }
.time-entries td { padding-top: 8px; padding-bottom: 8px; height: auto; }
.time-entries .te-what { width: 55%; }
/* FB-63: requests waiting for approval: what, when, answer; stacked on phones with full-width buttons */
.time-reqs { list-style: none; margin: 0; padding: 0; }
.time-req { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-3) var(--space-4); }
.time-req + .time-req { border-top: 1px solid var(--color-line); }
.time-req .c2 { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.time-req .c2 > span:first-child { font-weight: var(--weight-medium); }
.time-req-acts { display: flex; gap: var(--space-2); justify-content: flex-end; }
.time-req-acts:empty { display: none; }
@media (max-width: 767px) {
  .time-req { grid-template-columns: minmax(0, 1fr); }
  .time-req-acts { justify-content: stretch; }
  .time-req-acts .btn { flex: 1 1 0; height: 44px; }
}
.timer-bar .btn svg { fill: currentColor; }
.time-page .toolbar .select, .time-page .toolbar .input { height: 36px; }
.time-period { flex-wrap: wrap; min-width: 0; }
.time-period [data-time-custom] { flex-wrap: wrap; }
.time-period [data-time-custom] .input { min-width: 168px; }
.time-period [data-time-custom][hidden] { display: none; }
/* the day reads in full ("Sat, 14 Nov") beside the two times (FB-50) */
.te-times { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 767px) {
  .time-wrap { padding: var(--space-3); gap: var(--space-3); }
  .time-grid { grid-template-columns: minmax(0, 1fr); }
  .time-sum { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .time-big { font-size: 22px; line-height: 28px; }
  .time-page .toolbar { padding: var(--space-3); }
  .time-page .toolbar > .meta { display: none; }
  .time-page .toolbar > form { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  .time-period > .select { flex: 1 1 100%; width: 100% !important; }
  .time-period [data-time-custom] { flex: 1 1 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); }
  .time-period [data-time-custom] .input { width: 100% !important; min-width: 0; }
  .time-period [data-time-custom] .btn { grid-column: 1 / -1; }
  #tWho { width: 100% !important; }
  .te-times { grid-template-columns: 1fr 1fr; }
  .te-times .field:first-child { grid-column: 1 / -1; }
}

/* SYS-425: blocked callers (Settings, Phone numbers) */
.blk-row { align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
.blk-form { padding-top: var(--space-3); }
/* A conversation with someone not in contacts has extra actions (Add to contacts, Block). On a phone they left the
   name no room at all, so the name gets the first line and the actions sit on the right underneath. */
@media (max-width: 767px) {
  .thread-head.th-more { height: auto; flex-wrap: wrap; row-gap: var(--space-1); padding-top: var(--space-1); padding-bottom: var(--space-2); }
  .thread-head.th-more .th-title { flex: 1 1 calc(100% - 56px); }
  .thread-head.th-more .th-act { margin-left: auto; }
}

/* pictures in conversations, the timeline and form answers (SYS-436): one picture shows large in a steady 4:3 frame
   (so a thread doesn't jump as it loads), several show as a row of squares; a tap opens the viewer (pics.js) */
.pics { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); white-space: normal; }
.pic { display: block; position: relative; width: min(100%, 360px); aspect-ratio: 4 / 3; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--color-line); background: var(--color-surface-2); line-height: 0; cursor: zoom-in; }
.pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pics.is-many .pic { width: 112px; aspect-ratio: 1; }
.pics.is-many .pic img { object-fit: cover; }
.pic:focus-visible { outline: 2px solid var(--color-accent, var(--ws)); outline-offset: 2px; }
.pic.pic-broken { width: auto; aspect-ratio: auto; border: 0; background: none; line-height: inherit; cursor: pointer; overflow-wrap: anywhere; }
.bubble .pics:first-child { margin-top: 0; }
.bubble .pic { width: min(100%, 300px); }
.tl-item .pics { margin-top: var(--space-2); }
.pic-viewer .tc-v-stage img { background: transparent; }
@media (max-width: 760px) { .pics.is-many .pic { width: calc((100% - 2 * var(--space-2)) / 3); max-width: 112px; } }
/* a form card in a narrow column (desktop Inbox beside the contact panel) stacks each question over its answer, as on
   a phone, so long answers and pictures get the card's width instead of a sliver beside the labels */
.msg .msg-body:has(> .form-fields) { container-type: inline-size; }
@container (max-width: 560px) {
  .form-fields { grid-template-columns: 1fr; gap: 2px; }
  .form-fields dd { margin-bottom: var(--space-2); }
  .form-fields dd:last-child { margin-bottom: 0; }
}

/* EFS-196: Email and Cc on a quote/invoice hold several addresses and wrap to show them all */
textarea.input.addr-input { height: var(--control-h); min-height: var(--control-h); resize: none; overflow: hidden; padding-top: 7px; padding-bottom: 7px; line-height: 20px; overflow-wrap: anywhere; }
@media (max-width: 767px) { textarea.input.addr-input { height: var(--control-h-touch); min-height: var(--control-h-touch); padding-top: 10px; padding-bottom: 10px; line-height: 22px; } }

/* Visitors (SYS-591) */
.visit-stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-5); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-line); }
.visitors-table td { padding-top: var(--space-2); padding-bottom: var(--space-2); }
@media (max-width: 1099px) { .visitors-table .col-pages, .visitors-table .col-time { display: none; } }
@media (max-width: 767px) { .visitors-table .col-known { display: none; } .visitors-table td, .visitors-table th { padding-left: var(--space-3); padding-right: var(--space-3); } }
.visit-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) 0; border-top: 1px solid var(--color-line); }
.visit-pages { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.visit-pages li { display: flex; gap: var(--space-3); justify-content: space-between; align-items: baseline; }
.visitors-table td.nowrap, .vt-sub .nowrap { white-space: nowrap; }
.vt-sub { display: block; }
.visit-pages .vp-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Reports (FB-52) ---------- */
.rep-page .page-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.rep-range { margin-left: auto; }
.rep-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-5); padding: var(--space-5); max-width: 1400px; }
.rep-hero-main { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.rep-big { font-size: 40px; line-height: 48px; font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.rep-change { font-weight: var(--weight-semibold); }
.rep-change.is-up { color: var(--color-good); }
.rep-change.is-down { color: var(--color-bad); }
.rep-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.rep-part { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rep-share { display: block; height: 4px; border-radius: 2px; background: var(--color-surface-2); position: relative; overflow: hidden; margin-top: var(--space-1); }
.rep-share::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--color-ink-3); border-radius: 2px; }
.rep-trend { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.rep-trend-head, .rep-trend-foot { display: flex; justify-content: space-between; gap: var(--space-2); }
.rep-trend-foot { font-size: var(--text-xs); }
.rep-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.rep-bar { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.rep-col { display: flex; align-items: flex-end; height: 140px; border-bottom: 1px solid var(--color-line); }
.rep-col > span { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--color-line-strong); }
.rep-bar.is-in .rep-col > span { background: var(--color-ink-2); }
.rep-bar em { font-style: normal; font-size: var(--text-xs); color: var(--color-ink-3); text-align: center; }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); max-width: 1400px; align-items: start; }
.rep-card { max-width: 760px; width: 100%; }
.rep-body { padding: var(--space-2) var(--space-4) var(--space-4); display: flex; flex-direction: column; }
.rep-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-line); min-width: 0; }
.rep-line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.rep-line > .num { white-space: nowrap; }
.rep-line:last-child { border-bottom: 0; }
.rep-sub { padding-left: var(--space-3); color: var(--color-ink-2); font-size: var(--text-sm); }
.rep-sub-total, .rep-total { font-weight: var(--weight-semibold); }
.rep-total { border-top: 1px solid var(--color-line-strong); }
.rep-bad .num { color: var(--color-bad); }
.rep-warn { display: flex; gap: var(--space-2); align-items: flex-start; margin-top: var(--space-3); }
.rep-warn .i { flex: none; margin-top: 2px; }
.rep-detail { margin-top: var(--space-2); }
.rep-detail summary { cursor: pointer; font-size: var(--text-sm); color: var(--color-ink-2); padding: var(--space-2) 0; }
.rep-body > .meta:last-child { margin-top: var(--space-3); }
@media (max-width: 767px) {
  .rep-page .page-body { padding: var(--space-3); }
  .rep-hero { grid-template-columns: minmax(0, 1fr); padding: var(--space-4); gap: var(--space-4); }
  .rep-big { font-size: 34px; line-height: 40px; }
  .rep-col { height: 100px; }
  .rep-page .page-body { padding-bottom: calc(var(--space-6) + var(--safe-bottom)); }
  .rep-grid { grid-template-columns: minmax(0, 1fr); }
  .rep-range { margin-left: 0; width: 100%; }
}

/* FB-55: search on the deals board (header on desktop, under the pipeline switch on phones) */
.deal-search { width: 220px; flex: none; }
.deal-search .input { width: 100%; }
.seg a .seg-n { margin-left: 2px; }
@media (max-width: 1199px) { .page-head .deal-search { width: 180px; } }
.deal-phone-tools { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-4) 0; background: var(--color-surface); }
.deal-phone-tools .deal-search { width: 100%; }
@media (max-width: 767px) { .stage-strip::after { content: ""; flex: 0 0 48px; } /* the last stage can scroll clear of the edge fade */ }

/* SC-151 the customer's order page (/o/<token>) and the deal's Artwork & proofs */
.order-top { display: flex; align-items: center; min-height: 40px; }
.order-templates { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.order-templates .btn { max-width: 100%; height: auto; min-height: var(--control-h); padding-block: var(--space-2); line-height: 1.35; white-space: normal; text-align: left; justify-content: flex-start; }
.order-templates .btn .i { flex: none; }
.order-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.order-lines li { display: flex; gap: var(--space-3); align-items: baseline; }
.order-qty { min-width: 2.5em; color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.order-qty::after { content: " ×"; }
.order-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--space-1); counter-reset: none; }
.order-steps li { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); text-align: center; position: relative; color: var(--color-ink-3); font-size: var(--text-xs); }
.order-steps li::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--color-line); z-index: 0; }
.order-steps li:first-child::before { display: none; }
.order-steps li.done::before, .order-steps li.now::before { background: var(--color-good); }
.order-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--color-line-strong); background: var(--color-surface); display: grid; place-items: center; }
.order-steps li.done .order-dot { background: var(--color-good); border-color: var(--color-good); color: #fff; }
.order-steps li.now .order-dot { border-color: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-weak); }
.order-steps li.now, .order-steps li.done { color: var(--color-ink); }
.order-steps li.now .order-step-t { font-weight: var(--weight-semibold); }
.order-pay { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-2); }
.order-pay p { margin: 0; flex: 1 1 240px; }
.order-h { font-size: var(--text-lg); margin: 0; }
.order-h3 { font-size: var(--text-md); margin: 0; }
.order-proof { border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-2); }
.order-proof iframe { display: block; width: 100%; height: min(70vh, 640px); border: 0; }
.order-approve { padding-top: var(--space-2); border-top: 1px solid var(--color-line); }
.order-changes > summary, .order-more > summary, .order-inline > summary { list-style: none; display: inline-flex; width: auto; }
.order-changes > summary::-webkit-details-marker, .order-more > summary::-webkit-details-marker, .order-inline > summary::-webkit-details-marker { display: none; }
.order-changes[open] > summary, .order-more[open] > summary { margin-bottom: var(--space-3); }
.order-inline[open] > summary { margin-bottom: var(--space-2); }
.order-choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.order-opt { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border: 1px solid var(--color-line-strong); border-radius: var(--radius-md); cursor: pointer; }
.order-opt > span { display: flex; flex-direction: column; gap: 2px; }
.order-opt input { margin-top: 3px; accent-color: var(--color-accent); }
.order-opt:has(input:checked) { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); background: var(--color-accent-weak); }
.order-drop { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border: 1.5px dashed var(--color-line-strong); border-radius: var(--radius-md); cursor: pointer; }
.order-drop > span { display: flex; flex-direction: column; gap: 2px; }
.order-drop:hover, .order-drop:focus-within { border-color: var(--color-accent); }
.order-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.order-files:empty { display: none; }
.order-files li { position: relative; display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: var(--space-1) var(--space-2) var(--space-2); border: 1px solid var(--color-line); border-radius: var(--radius-sm); min-width: 0; }
.order-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--color-line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }
.order-bar span { display: block; height: 100%; width: 0; background: var(--color-accent); transition: width var(--dur-base); }
.order-files li.is-done .order-bar span { background: var(--color-good); }
.order-files li.is-failed { border-color: var(--color-bad); }
.order-files li.is-failed [data-st] { color: var(--color-bad); white-space: normal; }
.order-quote { margin: 0; padding: var(--space-3) var(--space-4); border-left: 3px solid var(--color-line-strong); background: var(--color-surface-2); white-space: pre-wrap; }
.order-sub, .order-proof-row { padding: var(--space-3); border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.order-add-proof { align-self: flex-start; }
.order-add-proof.is-busy, .order-add-print.is-busy { opacity: .6; pointer-events: none; }
.order-add-print { align-self: flex-start; }
/* SC-151 the deal's Supplier order ready box: the sentence on its own line, the buttons together under it */
.order-supplier .banner-body p { margin: 0; }
.order-supplier .banner-title, .order-missing .banner-title { display: block; }   /* the title on its own line, so a phone never leaves one word alone */
.order-supplier-acts { flex-wrap: wrap; }
.order-missing .banner-body { line-height: 1.45; }
@media (max-width: 600px) {
  .order-choice { grid-template-columns: 1fr; }
  /* phones open a PDF in their own viewer: an inline PDF frame is blank or one page there */
  .order-proof { display: none; }
}
/* six labels don't fit side by side on a phone: the steps stack, each dot joined to the next */
@media (max-width: 480px) {
  .order-steps { grid-template-columns: 1fr; gap: 0; }
  .order-steps li { flex-direction: row; align-items: center; text-align: left; gap: var(--space-3); padding-bottom: 8px; font-size: var(--text-sm); }
  .order-steps li:last-child { padding-bottom: 0; }
  .order-steps li::before { top: -8px; left: 11px; width: 2px; height: 8px; }
}

/* SYS-818 agency dashboard (/agency) */
.agency-body { padding: var(--space-4) var(--space-5) var(--space-7); display: flex; flex-direction: column; gap: var(--space-4); }
.agency-bare { min-height: 100dvh; background: var(--color-bg); }
.agency-bare .page-head { padding: var(--space-5) var(--space-5) var(--space-2); }
.agency-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
.agency-num { font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: 1.2; }
.agency-new > summary { list-style: none; width: max-content; }
.agency-new > summary::-webkit-details-marker { display: none; }
.agency-new[open] > summary { margin-bottom: var(--space-3); }
.agency-new form, .agency-form { max-width: 560px; }
.agency-clients td { vertical-align: middle; }
.agency-client { display: flex; align-items: center; gap: var(--space-3); min-width: 0; color: inherit; text-decoration: none; }
.agency-clients tr.is-paused .agency-client { opacity: .65; }
.agency-actions { text-align: right; width: 48px; }
.agency-actions .menu-wrap { position: relative; display: inline-block; }
.agency-actions .menu-wrap > summary { list-style: none; }
.agency-actions .menu-wrap > summary::-webkit-details-marker { display: none; }
.agency-actions .menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; }
.agency-actions .menu form { margin: 0; }
.agency-actions .menu button.menu-item { width: 100%; text-align: left; background: none; border: 0; font: inherit; }
.agency-list { list-style: none; margin: 0; padding: 0; }
.agency-list > li { border-bottom: 1px solid var(--color-line); }
.agency-list > li:last-child { border-bottom: 0; }
.agency-list > li.link-row, .agency-list > li > .link-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.agency-lede { margin: 0; }
.agency-list > li:has(.agency-del) { display: flex; align-items: center; }
.agency-list > li:has(.agency-del) > .link-row { flex: 1; min-width: 0; }
.agency-del { padding-right: var(--space-3); }
.agency-pic { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.agency-pic img { border-radius: 12px; }
.agency-logo-box { width: 140px; height: 56px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-2); border-radius: var(--radius-sm); }
.agency-logo-box img { max-width: 132px; max-height: 48px; border-radius: 0; }
.agency-color { width: 72px; height: 40px; padding: 2px; }
.agency-dns code { font-size: var(--text-sm); word-break: break-all; }
@media (max-width: 767px) {
  .agency-body { padding: var(--space-3) var(--space-3) calc(var(--space-7) + 72px); }
  .agency-clients td[data-label] { font-weight: var(--weight-medium); }
  .agency-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agency-clients td[data-label="Client"] { grid-column: 1 / -1; }
  .agency-clients td.agency-actions { position: absolute; right: var(--space-3); top: var(--space-3); width: auto; }
  .agency-clients tr { position: relative; }
  .agency-clients td[data-label]::before { content: attr(data-label); display: block; font-size: var(--text-xs); color: var(--color-ink-3); }
  .agency-clients td[data-label="Client"]::before { display: none; }
}
