/* CCYFX sales demo: small layout helpers on top of the Fidarion (HPT portal) components.
   Tokens only: every colour, size and space comes from tokens.css. Square corners, no new shadows. */
body { background: var(--f-stone); color: var(--f-ink); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 25; background: var(--f-white); }
.f-app { min-height: 100vh; }
.f-topbar { top: env(safe-area-inset-top, 0px); }
.f-sidebar { top: env(safe-area-inset-top, 0px); }
.f-content { margin: 0 auto; }

.x-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.x-stack-sm { display: flex; flex-direction: column; gap: 10px; }
.x-mt { margin-top: var(--f-s3); }
.x-mt0 { margin-top: 0; margin-bottom: 0; }
.x-mla { margin-left: auto; flex: none; }
.x-px { padding: 0 var(--f-s4) var(--f-s3); }
.x-right { text-align: right; }
.x-small { font-size: var(--f-fs-11); }
.x-minw { min-width: 0; }
.x-rel { position: relative; }
.x-pop { right: 0; top: calc(100% + 6px); }
.x-pop [role="menuitem"] .f-initials { margin-right: 2px; }
.x-sub { margin: 4px 0 0; font-size: var(--f-fs-13); }

/* Top bar search */
.x-search-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.x-search-label svg { width: 16px; height: 16px; flex: none; }
.x-search { display: flex; flex-direction: column; gap: 10px; min-height: 280px; }
.f-search-results.x-static { position: static; box-shadow: none; border: 1px solid var(--f-rule); max-height: 52vh; overflow-y: auto; }
.f-search-results a span { min-width: 0; }
@media (max-width: 859px) { .x-hide-phone { display: none; } .f-search-btn kbd { display: none; } .f-topbar .f-btn { padding: 0 10px; } }

/* Forms inside modals already have the modal's padding. */
.f-form-grid.x-nopad { padding: 0; }
.x-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1099px) { .x-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 859px) { .x-grid-4 { grid-template-columns: minmax(0, 1fr); } }
.x-copybox { min-height: 260px; font-family: var(--f-mono); font-size: var(--f-fs-12); }
.x-drawer-scrim { display: block; }

/* Lists */
.x-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: var(--f-fs-13); color: var(--f-body); }
.x-list.is-warn li::marker { color: var(--f-warn); }
.x-people { list-style: none; margin: 0; padding: 4px 14px; display: grid; }
.x-people li { padding: 8px 0; border-top: 1px solid var(--f-rule-soft); }
.x-people li:first-child { border-top: 0; }
.x-quote { margin: 6px 0 0; padding: 10px 12px; border-left: 2px solid var(--f-gold); background: var(--f-stone-2); color: var(--f-body); }
.x-faq { margin: 0; display: grid; gap: 4px; }
.x-faq dt { font-weight: 600; color: var(--f-ink); margin-top: 10px; }
.x-faq dt:first-child { margin-top: 0; }
.x-faq dd { margin: 0; color: var(--f-body); font-size: var(--f-fs-13); }
.x-brief-1 { grid-template-columns: minmax(0, 1fr) !important; }

/* Record page */
.x-inline { display: inline-flex; min-width: 180px; }
.x-stagerow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.x-stagerow .f-stagebar { margin: 0; }
.x-progress { height: 6px; }
.x-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: var(--f-fs-13); color: var(--f-muted); }
.x-steps li.is-done { color: var(--f-good); }
.x-steps li.is-now { color: var(--f-ink); font-weight: 600; }

/* Pipeline board */
.x-board { grid-auto-columns: minmax(220px, 1fr); }
.x-board .f-lane { min-width: 0; }
.x-lane-hint { margin: 0; font-size: var(--f-fs-11); color: var(--f-muted); }
.x-lane-empty { margin: 0; padding: 18px 8px; text-align: center; font-size: var(--f-fs-11); color: var(--f-muted); border: 1px dashed var(--f-rule-strong); }
.f-dealcard .f-link-plain { color: var(--f-ink); text-decoration: none; }
.f-dealcard .f-link-plain:hover { text-decoration: underline; }
.f-link-plain { color: inherit; text-decoration: none; }
.f-link-plain:hover { text-decoration: underline; }

