/* Sacred Command Center · the Zoho-style kit: container (Ctr), rows, table, Kanban, timeline, filter panel, list view, record
   page, Quick Create, module tabs. Semantic tokens only (no hex, no rgba). Density comes from html[data-density] through
   --row-h, --th-h, --cell-px (app.css). No colored side stripes, no per-column colors, no status dots in list cells: a status is
   a plain word; the only marks are Live, Gilt and the owner mark. Only the top bar and the phone bottom bar use backdrop-filter. */

/* ── Container (Ctr) ──────────────────────────────────────────────────────────────────── */
.ctr { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
/* The header keeps a column for its one action on the title line; Ctr.js measures the action and sets --ctr-act-w inline. */
.ctr:has(> .ctr-hd > .ctr-act) { --ctr-act-w: 8rem; }
.ctr-hd { position: relative; }
.ctr-h { min-width: 0; font: inherit; }
.ctr-head {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) var(--ctr-act-w, 0px); column-gap: var(--s-2); row-gap: 2px;
  width: 100%; min-height: 64px; padding: var(--s-3);
  border-radius: var(--r-card);
  color: var(--text); text-align: left;
  transition: background-color var(--t-feedback) var(--ease-out);
}
.ctr-head:active { background: var(--hover); }
@media (hover: hover) { .ctr-head:not([aria-disabled="true"]):hover { background: var(--hover); } }
.ctr-tw { grid-row: 1; align-self: center; width: 20px; height: 20px; color: var(--text-3); transition: transform var(--t-move) var(--spring); }
.ctr[data-state="open"] .ctr-tw { transform: rotate(90deg); }
.ctr-line { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); min-width: 0; }
.ctr-title { font-size: var(--fs-h3); font-weight: 700; line-height: 1.28; color: var(--text); }
.ctr-count { font-size: var(--fs-body); font-weight: 700; line-height: 1.28; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ctr-sum { grid-column: 2 / -1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctr-act { position: absolute; top: 12px; right: var(--s-3); display: flex; align-items: center; gap: var(--s-2); }
/* A phone: the action is a 44 px target, taller than the title line, so it would sit over the summary. It goes under the head, in line with the title (Home does the same for its own containers). */
@media (max-width: 559px) {
  .ctr-hd:has(> .ctr-act) .ctr-head { grid-template-columns: 24px minmax(0, 1fr); }
  .ctr-hd:has(> .ctr-act) > .ctr-act { position: static; padding: 0 var(--s-3) var(--s-2) calc(var(--s-3) + 24px + var(--s-2)); }
}
.ctr-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-move) var(--ease-out); }
.ctr[data-state="open"] > .ctr-body { grid-template-rows: 1fr; }
.ctr-in { min-height: 0; overflow: hidden; }
.ctr-in > :first-child { border-top: 1px solid var(--line); }
.ctr-pad { padding: var(--s-3); }
.ctr-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: 52px; padding: var(--s-1) var(--s-2) var(--s-1) var(--s-3); border-top: 1px solid var(--line); }
.ctr-foot .caption { margin-right: auto; }
.ctr-in .row--link:focus-visible, .ctr-in [tabindex="0"]:focus-visible, .ctr-in .table-wrap:focus-visible { outline-offset: -2px; }
.ctr .ctr-head[aria-disabled="true"] { cursor: default; }
.ctr .ctr-head[aria-disabled="true"] .ctr-tw { visibility: hidden; }
/* Empty: the read worked and returned nothing. Calm, dimmed, no chevron, not expandable. */
.ctr.is-empty { background: transparent; }
.ctr.is-empty .ctr-title { color: var(--text-2); }
.ctr.is-empty .ctr-sum { color: var(--text-3); }
.ctr.has-state { background: transparent; }
.ctr[aria-busy="true"] .ctr-sum { color: var(--text-3); }
.skel-rows { display: block; }
@media (max-width: 459px) {
  .ctr-sum { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
}

/* ── Rows (04b): ul.list > li.row ─────────────────────────────────────────────────────── */
.list > .row, .list > li.row {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3);
  min-height: 60px; padding: var(--s-2) var(--s-3); color: var(--text);
}
.row--task { padding-left: calc(var(--s-3) - 10px); gap: var(--s-2); }
.row--task.is-done .row-t { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.row--link { text-decoration: none; transition: background-color var(--t-feedback) var(--ease-out); }
button.row--link { width: 100%; text-align: left; }
.row--link:active { background: var(--hover); }
@media (hover: hover) { .row--link:hover { background: var(--hover); } }
.cols-list > .row { min-height: 52px; flex-wrap: nowrap; }

/* A strip that scrolls sideways fades the edge that has more behind it (layout.js useScrollCue sets the classes) */
.tabs.has-more-r, .stagebar.has-more-r, .lv-tabs.has-more-r { -webkit-mask-image: linear-gradient(to right, currentColor calc(100% - 32px), transparent); mask-image: linear-gradient(to right, currentColor calc(100% - 32px), transparent); }
.tabs.has-more-l, .stagebar.has-more-l, .lv-tabs.has-more-l { -webkit-mask-image: linear-gradient(to left, currentColor calc(100% - 32px), transparent); mask-image: linear-gradient(to left, currentColor calc(100% - 32px), transparent); }
.tabs.has-more-l.has-more-r, .stagebar.has-more-l.has-more-r, .lv-tabs.has-more-l.has-more-r { -webkit-mask-image: linear-gradient(to right, transparent, currentColor 32px, currentColor calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, currentColor 32px, currentColor calc(100% - 32px), transparent); }

/* ── Module tabs, notices, small blocks ───────────────────────────────────────────────── */
.module-tabs { margin: calc(var(--s-2) * -1) 0 var(--s-4); }
.being-ported { max-width: 52rem; }
.empty--none, .empty--not-connected, .empty--not-recorded { align-items: flex-start; }
.state-why { margin-left: var(--s-2); font-weight: 500; color: var(--text-3); }
.stack > .being-ported + .being-ported { margin-top: var(--s-3); }
.profile-card { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.profile-t { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 12rem; }
.set-rows { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.kbd-list { grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); align-items: baseline; }
.kbd-list dt { padding-top: 0; }
.note-body { display: flex; flex-direction: column; }

/* ── Table ────────────────────────────────────────────────────────────────────────────── */
.table-wrap { position: relative; max-width: 100%; overflow: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.table-wrap:focus-visible { outline-offset: 2px; }
.table { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-variant-numeric: tabular-nums; font-size: var(--fs-cell); font-weight: var(--cell-w); }
.th {
  position: sticky; top: 0; z-index: 2; height: var(--th-h); padding: 0 var(--cell-px);
  background: var(--surface); border-bottom: 1px solid var(--line-strong); text-align: left; white-space: nowrap;
  font-size: var(--fs-caption); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3);
}
.th.t-num { text-align: right; }
.th.is-sticky, .td.is-sticky { position: sticky; z-index: 3; }
.th.is-sticky { z-index: 4; }
.td.is-sticky { background: var(--surface); }
.tr.is-selected .td.is-sticky { background: var(--surface-2); }
.th-in { position: relative; display: flex; align-items: center; gap: 2px; height: 100%; min-width: 0; padding-right: 4px; }
.th-btn { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; height: 100%; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; }
.th-btn:hover { color: var(--text); }
.th-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th[aria-sort="ascending"], .th[aria-sort="descending"] { color: var(--text); }
.th-menu { position: absolute; right: -6px; top: 50%; translate: 0 -50%; width: 24px; height: 24px; min-height: 24px; background: var(--surface); opacity: 0; }
.th-menu .i { width: 16px; height: 16px; }
.th:hover .th-menu, .th-menu:focus-visible, .th-menu[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .th-menu { opacity: 1; } }
.th-resize { position: absolute; top: 0; right: calc(var(--cell-px) * -1); bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
.th-resize::after { content: ""; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 1px; background: var(--line); }
.th-resize:hover::after, .th-resize:focus-visible::after { background: var(--text-3); width: 2px; left: 3px; }
.td { height: var(--row-h); padding: 0 var(--cell-px); border-bottom: 1px solid var(--line); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface); }
.td.is-first { color: var(--text); font-weight: 600; }
.td.t-num { text-align: right; }
.th.th-check, .td.td-check { width: 44px; padding: 0; text-align: center; }
.th.th-end { padding: 0; }
.tr:last-child .td { border-bottom: 0; }
.tr.is-click { cursor: pointer; }
@media (hover: hover) { .tr:hover .td, .tr:hover .td.is-sticky { background: var(--surface-2); } }
.tr.is-selected .td { background: var(--surface-2); }
.cell-link { color: inherit; font: inherit; text-decoration: none; display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.cell-link:hover { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 0.2em; }
.state-cell { color: var(--text-3); font-weight: 500; }
.td-end { padding: 0 var(--s-2); overflow: visible; }
/* The row tools stay at the right edge while the table scrolls sideways: never off screen, and a hairline marks where the table passes under them. */
.th.th-end, .td.td-end { position: sticky; right: 0; z-index: 2; border-left: 1px solid var(--line); }
.th.th-end { z-index: 4; }
.rowtools { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.rc { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: var(--fs-caption); font-weight: 600; opacity: 0; transition: opacity var(--t-feedback) var(--ease-out); }
.tr:hover .rc, .tr:focus-within .rc { opacity: 1; }
@media (hover: none) { .rc { opacity: 1; } }
.row-more { opacity: 0; }
.tr:hover .row-more, .tr:focus-within .row-more, .row-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .row-more { opacity: 1; } }
.table-empty { padding: var(--s-5) var(--s-4); }
/* Row checkbox: a square, 24 px, 44 px to hit */
.chk { position: relative; display: inline-grid; place-items: center; width: 44px; height: calc(var(--row-h) - 1px); cursor: pointer; }
.th-check .chk { height: calc(var(--th-h) - 1px); }
.chk-in { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chk-box { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--text-3); border-radius: var(--r-button); color: var(--bg); transition: background-color var(--t-feedback) var(--ease-out), border-color var(--t-feedback) var(--ease-out); }
.chk-box .i { width: 16px; height: 16px; stroke-width: 2.25; opacity: 0; }
.chk-in:checked + .chk-box, .chk-in:indeterminate + .chk-box { background: var(--text); border-color: var(--text); }
.chk-in:checked + .chk-box .i, .chk-in:indeterminate + .chk-box .i { opacity: 1; }
.chk-in:focus-visible + .chk-box { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Stacked blocks under 720 px: every cell carries data-label */
@media (max-width: 719px) {
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: auto !important; min-width: 0 !important; }
  .table--stack { table-layout: auto; }
  .table--stack colgroup, .table--stack thead { display: none; }
  .table--stack .tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); position: relative; }
  .table--stack .tr:last-child { border-bottom: 0; }
  .table--stack .td, .table--stack .td.is-sticky { position: static; height: auto; padding: 2px 0; border: 0; background: transparent; white-space: normal; text-align: left; display: grid; grid-template-columns: minmax(6rem, 36%) minmax(0, 1fr); gap: var(--s-2); align-items: baseline; }
  .table--stack .td::before { content: attr(data-label); font-size: var(--fs-caption); font-weight: 600; letter-spacing: var(--caption-ls); color: var(--text-3); }
  .table--stack .td.is-first { display: block; padding-bottom: var(--s-1); font-size: var(--fs-body); }
  .table--stack .td.is-first::before { content: none; }
  .table--stack .td.td-check { position: absolute; top: var(--s-2); right: var(--s-2); left: auto !important; width: auto; display: block; padding: 0; }
  .table--stack .td-check::before { content: none; }
  .table--stack .td-end { display: block; padding-top: var(--s-1); position: static; border-left: 0; }
  .table--stack .td-end::before { content: none; }
  .table--stack .rc, .table--stack .row-more { opacity: 1; }
  .table--stack .t-num { text-align: left; }
  .table--stack .tr.is-selected, .table--stack .tr.is-selected .td { background: var(--surface-2); }
}

/* On a phone a row with flagged columns (data-m) is two lines: the name, then the flagged cells; everything else is on the record. */
@media (max-width: 719px) {
  .table--stack.table--pm .tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s-2); padding: var(--s-2) var(--s-3); min-height: 64px; }
  .table--stack.table--pm .tr:has(.td-check) { padding-left: 52px; }
  .table--stack.table--pm .td { padding: 0; }
  .table--stack.table--pm .td:not(.is-first):not([data-m]):not(.td-check):not(.td-end) { display: none; }
  .table--stack.table--pm .td[data-m] { display: block; font-size: var(--fs-caption); font-weight: 600; color: var(--text-2); }
  .table--stack.table--pm .td[data-m]::before { content: none; }
  .table--stack.table--pm .td[data-m]:not([data-last])::after { content: "\00b7"; margin-left: var(--s-2); color: var(--text-3); }   /* the dot ends a line, never starts one; Table marks the last cell that is drawn (data-last), so a hidden blank cell leaves no dot behind */
  .table--stack.table--pm .td[data-m]:has(> .state-cell:only-child) { display: none; }   /* a blank cell is not drawn: nothing to say on this line */
  .table--stack.table--pm .td.is-first { flex: 0 0 100%; padding: 0 44px 0 0; font-size: var(--fs-body); }
  .table--stack.table--pm .lead-co { white-space: nowrap; }
  .table--stack.table--pm .td.td-check { left: 4px !important; right: auto; top: 0; }
  .table--stack.table--pm .td.td-end { position: absolute; top: 0; right: var(--s-1); padding: 0; display: flex; align-items: center; height: 44px; width: auto; }
  .table--stack.table--pm .td-end .rc { display: none; }
}

