/* ==========================================================================
   CRM screens: record tables, the record panel, the pipeline board, the
   Fields settings and the Trash. (Generic window pieces are in appkit.css.)
   Layouts respond to the width of the WINDOW, not the screen.
   ========================================================================== */

/* ---------- a record app: bar on top, table filling the rest ---------- */

.rec { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rec-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 1%; border-bottom: 1px solid var(--line); }
.rec-title { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.rec-title strong { font-size: 16px; font-weight: 650; }
.rec-filter { flex: 1; min-width: 120px; max-width: 280px; height: 32px; }
.rec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.rec-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.rec-spacer { flex: 1; }
.rec-modes { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: rgb(var(--well) / 0.2); }
.rec-modes button { height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: none; font-size: 12px; }
.rec-modes button.on { background: rgb(var(--accent-rgb) / 0.28); }

/* totals along the top of the pipeline */
.rec-tiles { padding: 8px 1% 0; }
.rec-tiles .stat-tile { padding: 8px 12px 9px 14px; }
.rec-tiles .stat-value { font-size: 20px; }

.rec-body { position: relative; flex: 1; min-height: 0; display: flex; }
.rec-main { flex: 1; min-width: 0; min-height: 0; display: flex; padding: 8px 1% 1%; }
.rec-scroll { flex: 1; min-width: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--well) / 0.16); }
.rec-empty { margin: auto; display: grid; justify-items: center; gap: 12px; color: var(--muted); }
.rec-more { display: block; margin: 10px auto; }

/* ---------- table ---------- */