/* Playbook cards */
.x-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.x-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.x-card:hover { border-color: var(--f-rule-strong); }
.x-card-text { font-size: var(--f-fs-13); color: var(--f-body); }
.x-card-foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.x-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1099px) { .x-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .x-flow { grid-template-columns: minmax(0, 1fr); } }

/* Proposal calculator */
.x-total { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: baseline; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--f-navy); }
.x-total > :nth-child(even) { text-align: right; }
@media (min-width: 1100px) { .x-sticky-col { position: sticky; top: calc(var(--f-topbar-h) + 16px); align-self: start; } }
.x-card-foot .f-chip { white-space: normal; }

/* The menu button is for phones only (fidarion-app.css sets .f-iconbtn after .f-menu-btn). */
@media (min-width: 860px) { .f-topbar .f-menu-btn { display: none; } }
/* Phone top bar: the search box shrinks instead of pushing New and the avatar off screen. */
.f-topbar-search, .f-search-btn { min-width: 0; }
.f-search-btn { overflow: hidden; }
.x-search-label > span { overflow: hidden; text-overflow: ellipsis; }
.f-search-btn kbd { white-space: nowrap; flex: none; }
/* The signed-in person's badge on the navy sidebar: gold, so it reads in both themes. */
.f-sb-user .f-initials { background: var(--f-gold); color: var(--f-navy-deep); }

/* CRM (real data) additions, 4 Nov 2026 */
.x-plain { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.x-plain:hover { text-decoration: underline; }
.x-inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.x-inline-form .f-input { width: auto; }
.x-row-gap { padding-bottom: 0; }
.x-floor { min-width: 110px; max-width: 160px; }
.f-form-grid > .f-check.full { grid-column: 1 / -1; }
.x-tracker td .f-chip { white-space: normal; }
.x-tracker td:first-child, .x-tracker th:first-child { min-width: 250px; }
.x-tracker td:last-child .f-chip, .x-tracker td.num { white-space: nowrap; }
.f-table td > .f-select { min-width: 190px; }

/* Toasts: Undo / Redo button and a close cross */
.f-toast-btn { background: none; border: 0; padding: 2px 0; color: var(--x-red-sidebar, #FF6B75); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.f-toast-btn:hover, .f-toast-btn:focus-visible { color: var(--f-white); }
.f-toast-x { background: none; border: 0; padding: 0; margin-left: -4px; width: 18px; height: 18px; color: var(--f-on-navy-muted, rgba(255,255,255,.7)); cursor: pointer; display: grid; place-items: center; }
.f-toast-x svg { width: 14px; height: 14px; }
.f-toast-x:hover { color: var(--f-white); }

/* Profile photos inside the initials circles */
.f-initials.has-photo { position: relative; overflow: hidden; background: var(--f-stone); }
.f-initials.has-photo .f-avatar-img, .f-avatar.has-photo .f-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }

/* ---------- Click-to-edit (HPT pattern: dashed underline, italic when empty) ---------- */
.x-ie { all: unset; cursor: text; border-bottom: 1px dashed transparent; overflow-wrap: break-word; white-space: pre-wrap; max-width: 100%; }
.x-ie:hover { border-bottom-color: var(--f-rule-strong); background: var(--f-stone); }
.x-ie:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 2px; }
.x-ie.is-empty { color: var(--f-muted); font-style: italic; border-bottom-color: var(--f-rule); }
.num .x-ie { text-align: right; }
.x-ie-edit { display: inline-flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; min-width: 140px; }
.x-ie-edit .f-input, .x-ie-edit .f-select, .x-ie-edit .f-textarea { width: 100%; min-height: 30px; }
td.num .x-ie-edit { min-width: 110px; }
.f-task-title.x-ie { cursor: text; font-weight: 500; color: var(--f-ink); white-space: normal; }
.f-task.is-done .f-task-title.x-ie { text-decoration: line-through; color: var(--f-muted); }
.f-task-text > .x-ie-edit { margin-bottom: 4px; }
.x-wide { min-width: 220px; }

/* Label / value rows on record pages */
.x-kvs { margin: 0; display: grid; gap: 10px; }
.x-kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; align-items: start; }
.x-kv dt { font-family: var(--f-mono); font-size: var(--f-fs-11); letter-spacing: .06em; text-transform: uppercase; color: var(--f-muted); padding-top: 3px; }
.x-kv dd { margin: 0; min-width: 0; }
@media (max-width: 599px) { .x-kv { grid-template-columns: 1fr; gap: 2px; } }