/* ── Kanban ───────────────────────────────────────────────────────────────────────────── */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(264px, 1fr); gap: var(--s-3);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  padding-bottom: var(--s-2); border-radius: var(--r-card); align-items: start;
}
.board:focus-visible { outline-offset: 2px; }
.col { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; scroll-snap-align: start; padding: var(--s-1); border: 1px solid transparent; border-radius: var(--r-card); }
.col.is-over { border-color: var(--text-3); background: var(--hover); }
.col.is-collapsed { min-width: 0; }
/* Every column header is the same two lines tall, so the first card of every column starts at the same height: the second line never wraps. */
.col-h { position: sticky; top: 0; z-index: 1; display: flex; flex-direction: column; gap: 2px; min-height: 3.9rem; padding: var(--s-2) var(--s-1); background: var(--bg); border-bottom: 1px solid var(--line-strong); }
.col-t { display: flex; align-items: center; gap: var(--s-2); font-weight: 700; color: var(--text); min-width: 0; }
.col-fold { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; color: var(--text-3); border-radius: var(--r-button); position: relative; }
.col-fold::after { content: ""; position: absolute; inset: -10px; }
@media (hover: hover) { .col-fold:hover { background: var(--hover); color: var(--text); } }
.col-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.06em; font-size: var(--fs-caption); }
.col-meta { display: flex; flex-wrap: nowrap; column-gap: var(--s-2); min-width: 0; overflow: hidden; padding-left: 32px; font-size: var(--fs-caption); line-height: 1.45; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.col-meta > span { flex: none; }
.col-meta > .col-hint-t { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.col-meta > span + span::before { content: "\00b7"; margin-right: var(--s-2); }
.col-hint { flex: 0 1 auto; min-width: 0; max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; font-size: var(--fs-caption); font-weight: 600; line-height: 1.45; letter-spacing: normal; text-transform: none; color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-button); }
.col-list { display: flex; flex-direction: column; gap: var(--s-2); }
.col-none { padding: var(--s-3) var(--s-1); font-size: var(--fs-caption); color: var(--text-3); }
.col-collapsed-note { padding: var(--s-2) var(--s-1); font-size: var(--fs-caption); color: var(--text-3); }
.col-f { padding-top: var(--s-1); }
.kcard {
  --kc-l1: 1.625rem; --kc-l2: 1.25rem; --kc-l3: 1.25rem;   /* the three line slots: a line with nothing in it keeps its height */
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: var(--kc-l1) var(--kc-l2) var(--kc-l3); column-gap: var(--s-2); row-gap: 2px; align-items: center;
  min-height: 0; max-height: 96px; padding: var(--s-2) var(--s-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
}
.kcard[draggable="true"] { cursor: grab; }
.kcard:has(.kcard-link:active) { transform: scale(var(--press-scale)); }
@media (hover: hover) { .kcard:hover { border-color: var(--line-strong); } }
.kcard.is-busy { opacity: 0.6; }
/* Three lines: name and stage menu; company and owner; next step and a note or button. Each line fits or ends in an ellipsis, never mid-letter. */
.kcard-link { grid-column: 1; grid-row: 1; min-width: 0; color: var(--text); text-decoration: none; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.kcard-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); }   /* the whole card is the link */
.kcard-link:focus-visible { outline: none; }
.kcard-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.kcard-s { grid-column: 1; grid-row: 2; min-width: 0; font-size: var(--fs-caption); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-av { grid-column: 2; grid-row: 2; justify-self: end; margin: -3px 0; }   /* the owner mark sits on the company line without making it taller */
.kcard-next { grid-column: 1; grid-row: 3; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-caption); font-weight: 600; color: var(--text-2); }
.kcard-next-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-next .i { width: 16px; height: 16px; color: var(--text-3); stroke-width: 1.75; flex: none; }
.kcard.is-overdue .kcard-next { color: var(--text); }
.kcard.is-overdue .kcard-next .i { color: var(--accent-mark); }
.kcard-badge { grid-column: 2; grid-row: 3; justify-self: end; align-self: center; position: relative; z-index: 1; display: flex; align-items: center; max-height: var(--kc-l3); }
/* A button or chip in the badge slot is no taller than its line; the 44 px touch target is a hit area around it. */
.kcard-badge .tbtn, .kcard-badge .btn, .kcard-badge .chip { min-height: 0; height: var(--kc-l3); padding-top: 0; padding-bottom: 0; line-height: 1; }
.kcard-badge .tbtn, .kcard-badge .btn { position: relative; }
.kcard-badge .tbtn::after, .kcard-badge .btn::after { content: ""; position: absolute; inset: -12px -6px; }
.kcard-menu { position: relative; z-index: 1; grid-column: 2; grid-row: 1; margin: -6px -8px 0 0; }
.board-phone { display: flex; flex-direction: column; gap: var(--s-3); }

/* ── Timeline ─────────────────────────────────────────────────────────────────────────── */
.tl { display: flex; flex-direction: column; gap: var(--s-4); }
.tl-up { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.tl-up .eyebrow { padding: var(--s-3) var(--s-3) 0; }
.tl-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s-3); }
.tl-f { display: flex; flex-direction: column; gap: 4px; }
.timeline { display: flex; flex-direction: column; gap: var(--s-4); }
.tl-day { display: flex; flex-direction: column; gap: var(--s-3); }
.tl-dayh { font-size: var(--fs-caption); font-weight: 600; letter-spacing: var(--caption-ls); color: var(--text-3); }
.tl-items { display: flex; flex-direction: column; gap: var(--s-4); }
.tl-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: var(--s-3); }
.tl-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-button); background: var(--surface-2); color: var(--text-2); }
.tl-icon .i { width: 20px; height: 20px; }
.tl-item--system .tl-icon { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-3); }
.tl-t { font-weight: 700; color: var(--text); }
.tl-t a { color: inherit; }
.tl-s { font-size: var(--fs-caption); line-height: 1.45; color: var(--text-3); }
.tl-note { margin-top: var(--s-1); color: var(--text-2); max-width: var(--measure); }