.rec-table { min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.rec-table th, .rec-table td { padding: 0 10px; height: 36px; border-bottom: 1px solid rgb(var(--ink) / 0.07); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.rec-table thead th { position: sticky; top: 0; z-index: 1; padding: 0; background: var(--head); color: var(--muted); font-size: 12px; font-weight: 600; }
.rec-table th.rec-check, .rec-table td.rec-check { padding: 0; text-align: center; }
.rec-table input[type="checkbox"], .rec-tick input, .rec-col-tick input, .rec-merge input { width: 15px; height: 15px; accent-color: #5b8def; }
.rec-table th { position: relative; }
.rec-sort { width: 100%; height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.rec-sort span { overflow: hidden; text-overflow: ellipsis; }
.rec-sort i { font-size: 9px; font-style: normal; }
.rec-sort:hover, th.sorted .rec-sort { color: var(--text); }
th.num .rec-sort { justify-content: flex-end; }
.rec-resize { position: absolute; top: 0; right: 0; width: 9px; height: 100%; cursor: col-resize; touch-action: none; }
.rec-resize::after { content: ""; position: absolute; top: 9px; bottom: 9px; right: 3px; width: 1px; background: var(--line); }
.rec-resize:hover::after { width: 3px; right: 2px; background: var(--accent); }
.rec-table tbody tr { cursor: pointer; }
.rec-table tbody tr:hover td { background: rgb(var(--ink) / 0.06); }
.rec-table tbody tr.sel td { background: rgb(var(--accent-rgb) / 0.12); }
.rec-table tbody tr.on td { background: rgb(var(--accent-rgb) / 0.22); }
.rec-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rec-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rec-table td.main { font-weight: 600; }
.rec-chip { display: inline-block; max-width: 100%; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgb(var(--ink) / 0.07); font-size: 12px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.rec-link { max-width: 100%; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-align: left; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.rec-link:hover { text-decoration: underline; }
.rec-link:disabled { color: var(--muted); cursor: default; text-decoration: none; }

/* ---------- the panel on the right: a record, the column chooser, a merge ---------- */

.rec-side { position: relative; width: var(--side-w, min(340px, 42%)); flex: none; min-height: 0; display: flex; border-left: 1px solid var(--line); background: rgb(var(--panel) / 0.72); }
.rec-form { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.rec-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.rec-side-head h3 { min-width: 0; font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-form-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 14px; overflow: auto; container-type: inline-size; }
.rec-form-foot { padding: 10px 14px; border-top: 1px solid var(--line); }
.rec-error { color: var(--danger); font-size: 13px; }
.rec-error:not(:empty) { margin-bottom: 8px; }
.rec-group h4 { margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid rgb(var(--ink) / 0.08); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.rec-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.rec-field { display: grid; align-content: start; gap: 4px; min-width: 0; color: var(--muted); font-size: 12px; }
.rec-field.wide { grid-column: 1 / -1; }
.rec-field > span > b { color: var(--danger); }
.rec-field small { font-size: 11px; }
.rec-field .field { width: 100%; height: 34px; color: var(--text); font-size: 13px; }
.rec-field textarea.field { height: auto; min-height: 70px; padding-top: 8px; padding-bottom: 8px; resize: vertical; font: inherit; font-size: 13px; }
.rec-field .field:disabled { opacity: 0.7; }
.rec-field input[type="date"] { color-scheme: var(--scheme); }
.rec-tick { height: 34px; display: flex; align-items: center; }
.rec-related { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
@container (max-width: 360px) { .rec-fields { grid-template-columns: minmax(0, 1fr); } }

.rec-lookup { position: relative; }
.rec-lookup-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: 220px; display: grid; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); overflow: auto; }
.rec-lookup-list .kit-hint { padding: 6px 8px; }
.rec-lookup-item { padding: 7px 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font-size: 13px; text-align: left; }
.rec-lookup-item:hover { background: rgb(var(--ink) / 0.12); }

/* column chooser */
.rec-cols { display: grid; gap: 4px; }
.rec-col { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto 64px auto; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgb(var(--ink) / 0.05); font-size: 13px; }
.rec-col strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-col .field { height: 28px; padding: 0 6px; font-size: 12px; }
.rec-grip { color: var(--muted); cursor: grab; letter-spacing: -2px; }
.rec-col-tick { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.rec-col-move { display: flex; }
.rec-col-move .btn { width: 24px; padding: 0; }
@container (max-width: 400px) {
  .rec-col { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .rec-col .field, .rec-col-move { grid-row: 2; }
  .rec-col .field { grid-column: 2; width: 70px; }
  .rec-col-move { grid-column: 3 / -1; justify-self: end; }
}

/* merge */
.rec-merge { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.04); cursor: pointer; }
.rec-merge.on { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.14); }
.rec-merge > div { min-width: 0; display: grid; gap: 3px; font-size: 13px; }
.rec-merge small { color: var(--muted); }
.rec-merge div div { display: flex; gap: 8px; }
.rec-merge div div span { flex: none; width: 96px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-merge div div b { min-width: 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- pipeline board ---------- */

.rec-board { flex: 1; min-width: 0; display: flex; gap: 8px; overflow-x: auto; }
.rec-lane { flex: 1 0 168px; max-width: 320px; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-top: 3px solid #5b8def; border-radius: 10px; background: rgb(var(--well) / 0.18); }
.rec-lane.kind-won { border-top-color: #34d399; }
.rec-lane.kind-lost { border-top-color: #94a3b8; }
.rec-lane header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 10px; font-size: 13px; }
.rec-lane header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-lane header span { flex: none; color: var(--muted); font-size: 12px; }
.rec-cards { flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 6px; padding: 0 6px 8px; overflow-y: auto; }
.rec-cards .kit-hint { padding: 8px; text-align: center; }
.rec-card { display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgb(var(--ink) / 0.07); color: var(--text); font-size: 13px; text-align: left; }
.rec-card:hover { background: rgb(var(--ink) / 0.12); }
.rec-card.on { border-color: var(--accent); }
.rec-card[draggable="true"] { cursor: grab; }
.rec-card strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-card small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-card span { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.rec-card b { font-weight: 600; }
.rec-card i { color: var(--muted); font-style: normal; }

/* ---------- narrow window (a phone, or a small window on a big screen) ---------- */

@container (max-width: 760px) {
  /* the panel covers the table instead of sitting beside it */
  .rec-side { position: absolute; inset: 0; z-index: 3; width: auto; border-left: 0; background: var(--sheet); }
  .rec-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 560px) {
  .rec-bar { padding: 8px; }
  .rec-main { padding: 8px; }
  .rec-filter { order: 3; flex-basis: 100%; max-width: none; }
  .rec-table th, .rec-table td { height: 44px; }      /* easier to tap */
  .rec-sort { height: 44px; }
  .rec-tiles .stat-tile { padding: 6px 10px 7px 12px; }
  .rec-tiles .stat-value { font-size: 16px; }
  .rec-lane { flex-basis: 78%; }
}

/* ---------- Settings > Fields ---------- */

.fs { display: flex; flex-direction: column; gap: 12px; }
.fs h2 { font-size: 20px; font-weight: 650; }
.fs .kit-toolbar .field { max-width: 320px; }
.fs .kit-toolbar .kit-hint { margin-right: auto; }
.fs .kit-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.fs-list { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--well) / 0.16); overflow: auto; }
.fs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fs-table th, .fs-table td { padding: 7px 10px; border-bottom: 1px solid rgb(var(--ink) / 0.07); text-align: left; white-space: nowrap; }
.fs-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.fs-table tbody tr { cursor: pointer; }
.fs-table tbody tr:hover { background: rgb(var(--ink) / 0.06); }
.fs-table tbody tr.on { background: rgb(var(--accent-rgb) / 0.18); }
.fs-table tr.dim td:not(.fs-switch) { opacity: 0.55; }
.fs-table td strong { font-weight: 600; }
.fs-table .chip { margin-left: 8px; padding: 0 7px; font-size: 11px; }
.fs-switch { width: 1%; }
.fs-flag { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; color: var(--text) !important; font-size: 13px !important; }
.fs-flag input[type="checkbox"]:not(.switch) { width: 15px; height: 15px; accent-color: #5b8def; }
.fs-roles { display: grid; gap: 6px; }
.fs-key .kit-mono { align-self: center; }
.fs-options { display: grid; gap: 6px; }
.fs-option { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 4px; }
.fs-option.stage { grid-template-columns: minmax(0, 1fr) 78px 58px auto auto auto; }
.fs-option.level { grid-template-columns: minmax(0, 1fr) 58px auto auto auto; }
.fs-table .chip.fs-opts { color: var(--accent); }
.fs-option .field { height: 32px; padding: 0 8px; font-size: 13px; }
.fs-option .btn { width: 26px; padding: 0; }
.fs-option .btn:not(.ghost) { width: auto; padding: 0 10px; }
.fs-option.dim .field { opacity: 0.55; }
.kit-panel textarea.field { height: auto; padding: 8px 12px; font: inherit; font-size: 13px; resize: vertical; }
.fs .kit-split.has-detail { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
/* with a field open beside the list, the list keeps just the name and the switches */
.fs .kit-split.has-detail .fs-wide { display: none; }

/* an on/off switch */
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 34px; height: 20px; margin: 0; border-radius: 999px; background: rgb(var(--ink) / 0.2); cursor: pointer; transition: background 0.15s; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch:checked { background: #3d7bf0; }
.switch:checked::after { transform: translateX(14px); }
.switch:disabled { opacity: 0.4; cursor: default; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@container (max-width: 900px) {
  .fs-wide { display: none; }
  .fs .kit-split.has-detail { grid-template-columns: minmax(0, 1fr); }
  .fs .kit-split.has-detail > .fs-list { display: none; }
}

/* ---------- Trash ---------- */

.app-main .kit-toolbar select.field { flex: 0 1 200px; }

.trash-row { grid-template-columns: auto minmax(0, 1.6fr) auto auto auto; cursor: default; }
.trash-row .btn-row { flex-wrap: nowrap; }
@container (max-width: 560px) {
  .trash-row { grid-template-columns: minmax(0, 1fr) auto; }
  .trash-row > :nth-child(1) { display: none; }
  .trash-row > :nth-child(3), .trash-row > :nth-child(4) { display: none; }
}

/* ---------- an app's icon as a small marker beside a record's name ---------- */

.obj-tile { box-shadow: none !important; border-radius: 28%; }
.obj-tile svg { width: 62%; height: 62%; }
.obj-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; vertical-align: middle; }
.obj-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-links { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }

/* ---------- picking a linked record ---------- */

.link-pick { position: relative; min-height: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 6px;
  border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--ink) / 0.08); }
.link-pick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.25); }
.link-chips { display: contents; }
.link-chip { max-width: 100%; display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 4px; border: 1px solid var(--line);
  border-radius: 999px; background: rgb(var(--ink) / 0.08); font-size: 13px; }
.link-chip-name { min-width: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; border: 0; background: none; color: var(--text); }
.link-chip-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip-name:hover span { text-decoration: underline; }
.link-chip-x { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 15px; line-height: 1; }
.link-chip-x:hover { background: rgb(var(--ink) / 0.14); color: var(--text); }
.link-input { flex: 1; min-width: 90px; height: 26px; padding: 0 4px; border: 0; outline: 0; background: none; color: var(--text); font-size: 13px; }
.link-input::placeholder { color: var(--muted); }
.link-pick .link-input:disabled { opacity: 0.7; }
.rec-lookup-item { display: flex; align-items: center; gap: 8px; }
.rec-lookup-item.sel { background: rgb(var(--ink) / 0.12); }
.rec-lookup-item.new { color: var(--accent); font-weight: 600; }
.link-plus { width: 18px; text-align: center; font-size: 16px; }
.link-item-text { min-width: 0; display: grid; }
.link-item-text b, .link-item-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item-text b { font-weight: 500; }
.link-item-text small { color: var(--muted); font-size: 11px; }
.link-sep { padding: 6px 8px 2px; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.rec-lock { display: inline-grid; margin-left: 4px; vertical-align: -2px; opacity: 0.7; }
.rec-lock svg { width: 12px; height: 12px; }
.quick-form { display: grid; gap: 12px; }

/* ---------- filters ---------- */

.rec-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 1% 0; }
.rec-filters .chip b { font-weight: 600; }
.flt { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.flt header { display: flex; align-items: center; justify-content: space-between; }
.flt-options { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.rec-modes button { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- a record in its own window ---------- */

.rw { position: relative; min-height: 100%; display: flex; flex-direction: column; }
.rw-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--sheet); }
.rw-title { flex: 1; min-width: 0; display: grid; }
.rw-title h2 { overflow: hidden; font-size: 18px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.rw-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.rw-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.rw-sections { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 16px; container-type: inline-size; }
.rw-sec { border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.03); }
.rw-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px 6px 6px; }
.rw-fold { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; }
.rw-fold:hover { background: rgb(var(--ink) / 0.06); }
.rw-fold h3 { font-size: 13px; font-weight: 650; letter-spacing: 0.02em; }
.rw-chev { width: 14px; color: var(--muted); transition: transform 0.15s; }
.rw-sec.shut .rw-chev { transform: rotate(-90deg); }
.rw-sec.shut .rw-sec-body { display: none; }
.rw-sec-body { padding: 4px 14px 14px; }
.rw-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rw-tools .btn { display: inline-flex; align-items: center; gap: 4px; }
.rw-tools select.field { width: auto; height: 30px; padding: 0 8px; font-size: 12px; }
.rw-sections .rec-fields { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.rw-stamp { padding: 2px 4px; }
.rw-save { position: sticky; bottom: 0; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--line); background: var(--sheet); box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.18); }
.rw-save .kit-hint { margin-right: auto; }

/* hierarchy and sites */
.hier { display: grid; gap: 8px; }
.hier-above { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.hier-above small { color: var(--muted); font-size: 11px; }
.hier-sep { color: var(--muted); }
.hier-tree, .hier-kids { margin: 0; padding: 0; list-style: none; }
.hier-kids { margin-left: 11px; padding-left: 14px; border-left: 1px solid var(--line); }
.hier-node.shut > .hier-kids { display: none; }
.hier-node.shut > .hier-row .hier-toggle { transform: rotate(-90deg); }
.hier-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 4px 0; font-size: 13px; }
.hier-node.here > .hier-row { margin: 0 -6px; padding: 4px 6px; border-radius: 8px; background: rgb(var(--accent-rgb) / 0.14); }
.hier-toggle { width: 18px; height: 18px; flex: none; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; transition: transform 0.15s; }
.hier-addr { display: grid; margin: 0 0 6px 26px; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.5; }
.hier-node.site .rec-link strong { font-weight: 500; }

/* interactions */
.ix-list { display: grid; gap: 8px; }
.ix-card { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--ink) / 0.04); cursor: pointer; }
.ix-card:hover { background: rgb(var(--ink) / 0.08); }
.ix-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.ix-subject { font-weight: 500; }
.ix-by { margin-left: auto; }
.ix-notes { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.rec-chip.ix-completed { border-color: rgba(52, 211, 153, 0.45); }
.rec-chip.ix-attempted { border-color: rgba(251, 191, 36, 0.5); }

/* related records and history: small tables */
.rel { display: grid; gap: 12px; }
.rel-group { display: grid; gap: 6px; }
.rel-group header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.rel-group header .btn { display: inline-flex; align-items: center; gap: 4px; }
.rel-group.is-empty header { color: var(--muted); }
.mini-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--well) / 0.12); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { max-width: 260px; padding: 6px 10px; border-bottom: 1px solid rgb(var(--ink) / 0.07); overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.mini-table th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.mini-table th.num, .mini-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tbody tr { cursor: pointer; }
.mini-table tbody tr:hover td { background: rgb(var(--ink) / 0.06); }
.mini-table td.main { font-weight: 600; }
.mini-first { display: inline-flex; align-items: center; gap: 6px; }
.hist tbody tr { cursor: default; }
.hist td { white-space: normal; }
.hist-old { color: var(--muted); text-decoration: line-through; text-decoration-color: rgb(var(--ink) / 0.3); }
.col-menu { display: grid; gap: 4px; max-height: 60vh; overflow: auto; }

@container (max-width: 560px) {
  .rw-head { flex-wrap: wrap; padding: 10px 12px; }
  .rw-title { flex: 1 1 170px; }
  .rw-sections { padding: 10px; }
  .rw-sections .rec-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Settings > Layouts ---------- */

.lay { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 12px; align-items: start; }
.lay-list { display: grid; gap: 6px; }
.lay-row { grid-template-columns: minmax(0, 1fr) auto; cursor: pointer; }
.lay-new { margin-top: 6px; }
.lay-secs { display: grid; gap: 4px; }
.lay-sec { display: grid; grid-template-columns: auto auto minmax(110px, 1fr) minmax(120px, 1fr) minmax(80px, 0.6fr) auto auto; align-items: center; gap: 8px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgb(var(--ink) / 0.05); font-size: 13px; }
.lay-sec-name { min-width: 0; display: grid; }
.lay-sec-name strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-sec-name small { color: var(--muted); font-size: 11px; }
.lay-sec .field { height: 30px; padding: 0 8px; font-size: 12px; }
.lay-bar { margin-top: 4px; }
.lay-groups { grid-column: 3 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.lay-sec .lay-add-group { width: auto; height: 26px; padding: 0 6px; font-size: 12px; }
.lay-assigned { display: grid; gap: 2px; }
@container (max-width: 760px) {
  .lay { grid-template-columns: minmax(0, 1fr); }
  .lay-sec { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .lay-sec > .field, .lay-sec > .rec-col-tick { grid-row: 2; grid-column: 3; }
  .lay-sec > .lay-tab { grid-row: 3; grid-column: 3; }
  .lay-groups { grid-row: 4; }
  .lay-sec .rec-col-tick { grid-column: 4; }
}

/* ---------- a field as one line: label, value, pencil ---------- */

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 0 28px; }
.kv { --kv-label: 132px; display: grid; grid-template-columns: var(--kv-label) minmax(0, 1fr) 22px; align-items: center; gap: 2px 10px;
  min-width: 0; min-height: 30px; padding: 3px 0; border-bottom: 1px solid rgb(var(--ink) / 0.06); font-size: 13px; }
.kv.wide { grid-column: 1 / -1; align-items: start; }
.kv[hidden] { display: none; }
.kv-label { min-width: 0; display: flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.kv-label > span { overflow-wrap: anywhere; }
.kv-label b { color: var(--danger); font-weight: 600; }
.kv.wide .kv-label { padding-top: 5px; }
.kv-value { min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.kv-value .rec-link { max-width: 100%; }
.kv-empty { color: var(--muted); opacity: 0.6; }
.kv-long { display: block; white-space: pre-wrap; }
.kv-edit { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none;
  color: var(--muted); opacity: 0.55; cursor: pointer; }
.kv-edit .kit-ico svg { width: 13px; height: 13px; }
.kv:hover .kv-edit, .kv-edit:focus-visible { opacity: 1; }
.kv-edit:hover { background: rgb(var(--ink) / 0.1); color: var(--text); }
.kv.editing { grid-template-columns: var(--kv-label) minmax(0, 1fr) 0; }
.kv.editing .kv-value .field { width: 100%; height: 30px; color: var(--text); font-size: 13px; }
.kv.editing .kv-value textarea.field { height: auto; min-height: 70px; padding-top: 6px; padding-bottom: 6px; resize: vertical; font: inherit; font-size: 13px; }
.kv.editing .kv-value input[type="date"] { color-scheme: var(--scheme); }
.kv.editing .rec-tick { display: inline-flex; min-height: 30px; align-items: center; }
.rw-fields { display: grid; }
.rw-sub { margin: 12px 0 2px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.rw-fields > .rw-sub:first-child, .hier > .rw-sub:first-child { margin-top: 2px; }
.quick-form .kv { --kv-label: 120px; }
@container (max-width: 380px) {
  .kv { --kv-label: 104px; }
}

/* a drop-down of tick boxes (filters) */
.ms { position: relative; }
.ms > summary { list-style: none; cursor: pointer; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.ms > summary::-webkit-details-marker { display: none; }
.ms > summary::after { content: " ▾"; color: var(--muted); }
.ms-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; display: grid; gap: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28); }

/* the locations below an account */
.rw-search { width: 180px; height: 30px; padding: 0 10px; font-size: 12px; }
.mini-table.sites tbody tr.here td { background: rgb(var(--accent-rgb) / 0.14); }
.rec-chip.hq { padding: 0 6px; border-color: rgb(var(--accent-rgb) / 0.5); color: var(--accent); font-size: 11px; font-weight: 650; }
.ix-wrap { display: grid; gap: 6px; }
@container (max-width: 560px) {
  .rw-search { width: 100%; }
  .rw-sec-head .rw-tools { width: 100%; }
}

/* Org Settings > Layouts: section icons and new sections */
.lay-sec .lay-icon { width: 28px; height: 28px; padding: 0; display: grid; place-items: center; }
.lay-adds { flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.lay-adds .field { width: auto; min-width: 180px; height: 30px; font-size: 12px; }
.lay-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.lay-icons .btn { height: 40px; padding: 0; display: grid; place-items: center; }
.lay-icons .btn.on { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.18); }

/* one field's settings, in its own window */
.fw { display: grid; gap: 12px; padding: 16px; container-type: inline-size; }
.fw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fw-head h2 { font-size: 18px; font-weight: 650; }
.fw-card { display: grid; gap: 10px; padding: 14px 16px; }
.fw-card h3 { margin: 0; }
.fw-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; font-size: 13px; }
.fw-facts dt { color: var(--muted); }
.fw-facts dd { margin: 0; overflow-wrap: anywhere; }
.fw-flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px 18px; }
.fw-flag { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.fw-flag > span { display: grid; gap: 2px; font-size: 13px; }
.fs-table tbody tr { cursor: pointer; }
/* grids inside a record window never grow wider than the window; wide tables scroll inside their own box */
.hier, .rw-fields, .ix-wrap, .rel { grid-template-columns: minmax(0, 1fr); }
.hier-sites, .rel-group { min-width: 0; }
.rel-group { grid-template-columns: minmax(0, 1fr); }
.fw-cards { display: grid; gap: 12px; }
.roles-body { min-width: 0; }

/* the formula box */
.fx { display: grid; gap: 6px; }
.fx-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-pick { width: auto; height: 30px; padding: 0 8px; font-size: 12px; }
.fx-box { min-height: 84px; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.fx-hint:empty, .fx-result:empty { display: none; }
.fx-result { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.fx-result.ok { border-color: rgba(52, 211, 153, 0.45); }
.fx-result.bad { border-color: var(--danger); color: var(--danger); }
.fx-result ul { margin: 4px 0 0 18px; }
.chip.fx-chip { font-style: italic; }
.fs-flag[hidden] { display: none !important; }

/* ---------- Reporting and Folders ---------- */

.rp { height: 100%; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.rp-side { padding: 12px 8px; border-right: 1px solid var(--line); overflow: auto; }
.rp-main { min-width: 0; overflow: auto; }
.rp-main .fs { padding: 16px; }
.rp-tree { display: grid; gap: 2px; }
.rp-place { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.rp-place:hover { background: rgb(var(--ink) / 0.07); }
.rp-place.on { background: rgb(var(--accent-rgb) / 0.18); }
.rp-place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-sep { margin: 10px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.rp-none { padding: 4px 10px; }
.rp-folder-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.rp-subs { display: flex; flex-wrap: wrap; gap: 6px; }
.rp-sub { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: rgb(var(--ink) / 0.04); color: var(--text); font-size: 13px; cursor: pointer; }
.rp-sub:hover { background: rgb(var(--ink) / 0.09); }
.rp-table td.rp-actions { white-space: nowrap; text-align: right; }
.rp-table td.rp-actions .btn { margin-left: 2px; }
.rp-types { display: grid; gap: 6px; }
.rp-types h4 { margin: 8px 0 2px; color: var(--muted); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.rp-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.rp-type { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgb(var(--ink) / 0.04);
  color: var(--text); text-align: left; cursor: pointer; }
.rp-type:hover { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.1); }
.rp-type small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.rp-share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.rp-share-row .field { width: auto; height: 30px; font-size: 12px; }
.rp-share-list { margin: 0 0 0 18px; font-size: 13px; }
@container (max-width: 640px) { .rp { grid-template-columns: minmax(0, 1fr); } .rp-side { border-right: 0; border-bottom: 1px solid var(--line); } }

/* one report */
.rq { min-height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 0 0 16px; container-type: inline-size; }
.rq-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--sheet); }
.rq-head > .kit-ico svg { width: 22px; height: 22px; }
.rq-title { flex: 1; min-width: 0; display: grid; }
.rq-title h2 { overflow: hidden; font-size: 17px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.rq-title .kit-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.rq-dirty { border-color: rgba(251, 191, 36, 0.5); }
.rq-controls { display: grid; gap: 8px; padding: 0 16px; }
.rq-scope { justify-self: start; }
.rq-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rq-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 4px; }
.rq-chip.cross { border-color: rgb(var(--accent-rgb) / 0.5); }
.rq-chip-text { padding: 0 4px; border: 0; background: none; color: var(--text); font-size: 12px; cursor: pointer; text-align: left; }
.rq-chip-text:hover { text-decoration: underline; }
.rq-logic-row { display: flex; align-items: center; gap: 8px; }
.rq-logic { max-width: 320px; height: 30px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
.rq-shape { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rq-keep { margin-left: 6px; }
.rq-out { display: grid; gap: 10px; padding: 0 16px; transition: opacity 0.15s; }
.rq-out.busy { opacity: 0.55; }
.rq-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; }
.rq-total b { font-variant-numeric: tabular-nums; }
.rq-scroll { max-height: none; }
.rq-table th.rq-sort { cursor: pointer; user-select: none; }
.rq-table th.rq-sort:hover { color: var(--text); }
.rq-table tfoot td { border-top: 2px solid var(--line); font-weight: 650; }
.rq-table tbody td { cursor: pointer; }
.rq-filter .kit-form { gap: 10px; }
.rq-picks { display: grid; gap: 4px; max-height: 240px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 8px; }
.rq-value .kit-inline { flex-wrap: wrap; }
.rq-n { width: 90px; }
.rq-cmp { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rq-cmp .field { width: auto; }
.rq-col-grid { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); gap: 16px; }
.rq-col-order { display: grid; gap: 4px; margin: 0; padding-left: 20px; font-size: 13px; }
.rq-col-order li span { display: inline-block; min-width: 140px; }
.rq-col-avail { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; max-height: 50vh; overflow: auto; }
.rq-col-avail h4, .rq-col-grid h4 { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.rq-group-row .field { width: auto; }
@container (max-width: 640px) { .rq-col-grid { grid-template-columns: minmax(0, 1fr); } .rq-head { flex-wrap: wrap; } }

/* charts */
.ch { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.03); }
.ch-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-tools .field { width: auto; height: 30px; padding: 0 8px; font-size: 12px; }
.ch-svg { width: 100%; max-width: 760px; height: auto; overflow: visible; }
.ch-label { fill: var(--muted); font-size: 11px; }
.ch-value { fill: var(--text); font-size: 11px; font-weight: 600; }
.ch-value.on-bar { fill: #fff; }
.ch-total { fill: var(--text); font-size: 20px; font-weight: 700; }
.ch-axis { stroke: rgb(var(--ink) / 0.25); }
.ch-metric { display: grid; justify-items: center; padding: 18px; }
.ch-metric strong { font-size: 40px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ch-metric span { color: var(--muted); font-size: 13px; }
.ch-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.ch-ring { width: 220px; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; }
.ch-legend.col { flex-direction: column; }
.ch-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }

/* the side panel of a report: filters and layout, folding to a thin strip */
.rq-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 0 16px; }
.rq-body:not(.shut) > .rq-side { width: var(--rq-side-w, 300px); }
.rq-body.shut { grid-template-columns: minmax(0, 1fr) 34px; }
.rq-body .rq-out { padding: 0; }
.rq-side { position: sticky; top: 66px; display: grid; gap: 10px; max-height: calc(100vh - 160px); overflow: auto; padding: 8px 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.04); }
.rq-side.shut { padding: 4px 0; overflow: visible; border-color: transparent; background: none; }
.rq-side-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 2px; border: 0; background: none; color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: left; }
.rq-side-toggle .rq-side-chev { margin-left: auto; color: var(--muted); font-size: 16px; }
.rq-side.shut .rq-side-toggle { flex-direction: column; gap: 6px; padding: 8px 0; border-radius: 10px; background: rgb(var(--ink) / 0.06); }
.rq-side.shut .rq-side-toggle:hover { background: rgb(var(--ink) / 0.12); }
.rq-side.shut .rq-side-label { writing-mode: vertical-rl; color: var(--muted); font-size: 12px; font-weight: 500; }
.rq-side.shut .rq-side-chev { margin: 0; }
.rq-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; }
.rq-side .rq-controls { padding: 0; gap: 6px; }
.rq-side-h { margin: 8px 0 0; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.rq-side .rq-chips { flex-direction: column; align-items: stretch; }
.rq-side .rq-chip { justify-content: space-between; border-radius: 10px; }
.rq-side .rq-chip-text { white-space: normal; }
.rq-side .rq-chips > .btn { justify-content: center; }
.rq-side .rq-logic-row { flex-wrap: wrap; }
.rq-side .rq-logic { max-width: none; width: 100%; }
.rq-side .rq-shape { flex-direction: column; align-items: stretch; }
.rq-side .rq-shape .btn { justify-content: flex-start; }
.rq-side .rq-keep { margin: 4px 0 0; }
.rq-side .rq-scope { justify-self: stretch; display: grid; grid-template-columns: repeat(3, 1fr); }
@container (max-width: 700px) {
  .rq-body, .rq-body.shut { grid-template-columns: minmax(0, 1fr); }
  .rq-side { position: static; order: -1; max-height: none; }
  .rq-side.shut .rq-side-toggle { flex-direction: row; padding: 6px 10px; }
  .rq-side.shut .rq-side-label { writing-mode: horizontal-tb; }
  .rq-body:not(.shut) > .rq-side { width: auto; }
  .rq-side .side-grip { display: none; }
}
.rq-side .rq-scope button { min-width: 0; padding: 6px 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rq-side > * { min-width: 0; }

/* ---------- dashboards ---------- */

.db-list { padding: 16px; }
.db { min-height: 100%; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; container-type: inline-size; }
.db-name { max-width: 420px; height: 32px; font-size: 16px; font-weight: 650; }
.db-runas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 16px; }
.db-runas label { display: flex; align-items: center; gap: 8px; }
.db-runas .field { width: auto; }
/* Short rows: charts, numbers and tables span 4, 8 or 12; text only what it needs (app-dashboards.js fitText). */
.db-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 40px; gap: 12px; padding: 0 16px; }
.db-text-tile .db-tile-body { align-content: start; overflow: visible; }
.db-text-tile.heading { padding: 8px 4px 0; border-color: transparent; background: none; }
.db-text-tile.heading .db-text { font-size: 17px; }
.db-empty { grid-column: 1 / -1; padding: 30px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.db-tile { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgb(var(--ink) / 0.04); overflow: hidden; transition: opacity 0.15s; }
.db-tile.busy { opacity: 0.6; }
.db-tile.clickable { cursor: pointer; }
.db-tile.clickable:hover { border-color: rgb(var(--accent-rgb) / 0.6); }
.db-tile-head { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.db-tile-head h3 { flex: 1; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.db-tile-tools { display: flex; gap: 2px; margin-left: auto; }
.db-tile-tools .btn { padding: 2px 6px; }
.db-tile-body { flex: 1; min-height: 0; display: grid; align-content: center; overflow: auto; }
.db-text { margin: 0; white-space: pre-wrap; }
.db-text.heading { font-size: 20px; font-weight: 700; }
.db-text.body { font-size: 13px; line-height: 1.55; }
.db-metric { display: grid; justify-items: center; gap: 4px; padding: 10px; border-radius: 10px; }
.db-metric strong { font-size: 40px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.db-metric span { color: var(--muted); font-size: 12px; }
.db-metric.good { background: rgba(34, 197, 94, 0.14); color: #22c55e; }
.db-metric.mid { background: rgba(245, 158, 11, 0.14); color: #f59e0b; }
.db-metric.bad { background: rgba(239, 68, 68, 0.14); color: #ef4444; }
.db-gauge-box { display: grid; justify-items: center; gap: 2px; }
.db-gauge { width: 100%; max-width: 240px; color: var(--text); }
.db-gauge-box strong { font-size: 24px; font-weight: 750; }
.db-tile .ch-svg { max-width: none; }
@container (max-width: 760px) { .db-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .db-tile { grid-column: span 2 !important; } }
@container (max-width: 420px) { .db-grid { grid-template-columns: minmax(0, 1fr); } .db-tile { grid-column: span 1 !important; } }
.rq-matrix thead th:first-child { color: var(--muted); }
.rq-matrix tbody td:last-child, .rq-matrix thead th:last-child { border-left: 1px solid var(--line); font-weight: 650; }
.rq-matrix tbody tr { cursor: default; }

/* joined reports */
.rq-blocks { display: grid; gap: 6px; }
.rq-block-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.rq-block-tabs button { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: none; color: var(--text); font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-block-tabs button b { color: var(--muted); }
.rq-block-tabs button.on { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.18); }
.rq-block-tabs .rq-block-add { border-style: dashed; color: var(--muted); }
.rq-block-name { display: grid; gap: 4px; }
.rq-block-name .field { height: 30px; font-size: 12px; }
.rq-joined { display: grid; gap: 12px; }
.rq-acc { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.03); }
.rq-acc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.rq-acc-blocks { display: grid; gap: 10px; }
.rq-acc-block { min-width: 0; display: grid; gap: 4px; align-content: start; }
.rq-acc-block h5 { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.rq-acc-block td { cursor: pointer; }
.rp-type.joined { border-color: rgb(var(--accent-rgb) / 0.45); }
@container (max-width: 700px) { .rq-acc-blocks { grid-template-columns: minmax(0, 1fr) !important; } }

/* tabs on a record page */
.rw-tabs { margin: 4px 0 0; padding: 4px 0; }
.rw-tab-pane { display: flex; flex-direction: column; gap: 10px; }
.rw-tab-pane[hidden] { display: none; }

/* a deal's line items */
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.li-box > .kit-hint { margin-top: 6px; }

/* the board: how long a deal has sat in its stage */
.rec-card .rec-age { color: var(--muted); font-size: 11.5px; }
.rec-card .rec-age.stale { color: #d97706; font-weight: 600; }

/* History: the record's own facts above its changes */
.rw-hist .rw-facts { margin-bottom: 6px; }
.rw-hist .rw-facts .kit-mono { user-select: all; font-size: 12px; }

/* a date condition: on / before / between, then a period or a day */
.dc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dc-value { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.dc .field { width: auto; min-width: 0; }
.rec-phone { white-space: nowrap; }

/* favorites: a star beside reports, dashboards and folders */
.fav-star { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer; }
.fav-star:hover { background: rgb(var(--ink) / 0.1); color: var(--text); }
.fav-star .kit-ico svg { width: 14px; height: 14px; }
.fav-star.on { color: #f5b301; }
.fav-star.on svg { fill: currentColor; }
.rp-place.fav .kit-ico { opacity: 0.85; }
.rp-sub-wrap { display: inline-flex; align-items: center; gap: 2px; }
.rp-side { overflow-x: hidden; }
.rp-place { min-width: 0; }

/* a phone number and its extension, side by side */
.ph-pair { display: flex; gap: 6px; min-width: 0; }
.ph-pair .field:first-child { flex: 1; min-width: 0; }
.ph-pair .ph-ext, .kv.editing .kv-value .ph-pair .ph-ext { width: 68px; flex: none; }

/* Settings > Date and time */
.tz-row { display: grid; gap: 6px; max-width: 460px; }
.tz-now { margin: 12px 0 4px; font-weight: 600; }

/* editing in place: the whole field is a target, saving shows, a save glows */
.kv-click { cursor: pointer; border-radius: 8px; }
.kv-click:not(.editing):hover { background: rgb(var(--ink) / 0.05); }
.kv-click:not(.editing):hover .kv-edit { opacity: 1; }
.kv-click a, .kv-click .rec-link { cursor: pointer; }
.kv.saving { opacity: 0.6; pointer-events: none; }
.kv-error { color: #f87171; font-size: 12px; margin-top: 4px; }
.kv-error:empty { display: none; }
.kv.kv-saved { animation: kv-saved 1.6s ease-out; }
@keyframes kv-saved { 0% { background: rgb(var(--accent-rgb) / 0.28); } 100% { background: transparent; } }

/* the handle on a side panel's left edge: drag to widen or narrow it */
.side-grip { position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; z-index: 4; cursor: col-resize; touch-action: none; }
.side-grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; border-radius: 2px; background: transparent; transition: background 0.15s; }
.side-grip:hover::after, .side-grip:focus-visible::after, .side-grip.dragging::after { background: rgb(var(--accent-rgb) / 0.7); }
@container (max-width: 760px) { .rec-side .side-grip { display: none; } }

/* Related: a tab per kind of record */
.rel-tabs { margin: 0 0 8px; flex-wrap: wrap; }
.rel-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.rel-count { min-width: 18px; padding: 0 6px; border-radius: 999px; background: rgb(var(--ink) / 0.1); font-size: 11px; line-height: 18px; text-align: center; }
.rel-pane { display: grid; gap: 10px; }

/* a case on the board */
.rec-lane.kind-closed { opacity: 0.85; }
.rec-card.overdue { border-color: #d97706; }
.rec-card .rec-chip { font-style: normal; }

/* lists of reports, dashboards and folders: sortable headings, folders first */
.rp-sort button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.rp-sort.on button { color: var(--text); }
.rp-sort-dir { font-size: 9px; }
.rp-folder-row td.main { font-weight: 600; }
.rp-saveas .rp-who { margin: -2px 0 0; }

/* ---------- Collaborate: chat beside a record ---------- */
.win-body.rw-split { display: flex; overflow: hidden; }
.win-body.rw-split > .rw { flex: 1; min-width: 0; overflow: auto; }
.chat-btn { position: relative; }
.chat-btn.on { background: rgb(var(--accent-rgb) / 0.22); }
.chat-badge { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--sheet); }
.chat-badge[hidden] { display: none; }
.chat-side { position: relative; flex: none; width: var(--chat-w, 360px); max-width: 75%; min-height: 0; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: rgb(var(--panel) / 0.72); }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head h3 { font-size: 15px; font-weight: 650; }
.chat-search { margin: 8px 12px 0; width: auto; }
.chat-search[hidden] { display: none; }
.chat-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; }
.chat-list { display: flex; flex-direction: column; gap: 8px; min-height: 100%; justify-content: flex-end; }
.chat-empty { margin: auto 0; text-align: center; }
.chat-day { align-self: center; padding: 2px 10px; border-radius: 999px; background: rgb(var(--ink) / 0.08); color: var(--muted); font-size: 11px; }
.chat-new { display: flex; align-items: center; gap: 8px; color: #ef4444; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.chat-new::before, .chat-new::after { content: ""; flex: 1; height: 1px; background: rgb(239 68 68 / 0.5); }
.chat-msg { display: flex; }
.chat-msg.mine { justify-content: flex-end; }
.chat-bubble { max-width: 82%; padding: 7px 10px 8px; border-radius: 14px 14px 14px 4px; background: rgb(var(--ink) / 0.09); border: 1px solid transparent; }
.chat-msg.mine .chat-bubble { border-radius: 14px 14px 4px 14px; background: rgb(var(--accent-rgb) / 0.3); }
.chat-msg.lead .chat-bubble { border-color: rgb(245 179 1 / 0.55); box-shadow: inset 3px 0 0 rgb(245 179 1 / 0.75); }
.chat-msg.mine.lead .chat-bubble { box-shadow: inset -3px 0 0 rgb(245 179 1 / 0.75); }
.chat-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 3px; font-size: 11.5px; color: var(--muted); }
.chat-who strong { color: var(--text); font-size: 12.5px; }
.chat-who time { margin-left: auto; }
.chat-lead { color: #f5b301; font-style: normal; }
.chat-body { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-note { display: block; color: var(--muted); font-size: 12.5px; }
.chat-reviewed { margin-top: 4px; padding-left: 8px; border-left: 2px solid rgb(var(--ink) / 0.2); opacity: 0.7; }
.chat-msg.is-hidden .chat-bubble, .chat-msg.is-held .chat-bubble { background: transparent; border: 1px dashed rgb(var(--ink) / 0.25); }
.chat-tools { display: flex; gap: 10px; margin-top: 5px; }
.chat-act { padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; }
.chat-act:hover { text-decoration: underline; }
.chat-ref { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 3px; border-radius: 999px; background: rgb(var(--ink) / 0.1);
  color: var(--text); text-decoration: none; vertical-align: -3px; }
.chat-ref:hover span { text-decoration: underline; }
.chat-flash .chat-bubble { animation: chat-flash 2.2s ease-out; }
@keyframes chat-flash { 0%, 40% { box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.7); } 100% { box-shadow: none; } }
.chat-jump { position: sticky; bottom: 4px; left: 50%; transform: translateX(-50%); display: block; margin: 0 auto; padding: 5px 12px;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); cursor: pointer; }
.chat-jump[hidden] { display: none; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-compose .chat-box { flex: 1; height: auto; min-height: 42px; max-height: 160px; padding: 8px 10px; resize: vertical; }
.chat-side .rec-error { padding: 0 12px 8px; }
.chat-side .rec-error:empty { display: none; }
@container (max-width: 760px) { .win-body.rw-split > .rw { display: none; } .chat-side { width: 100%; max-width: none; } .chat-side .side-grip { display: none; } }

/* the Chat app */
.chat-table .chat-snippet { max-width: 420px; white-space: normal; }
.chat-table .nowrap { white-space: nowrap; }
.chat-pick { margin: 4px 0 8px; }
.chip.warn { background: rgb(217 119 6 / 0.2); color: #f59e0b; }
.chat-scroll:has(> .chat-jump:not([hidden])) { padding-bottom: 44px; }
.fw-card textarea.field { height: auto; min-height: 150px; padding: 8px 10px; resize: vertical; }
.fw-card .kit-inline input[type=number].field, .fw-card input[type=number].field { width: 140px; flex: none; }
.trash-table .trash-sub { display: block; }
.trash-table .nowrap { white-space: nowrap; }
.chat-pick .kit-inline { align-items: center; gap: 10px; }
.chat-pick .kit-inline .field { width: auto; min-width: 220px; flex: none; }

/* "whose": type a person or a role */
.who-pick { width: min(360px, 100%); padding-left: 32px; }
.who-pick .who-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.who-pick .who-ico svg { width: 15px; height: 15px; }
.who-pick .link-input { width: 100%; }

/* Org Settings > Notifications */
.ntf-group { display: grid; gap: 4px; }
.ntf-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; padding: 8px 0; border-top: 1px solid rgb(var(--ink) / 0.08); cursor: pointer; }
.ntf-row:first-of-type { border-top: 0; }
.ntf-row > span { display: block; }
.ntf-row strong { font-size: 13.5px; }
.ntf-row .chip { margin-left: 8px; vertical-align: 1px; }
.ntf-row small { display: block; margin-top: 2px; }
.ntf-row.later { opacity: 0.6; cursor: default; }

/* the chat box, with @tags */
.chat-composer { position: relative; flex: 1; min-width: 0; }
.chat-compose .chat-box[contenteditable] { height: auto; min-height: 42px; max-height: 160px; overflow-y: auto; padding: 9px 10px;
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; cursor: text; }
.chat-box[contenteditable]:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.chat-box.busy { opacity: 0.6; }
.chat-tag { display: inline; padding: 0 3px; border-radius: 5px; background: rgb(var(--accent-rgb) / 0.22); color: var(--text); font-weight: 600; white-space: nowrap; }
.chat-tag.me { background: rgb(245 179 1 / 0.3); }
.chat-mentions { top: auto; bottom: calc(100% + 6px); max-height: 260px; }
.chat-avatar { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgb(var(--accent-rgb) / 0.35);
  color: var(--text); font-size: 11px; font-weight: 700; }

/* Transfer: moving records between owners */
.tr-step h3 { display: flex; align-items: center; gap: 8px; }
.tr-n { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgb(var(--accent-rgb) / 0.3); font-size: 12px; }
.tr-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: start; gap: 12px; padding: 7px 0; }
.tr-row > span:first-child { padding-top: 8px; color: var(--muted); font-size: 13px; }
.tr-row .field, .tr-row .link-pick { width: 100%; max-width: 520px; }
.tr-row small.kit-hint { display: block; margin-top: 4px; }
.tr-conds { display: grid; gap: 8px; max-width: 520px; }
.tr-cond { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.tr-cond strong { font-size: 13px; }
.tr-result h3 { margin-top: 0; }
.tr-split { display: flex; flex-wrap: wrap; gap: 28px; margin: 6px 0 12px; font-size: 13px; }
.tr-error { color: #f87171; }
.tr-past-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tr-past-head > div:first-child { display: grid; gap: 3px; }
.tr-past-head .chip { justify-self: start; }
.tr-past-actions { display: flex; gap: 6px; flex: none; }
.tr-past.undone { opacity: 0.7; }
body.mobile .tr-row { grid-template-columns: 1fr; gap: 4px; }
body.mobile .tr-row > span:first-child { padding-top: 0; }

/* Call Pilot */
.cp { display: flex; flex-direction: column; min-height: 100%; container-type: inline-size; }
.cp-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px 8px; }
.cp-title { display: grid; gap: 1px; margin-right: auto; }
.cp-title strong { font-size: 15px; }
.cp-top > select.field { width: auto; height: 32px; }
.cp-someone { display: flex; gap: 8px; align-items: center; }
.cp-someone .who-pick { width: 260px; }
.cp-someone select.field { width: auto; height: 34px; }
.cp-tabs { padding: 0 12px; }
.cp-main { flex: 1; min-height: 0; padding: 14px 0 16px; }
.cp-pad { padding: 0 16px; }
.cp-main .kit-toolbar .field { flex: 0 1 260px; }
.cp-main .kit-toolbar input.field { flex: 1 1 260px; max-width: 360px; }
.stat-tiles.cp-stats { padding: 0 16px 12px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; padding: 0 16px; align-items: start; }
.cp-card { margin: 0; min-width: 0; overflow-x: auto; }
.cp-card h3 { margin-top: 0; }
.cp-card h4 { margin: 12px 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cp-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cp-card-head h3 { margin: 0; }
.cp-card-head select.field { width: auto; height: 30px; }
.cp-bar { display: block; height: 8px; border-radius: 4px; background: rgb(var(--ink) / 0.08); overflow: hidden; min-width: 60px; }
.cp-bar i { display: block; height: 100%; border-radius: 4px; background: #f59e0b; }
.cp-barcell { width: 22%; }
.cp-barcell .cp-bar { min-width: 36px; }
.cp-rank { display: grid; gap: 2px; }
.cp-rank-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 1.2fr) auto; align-items: center; gap: 10px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.cp-rank-row:hover { background: rgb(var(--ink) / 0.08); }
.cp-rank-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cp-pairs { display: flex; gap: 28px; }
.cp-pairs div { display: grid; }
.cp-pairs strong { font-size: 22px; }
.cp-chips { display: flex; gap: 6px; padding: 8px 16px 0; }
.cp-chips:empty { display: none; }
.cp-list { padding-top: 8px; }
.cp-list .mini-scroll { padding: 0 16px; }
.cp-table tr.cp-group td { padding-top: 14px; border-bottom-color: var(--line); background: none; }
.cp-late { color: #f87171; font-weight: 650; }
.cp-today { color: #f59e0b; font-weight: 650; }
.cp-never { background: rgb(245 158 11 / 0.18); color: #f59e0b; }
.cp-route p { max-width: 640px; }
.cp-days { width: 90px !important; flex: none; }
.cp-freq { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cp-freq > .field:first-child { flex: 1; max-width: 340px; }
.fs-seen { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
@container (max-width: 560px) { .cp-someone .who-pick { width: 100%; } .cp-someone { flex: 1 1 100%; } }

/* Summary tiles (CRMUI.statTile): a row of headline numbers above a list.
   Every tile has the same rows (label, number, bar, note), so the numbers
   line up across the row whether or not a tile has a bar or a note. */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stat-tile { position: relative; display: grid; grid-template-rows: auto auto 6px auto; align-content: start; gap: 3px; min-width: 0;
  padding: 11px 14px 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgb(var(--ink) / 0.04);
  color: var(--text); font: inherit; text-align: left; overflow: hidden; }
.stat-tile::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: rgb(var(--ink) / 0.14); }
.stat-label, .stat-note { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-meter { grid-row: 3; align-self: center; height: 5px; border-radius: 3px; background: rgb(var(--ink) / 0.1); overflow: hidden; }
.stat-meter i { display: block; height: 100%; border-radius: 3px; background: rgb(var(--accent-rgb) / 0.85); }
.stat-note { grid-row: 4; color: var(--muted); font-size: 12px; }
.stat-tile.good::before, .stat-tile.good .stat-meter i { background: #22c55e; }
.stat-tile.good .stat-value { color: #22c55e; }
.stat-tile.warn::before, .stat-tile.warn .stat-meter i { background: #f59e0b; }
.stat-tile.warn .stat-value { color: #f59e0b; }
.stat-tile.bad::before, .stat-tile.bad .stat-meter i { background: #ef4444; }
.stat-tile.bad .stat-value { color: #ef4444; }
.stat-tile.go { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.stat-tile.go:hover, .stat-tile.go:focus-visible { border-color: rgb(var(--accent-rgb) / 0.6); background: rgb(var(--ink) / 0.07); outline: none; }
.stat-go { position: absolute; top: 9px; right: 11px; color: var(--muted); font-size: 16px; line-height: 1; opacity: 0; transition: opacity 0.12s; }
.stat-tile.go:hover .stat-go, .stat-tile.go:focus-visible .stat-go { opacity: 1; }
@container (max-width: 560px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-value { font-size: 22px; } }
:root[data-theme="light"] .stat-tile.good .stat-value { color: #15803d; }
:root[data-theme="light"] .stat-tile.warn .stat-value { color: #b45309; }
:root[data-theme="light"] .stat-tile.bad .stat-value { color: #dc2626; }

/* Call Pilot, more */
.cp-num { padding: 0 4px; border: 0; border-radius: 5px; background: none; color: var(--accent, #5b8def); font: inherit; font-weight: 650; cursor: pointer; }
.cp-num:hover { background: rgb(var(--accent-rgb) / 0.14); text-decoration: underline; }
.cp-pairs .cp-num { font-size: 22px; padding: 0; }
.cp-spacer { flex: 1; }
.cp-table td.cp-pick { width: 28px; padding-right: 0; }
.cp-focus { margin-left: 5px; color: #f59e0b; }
.cp-prospect { margin-left: 6px; }
.cp-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; max-width: 320px; }
.cp-contact .chip { font-size: 11px; }
.cp-stops { display: grid; gap: 12px; min-width: 0; }
.cp-start { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.cp-stop-list { display: grid; gap: 4px; margin: 0; padding-left: 22px; }
.cp-stop-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 4px; }
.cp-stop-text { display: grid; min-width: 0; }
.cp-stop-text small { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cp-focus-list { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cp-focus-item { font-size: 13px; color: var(--text); }

/* Call Pilot: book size against a practical day */
.cp-load { cursor: default; }
.cp-load.good .cp-bar i { background: #22c55e; }
.cp-load.warn .cp-bar i { background: #f59e0b; }
.cp-load.bad .cp-bar i { background: #ef4444; }
.cp-role-targets { display: grid; gap: 6px; justify-items: start; }
.cp-role-targets select.field { width: 240px; }
.cp-sub { margin: 12px 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cp-card .mini-table td.main { white-space: normal; max-width: 160px; }
.cp-card .mini-table th, .cp-card .mini-table td { padding-left: 6px; padding-right: 6px; }

/* Transfer: picking the kinds that move */
.tr-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-kind { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tr-kind.on { border-color: rgb(var(--accent-rgb) / 0.7); background: rgb(var(--accent-rgb) / 0.12); }
.tr-kind span { display: grid; line-height: 1.2; }
.tr-kind small { color: var(--muted); font-size: 11px; }
.tr-sub { margin: 10px 0 2px; font-size: 12px; color: var(--muted); font-weight: 600; }

/* Org Settings > Sign-in providers */
.sso-providers { display: grid; gap: 10px; }
.sso-redirect { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sso-redirect code { padding: 4px 8px; border-radius: 6px; background: rgb(var(--ink) / 0.08); font-size: 12px; overflow-wrap: anywhere; }
.sso-provider { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.sso-provider summary { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.sso-provider .kit-hint { margin: 8px 0; }
.sso-field { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: center; gap: 10px; margin: 6px 0; }
.sso-field .field { max-width: 460px; }
body.mobile .sso-field { grid-template-columns: 1fr; gap: 4px; }

/* A choice of two or three ways, each with a line of explanation (radio buttons) */
.kit-choice { display: grid; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.kit-choice legend { padding: 0 4px; color: var(--muted); font-size: 12px; }
.kit-choice label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; cursor: pointer; }
.kit-choice label input { margin-top: 3px; }
.kit-choice label span { display: grid; gap: 2px; }

/* Org Settings > Bulk Import */
.bi { display: grid; gap: 12px; margin-top: 12px; }
.bi-steps { display: grid; gap: 12px; }
.bi-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bi-headers { margin-bottom: 10px; }
.bi-map select.field { min-width: 220px; }
.bi-examples { color: var(--muted); max-width: 320px; }
.bi-flags { display: grid; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid rgb(245 158 11 / 0.5); border-radius: 10px; }
.bi-flag h4 { margin: 0 0 6px; font-size: 13px; }
.bi-flag-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 320px); align-items: center; gap: 10px; padding: 3px 0; }
.bi-rows { margin-top: 12px; max-height: 360px; }
.bi-why { white-space: normal !important; max-width: 420px; color: var(--muted); }
.chip.bi-match { background: rgb(245 158 11 / 0.18); color: #f59e0b; }
.chip.bi-problem, .chip.bi-repeat { background: rgb(239 68 68 / 0.18); color: #ef4444; }
.bi-fails { margin: 6px 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.bi-passwords { flex-wrap: wrap; }
.bi-past { padding: 8px 0; border-top: 1px solid var(--line); }
.bi-past:first-child { border-top: 0; }
.bi-past.undone { opacity: 0.6; }

.tr-narrow { margin-top: 6px; }
.tr-narrow summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }

/* A person's page: buttons at the top right, as on a record */
.user-head-actions { display: flex; gap: 6px; margin-left: auto; margin-right: 6px; }

/* Logged in as someone else: a strip across the top, the desktop below it */
#acting-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 10000; height: 30px; display: flex; align-items: center; justify-content: center;
  gap: 14px; background: #b45309; color: #fff; font-size: 13px; font-weight: 600; }
#acting-banner button { padding: 3px 10px; border: 1px solid rgb(255 255 255 / 0.6); border-radius: 6px; background: rgb(255 255 255 / 0.14);
  color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
#acting-banner button:hover { background: rgb(255 255 255 / 0.26); }
body.acting #desktop { top: 30px; }

/* Org Settings > Storage */
.st { display: grid; gap: 12px; }
.st-tiles { margin: 4px 0; }
.st-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.st-share { width: 22%; min-width: 90px; }

/* Roles › Members: the people in a role as a table */
.rm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rm-head h4 { margin: 0; }
.rm-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 8px; background: rgb(var(--ink) / 0.06); }
.rm-bulk[hidden] { display: none; }
.rm-link { padding: 0; border: 0; background: none; color: var(--accent, #6366f1); font: inherit; text-decoration: underline; cursor: pointer; }
.rm-table tbody tr { cursor: default; }
.rm-table td { white-space: normal; vertical-align: middle; }
.rm-table td.main strong, .rm-table td.main small { display: block; }
.rm-table td.main .chip { margin-left: 6px; font-weight: 500; }
.rm-table .rm-tick { width: 28px; padding-right: 0; }
.rm-table .chips { gap: 4px; }
.rm-table .rm-role { border: 0; font: inherit; font-size: 12px; cursor: pointer; }
.rm-table .rm-role:hover { text-decoration: underline; }
.rm-table tr.rm-gone td { opacity: 0.55; }
.rm-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.rm-move { width: auto; max-width: 160px; padding-top: 3px; padding-bottom: 3px; font-size: 12px; }

/* A field's own Formula section; locked when built in */
.fw-formula h3 .icon, .fw-formula h3 svg { width: 15px; height: 15px; vertical-align: -2px; opacity: 0.7; }
.fw-formula-text { margin: 0 0 8px; line-height: 1.5; }
.fw-formula-expr { margin: 0 0 8px; padding: 8px 10px; border-radius: 8px; background: rgb(var(--ink) / 0.06); white-space: pre-wrap; word-break: break-word; }

/* Users: a person in a window of their own */
.user-page { display: grid; gap: 12px; max-width: 720px; margin: 0 auto; padding: 16px; }
.user-page > .kit-panel { position: static; max-height: none; }

/* Users: deleted people, and the caution before deleting */
.users-deleted { margin-top: 12px; }
.users-deleted summary { cursor: pointer; }
.users-deleted .kit-list { margin-top: 10px; }
.users-caution { margin: 0; color: #f59e0b; font-weight: 600; }

/* Bulk Import › Users: removing people */
.bi-purge { margin-top: 12px; }
.bi-removal { margin: 10px 0; padding: 10px 12px; border: 1px solid rgb(245 158 11 / 0.45); border-radius: 10px; background: rgb(245 158 11 / 0.08); }
.bi-removal h4 { margin: 0 0 8px; }

/* Record lists: whose records (Mine / My team / Everyone's) */
.rec-scope { width: auto; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }

/* Roles › List views */
.rl-lists { display: grid; gap: 8px; }
.rl-list { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 12px; }
@media (max-width: 560px) { .rl-list { grid-template-columns: 1fr; gap: 4px; } }

/* Transfer › What moves: Select all above the kinds */
.tr-kinds-head { display: flex; justify-content: flex-end; margin-bottom: -4px; }

/* Users: kinds of user */
.chip.user-kind { margin-left: 6px; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.user-kinds label { align-items: flex-start; }
.fw-several { color: #f59e0b; }

/* A user's profile record: the Access and sign-in section */
.user-access .kit-notice { margin-bottom: 10px; }
.user-access .user-kind-note { margin: 6px 0 2px; }
.user-access .kit-inline { margin-top: 8px; }

/* A report cell naming several records: each name is its own link */
.rec-links .rec-link { display: inline; max-width: none; vertical-align: baseline; }