/* Row "More actions" menus open below the button, right-aligned */
.x-rel > .f-menu.x-pop { right: 0; top: calc(100% + 4px); max-height: 70vh; overflow-y: auto; }
td.x-rel { position: relative; width: 36px; }
.x-kebab svg { width: 18px; height: 18px; }

/* Tasks */
.x-taskboard { padding: 0; }
.f-task-group.is-drop { outline: 2px dashed var(--f-gold); outline-offset: -4px; }
.x-drop-hint { margin: 0; padding: 10px 16px; color: var(--f-muted); font-size: var(--f-fs-13); }
.f-task.is-dragging, .f-dealcard.is-dragging, tr.is-dragging { opacity: .4; }
.f-task[draggable="true"] { cursor: grab; }
.x-owner { display: inline-grid; place-items: center; border-radius: 50%; }
.x-owner:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--f-rule-strong); }
.x-pad-sm { padding: 10px 14px; }
.x-quick { padding: 0; }
.x-quick .f-input:first-child { min-width: 200px; }
.f-task-notes .f-note { background: var(--f-white); }
.x-note-form { display: grid; gap: 6px; position: relative; }
.x-mention { position: absolute; z-index: 45; left: 0; bottom: calc(100% - 40px); max-height: 240px; overflow-y: auto; }
.x-mention [role="menuitem"].is-sel { background: var(--f-stone); }

/* Activity timeline (HPT EngagementTimeline) */
.x-acts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 0; }
.x-act { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--f-rule-soft); }
.x-act:first-child { border-top: 0; }
.x-act-ic { width: 28px; height: 28px; display: grid; place-items: center; background: var(--f-stone); color: var(--f-ink); font-size: 14px; }
.x-act-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.x-act-top small { margin-left: auto; color: var(--f-muted); font-size: var(--f-fs-11); }
.x-act-text { margin-top: 2px; font-size: var(--f-fs-14); }
.x-act-tools { display: flex; gap: 2px; opacity: .55; }
.x-act:hover .x-act-tools, .x-act-tools:focus-within { opacity: 1; }
.x-act.is-pinned .x-act-ic { background: var(--f-gold); color: var(--f-navy); }
.x-pinned { border: 1px solid var(--f-rule); background: var(--f-stone); padding: 6px 12px; margin-bottom: 12px; }
.x-logform { display: grid; gap: 8px; border-top: 1px solid var(--f-rule); padding-top: 14px; position: relative; }
.x-segl { position: relative; }
.x-segl input { position: absolute; opacity: 0; pointer-events: none; }
.x-segl span { display: inline-block; padding: 6px 12px; cursor: pointer; font-size: var(--f-fs-13); }
.x-segl input:checked + span { background: var(--f-navy); color: var(--f-white); }
.x-segl input:focus-visible + span { outline: 2px solid var(--f-focus); }

/* People on a client */
.x-people li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.x-people-main { min-width: 0; }

/* Pipeline card extras */
.x-prob { display: block; height: 3px; background: var(--f-rule); }
.x-prob i { display: block; height: 100%; background: var(--f-navy); }
.x-stale { color: var(--f-warn); }

/* Call order: drag handle */
.x-grip { display: inline-grid; vertical-align: middle; margin-right: 4px; color: var(--f-muted); cursor: grab; }
.x-grip svg { width: 14px; height: 14px; }
tr.is-drop td { box-shadow: inset 0 2px 0 var(--f-gold); }

/* Settings */
.x-tabbody { display: grid; gap: 16px; margin-top: 16px; }
.x-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.x-photo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.f-initials.x-photo-big { width: 96px; height: 96px; font-size: 32px; }
.x-photo-btn { position: relative; display: inline-grid; border-radius: 50%; }
.x-photo-btn:hover { text-decoration: none; }
.x-photo-cam { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; display: grid; place-items: center; background: var(--f-white); border: 1px solid var(--f-rule-strong); border-radius: 50%; color: var(--f-ink); }
.x-photo-cam svg { width: 12px; height: 12px; }
.x-photo-preview { display: grid; justify-items: center; gap: 10px; }
.x-photo-preview img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; }
.f-btn svg { width: 16px; height: 16px; }