/* ── Filter panel ─────────────────────────────────────────────────────────────────────── */
.fp { display: flex; flex-direction: column; width: var(--filter-w); flex: none; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.fp-h { display: flex; align-items: center; justify-content: space-between; padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); }
.fp-t { font-size: var(--fs-body); font-weight: 700; }
.fp-b { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); }
.fp-f { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-top: 1px solid var(--line); }
.fp-f .btn, .fp-f .link-btn { white-space: nowrap; flex: none; }   /* "Save view" never breaks onto two lines */
.fp-search { margin-bottom: var(--s-1); }
.fp-group { border-top: 1px solid var(--line); padding-top: var(--s-2); }
.fp-group:first-of-type { border-top: 0; padding-top: 0; }
.fp-gh { display: flex; align-items: center; gap: var(--s-1); width: 100%; min-height: 32px; font-weight: 700; font-size: var(--fs-cell); color: var(--text); text-align: left; position: relative; }
.fp-gh::after { content: ""; position: absolute; inset: -6px 0; }
.fp-gh .num { margin-left: auto; color: var(--text-3); }
.fp-tw { color: var(--text-3); transition: transform var(--t-feedback) var(--ease-out); }
.fp-gh[aria-expanded="true"] .fp-tw { transform: rotate(90deg); }
.fp-gb { display: flex; flex-direction: column; gap: 2px; padding: var(--s-1) 0 var(--s-2) var(--s-1); }
.fp-crit { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-2); margin: 0 0 var(--s-2); background: var(--surface-2); border-radius: var(--r-button); }
.fp-crit-h { display: flex; align-items: center; justify-content: space-between; }
.fp-add { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.fp-saved { display: flex; flex-direction: column; }
.fp-saved-b { display: flex; justify-content: space-between; gap: var(--s-2); width: 100%; min-height: 32px; align-items: center; font-size: var(--fs-cell); font-weight: 600; text-align: left; color: var(--text-2); position: relative; }
.fp-saved-b::after { content: ""; position: absolute; inset: -6px 0; }
@media (hover: hover) { .fp-saved-b:hover { color: var(--text); } }
.fp-toggles { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: var(--s-2); }

/* ── List view ────────────────────────────────────────────────────────────────────────── */
.lv { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.lv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-1) var(--s-4); min-height: 40px; }
.lv-title { display: flex; align-items: center; gap: var(--s-3); min-width: 0; flex-wrap: wrap; }
.lv-h { font-size: var(--fs-h2); font-weight: 700; line-height: 1.2; }
.lv-tools { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.lv-tabs { display: flex; gap: var(--s-3); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.lv-tabs .tab { min-height: 40px; font-size: var(--fs-cell); }
.lv-tabs .tab::after { bottom: 0; }
.lv-bar { position: sticky; top: calc(var(--head-h) + var(--top)); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-height: 44px; padding: 2px var(--s-2); background: var(--bg); border-bottom: 1px solid var(--line); }
.lv-bar--mass { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r-card); }
.lv-bar--mass .tbtn { white-space: normal; max-width: 100%; }
.lv-sel { font-weight: 600; margin-right: var(--s-2); }
.lv-count { color: var(--text-3); font-size: var(--fs-caption); font-weight: 600; margin-left: var(--s-2); font-variant-numeric: tabular-nums; }
.lv-pager { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; flex-wrap: wrap; }
.lv-bar .right { margin-left: auto; }
.lv-range { color: var(--text-3); font-size: var(--fs-caption); font-weight: 600; }
.lv-size .select { min-height: 32px; width: auto; padding-right: 32px; }
.pager { display: flex; align-items: center; gap: 2px; }
.pager-n { min-width: 32px; height: 32px; padding: 0 var(--s-1); border-radius: var(--r-button); color: var(--text-2); font-size: var(--fs-cell); font-weight: 600; font-variant-numeric: tabular-nums; position: relative; }
.pager-n::after { content: ""; position: absolute; inset: -6px -2px; }
.pager-n[aria-current="page"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
@media (hover: hover) { .pager-n:hover:not([aria-current="page"]) { background: var(--hover); color: var(--text); } }
.pager-gap { color: var(--text-3); padding: 0 2px; }
.lv-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.chip-x { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 2px; color: var(--text-3); position: relative; }
.chip-x::after { content: ""; position: absolute; inset: -10px; }
.chip-x:hover { color: var(--text); }
.lv-note { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); }
.lv-note .state { white-space: normal; }
.lv-main { display: flex; align-items: flex-start; gap: var(--s-3); min-width: 0; }
.lv-body { flex: 1; min-width: 0; }
.lv-state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.lv-progress { position: fixed; z-index: 65; right: var(--s-4); bottom: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); min-width: 240px; padding: var(--s-3); background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--r-card); box-shadow: var(--shadow); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) { .lv-progress { right: var(--s-3); left: var(--s-3); bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + var(--fab) + var(--s-4)); } .lv-bar { top: calc(var(--head-h) + var(--top)); } }
/* A list page fills the window: the table scrolls inside its own region so the header row and the first column stay put. */
@media (min-width: 768px) and (min-height: 560px) {
  .view:has(.lv-main) { display: flex; flex: none; flex-direction: column; height: calc(100dvh - var(--head-h) - var(--top)); padding-bottom: var(--s-3); overflow: hidden; }
  .view:has(.lv-main) .module { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  .view:has(.lv-main) .lv { flex: 1; min-height: 0; }
  .view:has(.lv-main) .page-head .eyebrow { display: none; }
  .view:has(.lv-main) .page-head { margin-bottom: var(--s-1); }
  .view:has(.lv-main) .lv-main { flex: 1; min-height: 0; }
  .view:has(.lv-main) .lv-body, .view:has(.lv-main) .fp { height: 100%; min-height: 0; }
  .view:has(.lv-main) .lv-body > .table-wrap { height: 100%; }
  .view:has(.lv-main) .lv-bar { position: static; }
}

/* ── Calendar bar (Activities and Content share it) ───────────────────────────────────────── */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: var(--s-2) var(--s-4); }
.cal-nav { display: flex; align-items: center; gap: var(--s-1); min-width: 0; }
.cal-title { margin-left: var(--s-2); min-width: 9.5rem; font-size: var(--fs-h3); font-weight: 700; line-height: 1.3; }
@media (max-width: 719px) { .cal-title { margin-left: 0; flex-basis: 100%; min-width: 0; } }


/* The record views (List, Kanban, Split, Chart ...) show their words only for the one in use; the others are icons (each says what it is on hover).
   One rule for every list, so Create and Actions sit at the same place on every page. */
.lv-tools .seg[aria-label="Record view"] > button { font-size: 0; gap: 0; padding: 0 var(--s-2); }
.lv-tools .seg[aria-label="Record view"] > button[aria-pressed="true"] { font-size: var(--fs-cell); gap: 6px; }
@media (pointer: coarse) { .lv-tools .seg[aria-label="Record view"] > button { min-width: var(--tap); } }

/* ── Record page ──────────────────────────────────────────────────────────────────────── */
.rp { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.rp-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.rp-back { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: var(--fs-cell); position: relative; }
.rp-back::after { content: ""; position: absolute; inset: -6px -4px; }
@media (hover: hover) { .rp-back:hover { color: var(--text); } }
.rp-nav { display: flex; align-items: center; gap: var(--s-2); }
.rp-nav [aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.rp-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.rp-id { display: flex; align-items: center; gap: var(--s-3); min-width: 0; flex: 1 1 18rem; }
.rp-logo { width: 48px; height: 48px; border-radius: var(--r-button); object-fit: contain; background: var(--surface-2); }
.rp-name { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rp-title { font-size: var(--fs-h2); font-weight: 800; line-height: 1.15; letter-spacing: -0.008em; overflow-wrap: anywhere; }
.rp-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); }
.rp-owner { display: inline-flex; align-items: center; gap: var(--s-1); }
.rp-facts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: 0; flex: 2 1 24rem; }
.rp-fact { display: flex; flex-direction: column; gap: 2px; min-width: 6rem; }
.rp-fact dt { font-size: var(--fs-caption); font-weight: 600; letter-spacing: var(--caption-ls); color: var(--text-3); }
.rp-fact dd { margin: 0; font-weight: 600; }
.rp-acts { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.stagebar-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); }
.stagebar { display: flex; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; gap: 2px; }
.stage { flex: 1 0 auto; }   /* never shrinks: a narrow window scrolls the bar sideways instead of cutting the words */
.stage-b {
  display: flex; align-items: center; justify-content: center; gap: var(--s-1); width: 100%; min-height: 40px; padding: 0 22px;   /* clears the 12 px notch on each side */
  background: var(--surface); border: 1px solid var(--line); color: var(--text-3); font-size: var(--fs-cell); font-weight: 600; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  position: relative;
}
.stage:first-child .stage-b { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: var(--r-button) 0 0 var(--r-button); }
.stage:last-child .stage-b { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 var(--r-button) var(--r-button) 0; }
.stage--done .stage-b { color: var(--text-2); }
.stage--done .stage-b .i { color: var(--gilt); }
.stage--now .stage-b { background: var(--raised); color: var(--text); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-strong); }
.stage--lost .stage-b .i { color: var(--accent-mark); }
.stage-b:disabled { cursor: default; }
@media (hover: hover) { .stage-b:not(:disabled):hover { color: var(--text); background: var(--hover); } }
.stage-note { font-size: var(--fs-caption); font-weight: 600; color: var(--text-2); }
.rp-cols { display: flex; align-items: flex-start; gap: var(--s-4); min-width: 0; }
.rp-rail { flex: none; width: 200px; position: sticky; top: calc(var(--head-h) + var(--top) + var(--s-3)); display: flex; flex-direction: column; gap: var(--s-2); }
.rp-rail ul { display: flex; flex-direction: column; }
.rail-b { display: flex; justify-content: space-between; gap: var(--s-2); width: 100%; min-height: 36px; align-items: center; padding: 0 var(--s-2); border-radius: var(--r-button); color: var(--text-2); font-size: var(--fs-cell); font-weight: 600; text-align: left; }
.rail-b .num { color: var(--text-3); }
@media (hover: hover) { .rail-b:hover { background: var(--hover); color: var(--text); } }
@media (pointer: coarse) { .rail-b { min-height: var(--tap); } }
.rp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.rp-panel { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
@media (max-width: 899px) { .rp-rail { display: none; } }
/* Sections and fields */
.rs { display: flex; flex-direction: column; gap: var(--s-3); scroll-margin-top: calc(var(--head-h) + var(--top) + var(--s-3)); }
.rs-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.rs-h .eyebrow + * { margin-top: 0; }
.rs-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-left: auto; }
.rs-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-1) var(--s-6); margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-2) var(--s-4); }
/* Two columns only when the record's own column is wide enough: the sidebar and the related rail take most of a 1024 to 1366 px window. */
.rp-main { container-type: inline-size; container-name: rp-main; }
@container rp-main (min-width: 700px) { .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rf-v { overflow-wrap: anywhere; }
.rf { display: grid; grid-template-columns: minmax(6.5rem, 38%) minmax(0, 1fr); gap: var(--s-2); align-items: center; min-height: 44px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.rf--wide { grid-column: 1 / -1; }   /* one column: the same label width as every other row */
@container rp-main (min-width: 700px) { .rf--wide { grid-template-columns: minmax(6.5rem, calc((100% - var(--s-6)) * 0.19)) minmax(0, 1fr); } }   /* two columns: its value starts where the left column's values do */
.rf-l { font-size: var(--fs-caption); font-weight: 600; letter-spacing: var(--caption-ls); color: var(--text-3); }
.rf-v { margin: 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--s-3); }
.rf-v > .rf-show, .rf-v > .rf-edit { flex: 1 1 8rem; }
.rf-v > .hint { margin-left: auto; text-align: right; }   /* a hint sits on the value's own line, so every row keeps the same height */
.rf-show { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); width: 100%; min-height: 36px; padding: 0 var(--s-2); margin: 0 calc(var(--s-2) * -1); border-radius: var(--r-button); text-align: left; color: var(--text); font-weight: 600; width: calc(100% + var(--s-4)); }
.rf-show:disabled { cursor: default; width: auto; flex: 0 1 auto; margin-right: 0; }
.rf-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.rf-pencil { color: var(--text-3); opacity: 0; flex: none; }
@media (hover: hover) { .rf-show:not(:disabled):hover { background: var(--hover); } .rf-show:hover .rf-pencil { opacity: 1; } }
.rf-show:focus-visible .rf-pencil { opacity: 1; }
@media (hover: none) { .rf-pencil { opacity: 1; } }
.rf-edit { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-1) 0; }
.rf-acts { display: flex; gap: var(--s-2); }
/* Related lists */
.rl { display: flex; flex-direction: column; gap: var(--s-2); scroll-margin-top: calc(var(--head-h) + var(--top) + var(--s-3)); }
.rl-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.rl-t { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-h3); font-weight: 700; }
.rl-acts { display: flex; gap: var(--s-1); margin-left: auto; }
.rl-note { margin: 0; }
.rl-more { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-top: 1px solid var(--line); }
.rl.is-expanded { position: relative; }
.rl-ex { min-width: 0; }