/* Search boxes in toolbars, notifications */
.x-search-in { min-width: 240px; }
.x-bell { position: relative; }
.f-notes .f-empty.x-tight { padding: 18px 14px; }
.f-notes .f-note span { color: var(--f-body); }
.f-btn.sm { min-height: 30px; padding: 0 10px; font-size: var(--f-fs-13); }
.f-panel-body > .f-radio + .f-radio { margin-left: 18px; }
.x-edit-table td { vertical-align: top; }
.x-edit-table td .f-select { min-width: 170px; }

/* ---------- Will's three records (5 Nov 2026) ---------- */
/* Record page: details left, timeline in the middle, linked records right. On a narrow screen:
   header, then timeline, then details and linked records. */
.x-rec { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.6fr) minmax(240px, .9fr); grid-template-areas: "left mid right"; gap: 16px; align-items: start; }
.x-rec-left { grid-area: left; display: grid; gap: 16px; min-width: 0; }
.x-rec-mid { grid-area: mid; min-width: 0; }
.x-rec-right { grid-area: right; display: grid; gap: 16px; min-width: 0; }
@media (max-width: 1279px) { .x-rec { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); grid-template-areas: "mid left" "mid right"; } }
@media (max-width: 899px) { .x-rec { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mid" "left" "right"; } }
.x-rec .x-kv { grid-template-columns: 128px minmax(0, 1fr); }
.x-head-fig { font-family: var(--f-mono); color: var(--f-ink); font-weight: 600; }
.f-page-desc .f-person { vertical-align: middle; display: inline-flex; }
.f-page-desc .f-iconbtn { vertical-align: middle; }

/* Stage bar: click a stage to move the deal; Close won / Close lost on the right. */
.x-stagebar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin: 0 0 8px; }
.x-stage { all: unset; box-sizing: border-box; cursor: pointer; text-align: center; padding: 8px 6px; font-size: var(--f-fs-12); background: var(--f-white); border: 1px solid var(--f-rule); color: var(--f-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-stage:hover { border-color: var(--f-rule-strong); color: var(--f-ink); }
.x-stage:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 1px; }
.x-stage.is-past { background: var(--f-stone-2); color: var(--f-ink); }
.x-stage.is-current { background: var(--f-navy); border-color: var(--f-navy); color: var(--f-white); font-weight: 600; }
.x-stageinfo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; font-size: var(--f-fs-13); }
.x-closebtns { margin-left: auto; display: inline-flex; gap: 8px; }
.f-btn.x-won { background: var(--f-good); border-color: var(--f-good); color: var(--f-white); }
@media (max-width: 899px) { .x-stagebar { grid-template-columns: repeat(3, minmax(0, 1fr)); } .x-stage { min-height: 44px; display: grid; place-items: center; } .x-closebtns { margin-left: 0; width: 100%; } .x-closebtns .f-btn { flex: 1; min-height: 44px; } }

/* Composer: Note, Call, Email, Meeting, Task */
.x-composer { border: 1px solid var(--f-rule); background: var(--f-white); margin-bottom: 14px; }
.x-ctabs { display: flex; border-bottom: 1px solid var(--f-rule); overflow-x: auto; }
.x-ctabs button { all: unset; cursor: pointer; padding: 9px 14px; font-size: var(--f-fs-13); color: var(--f-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.x-ctabs button[aria-selected="true"] { color: var(--f-ink); border-bottom-color: var(--f-navy); font-weight: 600; }
.x-ctabs button:focus-visible { outline: 2px solid var(--f-focus); outline-offset: -2px; }
.x-cbody { display: grid; gap: 8px; padding: 12px; position: relative; }
.x-cbody .f-form-row { flex-wrap: wrap; }
.x-also { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.x-also legend { font-family: var(--f-mono); font-size: var(--f-fs-11); letter-spacing: .06em; text-transform: uppercase; color: var(--f-muted); margin-bottom: 4px; padding: 0; }
.x-also .f-check { font-size: var(--f-fs-13); }

/* Timeline filter and items */
.x-tl-filter { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.x-tl-f { all: unset; cursor: pointer; padding: 4px 10px; font-size: var(--f-fs-12); border: 1px solid var(--f-rule); color: var(--f-muted); background: var(--f-white); }
.x-tl-f span { font-family: var(--f-mono); margin-left: 4px; }
.x-tl-f[aria-pressed="true"] { background: var(--f-navy); border-color: var(--f-navy); color: var(--f-white); }
.x-tl-f:focus-visible { outline: 2px solid var(--f-focus); }
.x-act-also { display: block; margin-top: 4px; color: var(--f-muted); font-size: var(--f-fs-11); }
.x-act.is-deleted { opacity: .6; }
.x-act.is-deleted .x-act-top b { font-weight: 500; font-style: italic; }
.x-act-tools .is-on { color: var(--f-navy); opacity: 1; }
.x-pre { white-space: pre-wrap; overflow-wrap: break-word; }
.x-hist { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.x-hist p { margin: 4px 0 0; }

/* Linked records on the right */
.x-minis { list-style: none; margin: 0; padding: 4px 14px; display: grid; }
.x-mini { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--f-rule-soft); font-size: var(--f-fs-13); }
.x-mini:first-child { border-top: 0; }
.x-mini > span:first-child, .x-mini > a { min-width: 0; overflow-wrap: anywhere; }
.x-mini-sub { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.x-mini .f-iconbtn svg { width: 16px; height: 16px; }
.x-tagx { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px 4px 0; padding-left: 6px; border: 1px solid var(--f-rule); background: var(--f-stone); font-size: var(--f-fs-13); }
.x-addsel { display: block; }
.x-addsel .f-select { min-width: 0; width: 100%; max-width: 240px; min-height: 30px; font-size: var(--f-fs-13); }
.f-chip.muted { color: var(--f-muted); }

/* Deals: saved views, board cards, close drop zones, bulk bar, sortable headers */
.x-views { margin-bottom: 12px; overflow-x: auto; }
.x-views .f-count { margin-left: 6px; font-family: var(--f-mono); font-size: var(--f-fs-11); color: var(--f-muted); }
.f-seg button svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.x-board { grid-auto-columns: minmax(160px, 1fr); grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: 8px; }
.x-dcard { display: grid; gap: 4px; cursor: pointer; padding: 10px 12px; }
.x-dcard:hover { border-color: var(--f-rule-strong); }
.x-dcard:focus-visible { outline: 2px solid var(--f-focus); outline-offset: 1px; }
.x-dcard-name { font-size: var(--f-fs-13); line-height: 1.3; color: var(--f-ink); overflow-wrap: anywhere; }
.x-dcard-who { font-size: var(--f-fs-12); color: var(--f-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-dcard-money { display: flex; justify-content: space-between; font-size: var(--f-fs-12); font-variant-numeric: tabular-nums; }
.x-dcard-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; font-size: var(--f-fs-11); color: var(--f-muted); }
.x-dcard-next { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-dcard-next.is-late { color: var(--f-warn); }
.x-closezones { display: none; position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; gap: 12px; }
body.is-dragging-deal .x-closezones { display: flex; }
.x-closezone { padding: 18px 28px; font-weight: 600; border: 2px dashed; background: var(--f-white); box-shadow: var(--f-shadow-float); }
.x-closezone.is-won { border-color: var(--f-good); color: var(--f-good); }
.x-closezone.is-lost { border-color: var(--f-muted); color: var(--f-muted); }
.x-closezone.is-drop { background: var(--f-stone-2); }
.f-lane.is-drop { outline: 2px dashed var(--f-gold); outline-offset: -4px; }
.x-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 10px; background: var(--f-navy); color: var(--f-white); }
.x-bulk .f-select { min-height: 32px; }
.x-bulk .f-link, .x-bulk .f-help { color: var(--f-on-navy-muted, rgba(255,255,255,.75)); }
.x-bulk-move { display: inline-flex; align-items: center; gap: 8px; }
.x-sort { all: unset; cursor: pointer; font: inherit; color: inherit; }
.x-sort:hover { text-decoration: underline; }
.x-sort:focus-visible { outline: 2px solid var(--f-focus); }
th.num .x-sort { text-align: right; }
.f-table td.num, .f-table th.num { font-variant-numeric: tabular-nums; }

/* Saved mark in the top bar */
.x-saved { font-size: var(--f-fs-12); color: var(--f-muted); white-space: nowrap; }
.x-saved::before { content: "✓ "; color: var(--f-good); }
.x-saved[data-state="saving"]::before { content: "… "; color: var(--f-muted); }
.x-saved[data-state="failed"] { color: var(--f-warn); }
.x-saved[data-state="failed"]::before { content: "! "; color: var(--f-warn); }
@media (max-width: 859px) { .x-saved { display: none; } .x-saved[data-state="failed"] { display: inline; } }

.x-owner-inline { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.x-quick .f-select, .x-rec .f-form-row .f-select { min-width: 0; max-width: 100%; }
.x-quick select[name="deal"] { flex: 1 1 160px; width: 160px; }
.x-rec-right .f-form-row { flex-wrap: wrap; }
.x-rec-right .f-form-row > .f-select:first-child { flex: 1 1 100%; width: 100%; }

/* ---------- Phase 2 (Will's brief): attention, gates, side panel, onboarding file, phone ---------- */
/* Colour rules: red is the one main action; amber means needs attention; green won; grey lost. Delete and
   archive are ink, never red or amber. */
.f-btn.danger { background: var(--f-white); color: var(--f-ink); border-color: var(--f-rule-strong); }
.f-btn.danger:hover { background: var(--f-stone); }
.f-btn.danger.solid { background: var(--f-ink); color: var(--f-white); border-color: var(--f-ink); }
.f-menu [role="menuitem"].danger { color: var(--f-ink); }
.x-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--f-warn); margin-right: 6px; vertical-align: 1px; flex: none; }
.x-warn-text { color: var(--f-warn); }
.x-dcard.is-attention { border-left: 3px solid var(--f-warn); padding-left: 10px; }
.x-more { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.f-toolbar-left { flex-wrap: wrap; }
.x-filter { flex: 0 0 auto; min-width: 0; }
.x-filter .f-select { width: auto; max-width: 190px; }
.x-phone-lane { display: none; }
.x-gates { margin: 0 0 12px; padding-left: 18px; display: grid; gap: 6px; }
.x-hist-sm { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--f-fs-13); }
.x-num-in { width: 72px; flex: none; }
.f-table tr.is-archived td { color: var(--f-muted); }
.x-temp { font-size: 18px; letter-spacing: .06em; color: var(--f-ink); user-select: all; }
.x-tight { margin: 0 0 12px; }
.x-attention { border-color: var(--f-warn-line); }

/* Onboarding file: a checklist on the company */
.x-obfile { list-style: none; margin: 0; padding: 4px 0; }
.x-obfile li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 16px; border-bottom: 1px solid var(--f-rule-soft); }
.x-obfile li:last-child { border-bottom: 0; }
.x-obfile li small { margin-left: 8px; }
.x-obfile li.is-done b { color: var(--f-good); }

/* Side panel: key facts, the latest three items and a quick note, without leaving the list */
.x-peek { position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--f-white); border-left: 1px solid var(--f-rule); box-shadow: var(--f-shadow-modal); }
.x-peek[hidden] { display: none; }
.x-peek-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--f-rule); }
.x-peek-head h2 { margin: 2px 0 0; font: 400 var(--f-fs-22)/1.2 var(--f-display); color: var(--f-ink); overflow-wrap: anywhere; }
.x-peek-body { overflow-y: auto; padding: 14px 18px; }
.x-peek-body .x-kv { grid-template-columns: 110px minmax(0, 1fr); }
.x-peek-note { margin: 14px 0; display: grid; gap: 8px; }
.x-peek-sub { margin: 16px 0 6px; font: 600 var(--f-fs-11)/1 var(--f-sans); text-transform: uppercase; letter-spacing: .08em; color: var(--f-muted); }
.x-peek-foot { padding: 12px 18px; border-top: 1px solid var(--f-rule); display: flex; justify-content: flex-end; }
body.has-peek .f-main { margin-right: 0; }

/* First login: choose your own password */
.x-first { display: grid; place-items: center; min-height: 60vh; }
.x-first-card { width: min(460px, 100%); }

/* Bottom bar: phone only */
.x-bottombar { display: none; }

@media (max-width: 859px) {
  /* Buttons and controls at least 44 px tall, so they are easy to hit with a thumb */
  .f-btn, .f-btn.sm, .f-seg button, .f-tabs [role="tab"], .x-ctabs [role="tab"], .x-tl-f, .f-select, .f-input { min-height: 44px; }
  .f-iconbtn, .f-iconbtn.sm { width: 44px; height: 44px; }
  .x-ie { min-height: 36px; }
  /* The board shows one stage at a time, picked above it */
  .x-phone-lane { display: block; margin-bottom: 10px; }
  .x-phone-lane .f-select { width: 100%; }
  .x-board { grid-template-columns: minmax(0, 1fr); grid-auto-columns: minmax(0, 1fr); overflow: visible; }
  .x-board .f-lane { display: none; }
  .x-board .f-lane.is-phone-current { display: block; }
  .x-closezones { display: none !important; }
  .x-filter { flex: 1 1 140px; }
  .x-filter .f-select { width: 100%; max-width: none; }
  /* Bottom bar: Home, Deals, Tasks, Search and New */
  .x-bottombar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 44; left: 0; right: 0; bottom: 0; background: var(--f-navy-deep); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--f-on-navy-line); }
  .x-bottombar a, .x-bottombar button { all: unset; box-sizing: border-box; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 56px; width: 100%; color: var(--f-on-navy-muted); font-size: 11px; cursor: pointer; text-align: center; }
  .x-bottombar span[aria-hidden] { font-size: 18px; line-height: 1; height: 20px; display: grid; place-items: center; }
  .x-bottombar svg { width: 20px; height: 20px; }
  .x-bottombar .is-active { color: #FFFFFF; box-shadow: inset 0 2px 0 var(--x-red-sidebar, #FF6B75); }
  .x-bottombar a:focus-visible, .x-bottombar button:focus-visible { outline: 2px solid #FFFFFF; outline-offset: -4px; }
  .x-bottombar .x-rel { position: relative; display: block; }
  .x-bottombar .f-menu { position: absolute; bottom: calc(100% + 6px); right: 6px; top: auto; left: auto; }
  .f-content { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .f-toasts { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .x-peek { width: 100vw; border-left: 0; }
  .x-peek-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
/* Tables become stacked cards on a phone: each row a card, each cell with its column name */
@media (max-width: 640px) {
  .f-table.x-list thead, .f-table.x-deals thead, .f-table.x-deals tfoot { display: none; }
  .f-table.x-list, .f-table.x-deals, .f-table.x-list tbody, .f-table.x-deals tbody { display: block; }
  .f-table.x-list tr, .f-table.x-deals tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--f-rule); }
  .f-table.x-list td, .f-table.x-deals td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; }
  .f-table.x-list td.f-primary, .f-table.x-deals td.f-primary { grid-column: 1 / -1; font-size: var(--f-fs-15); }
  .f-table.x-list td:not(.f-primary)::before, .f-table.x-deals td:not(.f-primary):not(:first-child)::before { content: attr(data-label); display: block; font-size: var(--f-fs-10); text-transform: uppercase; letter-spacing: .06em; color: var(--f-muted); }
  .f-table.x-deals td:first-child { grid-column: 1 / -1; order: -1; }
  .f-table.x-list td.opt, .f-table.x-deals td.opt { display: none; }
  .f-table-wrap:has(> .x-list), .f-table-wrap:has(> .x-deals) { overflow: visible; }
}
/* Green means won: Close won stays green over the brand's red main button. */
.f-btn.x-won:not(.secondary):not(.quiet):not(.danger) { background: var(--f-good); border-color: var(--f-good); color: var(--f-white); }
.f-btn.x-won:not(.secondary):not(.quiet):not(.danger):hover { filter: brightness(1.1); }
.x-chips .f-chip { white-space: normal; max-width: 100%; overflow-wrap: anywhere; height: auto; }