/* ── Phone lists ──────────────────────────────────────────────────────────────────────────── */
/* The first lead should start near the top: the in-page Create is the + button (a second filled button would double it), the page's
   quiet actions live in Actions, and paging controls that mean nothing at this size are hidden. */
@media (max-width: 719px) {
  .lv-head { gap: var(--s-1); }
  .lv-title { gap: var(--s-2); }
  .lv-tabs { display: none; }
  .lv-title .lv-tabs:has(.lead-awaiting-tab) { display: flex; }
  .lv-tools .tbtn-split { display: none; }
  .lv-size, .lv-range { display: none; }
  .view:has(.lv-main) .page-meta { display: none; }   /* Refresh and the page's quiet actions are in Actions on a phone */
}

/* ── Touch: 44 px to hit ──────────────────────────────────────────────────────────────────── */
/* app.css extends buttons with a ::after; these are the controls it does not reach. Fine pointers keep the denser sizes. */
@media (pointer: coarse) {
  .lv-tabs .tab, .tabs .tab { min-height: var(--tap); }
  .seg > button, .seg--sm > button { min-height: var(--tap); }
  .lv-size .select { min-height: var(--tap); }
  .stage-b { min-height: var(--tap); }
  .rf-show { min-height: var(--tap); }
  .table--stack .cell-link { padding: 10px 0; }
  .hfoot .link-btn, .rl-more .link-btn, .lv-chips .link-btn, .lv-bar .link-btn, .state .link-btn, .lv-note .link-btn { display: inline-flex; align-items: center; min-height: var(--tap); }
  .setup-back, .setup-nav a, .setup-gh button { min-height: var(--tap); }
  .pager-n { min-width: var(--tap); height: var(--tap); }
  /* found by the interaction review: the top bar's search, a small button, a small select, the Tasks status chip, a related list's Expand */
  .search-btn, .btn--sm, .tbtn, select.input--sm, .select--sm, .act-status, .rf-show, .rl-more .link-btn { min-height: var(--tap); }
}

/* An honest state that carries its reason on the same line wraps on a phone (the "Not from the web form" block was wider than the screen). */
/* A state with its reason wraps at every width (it was nowrap from 720 px up, which pushed 720 to 767 px pages sideways), and inside a container line or a record value */
.state:has(> .state-why), .ctr-line .state, .rf-v .state, .state--gate { white-space: normal; flex-wrap: wrap; max-width: 100%; }
@media (max-width: 719px) { .state:has(> .state-why) > .state-why { margin-left: 0; } }
