/* ResQ OS shell: dock, Home and registry pages. Tokens live in
   packages/ui/public/tokens.css (/ui/tokens.css). Collab keeps its own look inside /collab. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- dock ---------- */
.dock { background: var(--os-dock); display: flex; align-items: center; font-family: var(--os-sans); z-index: 40; }
.dock-tiles { display: flex; align-items: center; gap: 10px; }
.dock-left { flex-direction: column; width: 72px; height: 100%; min-height: 0; border-right: 1px solid var(--os-dock-line); padding: 14px 0 12px; }
.dock-left .dock-tiles { flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding: 2px 14px; width: 100%; }
.dock-left .dock-tile.on::before { left: -14px; }
.dock-tile { position: relative; flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: var(--os-tile-ink); background: var(--os-tile); text-decoration: none !important; font-size: 20px; transition: transform 0.12s, filter 0.12s; }
.dock-tile:hover { filter: brightness(1.18); }
.dock-tile:focus-visible, .dock-add:focus-visible, .dock-move:focus-visible { outline: 2px solid #F28C4B; outline-offset: 2px; }
.dock-home { background: linear-gradient(135deg, #F28C4B, #C8381E); color: #fff; }
.dock-product { color: #fff; }
.dock-mono { font-family: var(--os-mono); font-weight: 600; font-size: 14px; letter-spacing: 0.02em; }
.dock-tile.on::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #F28C4B; }
.dock-sep { flex: none; width: 28px; border-top: 1px solid var(--os-dock-line); }
.dock-add { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1.5px dashed #4A5670; background: none; color: var(--os-tile-ink); display: grid; place-items: center; font-size: 18px; cursor: pointer; }
.dock-add:hover { border-color: #8592AA; color: #fff; }
.dock-move { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: #8592AA; display: grid; place-items: center; font-size: 17px; cursor: pointer; }
.dock-move:hover { color: #fff; background: var(--os-tile); }
/* Tooltips carry the names (one floating element, placed by dock.js, so
   a scrolling dock can't clip it). */
.dock-tip { position: fixed; z-index: 1000; white-space: nowrap; background: #0B0F19; color: #fff; font: 500 13px/1.2 var(--os-sans); padding: 7px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.25); pointer-events: none; }
.dock-tip[hidden] { display: none; }
.dock-add, .dock-move { position: relative; }
/* Floating bar at the bottom. */
.dock-bottom { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 8px 10px 0; gap: 6px; border: 1px solid var(--os-dock-line); border-radius: 20px; box-shadow: 0 12px 32px rgba(14, 19, 32, 0.35); }
.dock-bottom .dock-tiles { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 2px 2px 9px; }
.dock-bottom .dock-sep { width: 0; height: 28px; border-top: 0; border-left: 1px solid var(--os-dock-line); }
.dock-bottom .dock-tile.on::before { left: 10px; right: 10px; top: auto; bottom: -7px; width: auto; height: 4px; border-radius: 4px 4px 0 0; }

/* Collab's shell: its rail column holds the dock. */
.shell { grid-template-columns: 72px 264px minmax(0, 1fr); }
.shell.side-hidden { grid-template-columns: 72px 0 minmax(0, 1fr); }
.shell .rail { padding: 0; background: var(--os-dock); border-right: 0; min-height: 0; height: 100%; overflow: hidden; z-index: 30; }
:root[data-dock=bottom] .shell, :root[data-dock=none] .shell { grid-template-columns: 264px minmax(0, 1fr); }
:root[data-dock=bottom] .shell.side-hidden, :root[data-dock=none] .shell.side-hidden { grid-template-columns: 0 minmax(0, 1fr); }
:root[data-dock=bottom] .shell .rail, :root[data-dock=none] .shell .rail { display: none; }
:root[data-dock=bottom] .shell .main, :root[data-dock=bottom] .shell .side, :root[data-dock=bottom] .os-main { padding-bottom: 84px; }
@media (max-width: 900px) {
  .shell, .shell.side-hidden, :root[data-dock] .shell, :root[data-dock] .shell.side-hidden { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- ResQ OS pages ---------- */
.os-frame { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; height: 100dvh; background: var(--os-ground); color: var(--os-ink); font-family: var(--os-sans); }
:root[data-dock=bottom] .os-frame { grid-template-columns: minmax(0, 1fr); }
:root[data-dock=bottom] .os-rail { display: none; }
.os-rail { min-height: 0; height: 100%; overflow: hidden; }
.os-main { overflow-y: auto; min-height: 0; padding: 36px clamp(16px, 4vw, 48px) 48px; outline: none; }
.os-main a { color: inherit; }
.os-label { font-family: var(--os-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--os-muted); margin: 0 0 10px; }
.os-muted { color: var(--os-muted); }
.os-mono-text { font-family: var(--os-mono); font-size: 13px; }
.os-hero h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.os-hero p:last-child { margin: 0; }
.os-section { margin-top: 32px; }
.os-card { background: var(--os-card); border: 1px solid var(--os-line); border-radius: 14px; }
.os-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.os-stat { padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.os-num { font-family: var(--os-mono); font-size: 28px; font-weight: 600; line-height: 1; }
.os-num .os-muted { font-size: 18px; }
.os-launcher { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.os-product { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 68px; text-decoration: none !important; }
.os-product:hover, .os-product:focus-visible { border-color: var(--os-ink); }
.os-mono { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; font: 600 14px var(--os-mono); }
.os-mono-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 18px; }
.os-pname { font-weight: 500; }
.os-pillars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.os-pillar { padding: 16px 16px 8px; }
.os-pillar h3 { margin: 0 0 2px; font-size: 17px; font-weight: 600; }
.os-pillar ul { list-style: none; padding: 0; margin: 10px 0 0; }
.os-pillar li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--os-line); min-height: 44px; }
.os-pillar li a { display: flex; align-items: center; gap: 10px; min-height: 44px; flex: 1; text-decoration: none !important; }
.os-pillar li a:hover span { text-decoration: underline; }
.os-page { max-width: 720px; }
.os-page-head { display: flex; gap: 16px; align-items: center; }
.os-page-head h1 { margin: 0 0 6px; font-size: 28px; font-weight: 600; }
.os-page-head p { margin: 0; }
.os-icon-lg { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--os-tile); color: var(--os-tile-ink); font-size: 26px; flex: none; }
.os-lede { font-size: 16px; line-height: 1.55; margin: 20px 0; }
.os-callout { padding: 16px 18px; margin: 20px 0; }
.os-callout h2 { font-size: 16px; margin: 0 0 6px; }
.os-callout p { margin: 0; line-height: 1.5; }
.os-history { list-style: none; padding: 0; margin: 0; }
.os-history li { padding: 8px 0; border-top: 1px solid var(--os-line); }
.os-empty { text-align: center; padding: 60px 16px; }
.os-form .os-seg { display: flex; gap: 16px; border: 0; padding: 0; margin: 0 0 12px; }
.os-form .os-seg legend { font-weight: 600; margin-bottom: 6px; }
.os-form .os-seg label { display: flex; gap: 6px; align-items: center; min-height: 44px; }
.os-form input[type=color] { height: 44px; padding: 4px; }

@media (max-width: 700px) {
  .os-frame { grid-template-columns: minmax(0, 1fr); }
  .os-rail { display: none; }
  .os-main { padding-top: 24px; padding-bottom: 96px; }
}

/* ResQ ID: launcher and People & access */
.os-frame-solo { grid-template-columns: minmax(0, 1fr); }
.rid-admin { max-width: 1100px; }
.rid-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--os-line); margin: 24px 0 20px; overflow-x: auto; scrollbar-width: none; }
.rid-tabs button { min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--os-muted); font: 500 15px var(--os-sans); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.rid-tabs button[aria-selected=true] { color: var(--os-ink); border-bottom-color: var(--os-accent); }
.rid-tabs button:focus-visible, .rid-panel:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
.rid-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.rid-search { flex: 1; min-width: 220px; margin: 0; }
.rid-table-wrap { position: relative; overflow-x: auto; background: var(--os-card); border: 1px solid var(--os-line); border-radius: 14px; }
.rid-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rid-table th, .rid-table td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--os-line); vertical-align: top; }
.rid-table thead th { border-top: 0; font: 500 12px var(--os-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--os-muted); }
.rid-table tbody th { font-weight: 500; }
.rid-off { opacity: 0.6; }
.rid-perm-rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rid-perm-rows select { width: auto; min-width: 160px; flex: 0 0 auto; }
.rid-name { font-weight: 600; }
.rid-sub { display: block; font-size: 13px; font-weight: 400; }
.rid-app { display: block; white-space: nowrap; }
.rid-list { list-style: none; padding: 0; margin: 0 0 12px; }
.rid-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; border-top: 1px solid var(--os-line); flex-wrap: wrap; }
.rid-actions { display: flex; gap: 8px; }
.rid-inline { padding: 16px; margin-bottom: 20px; }
.rid-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.rid-row .field { flex: 1; min-width: 180px; }
.rid-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rid-org { width: 100%; text-align: left; padding: 14px; min-height: 72px; cursor: pointer; font: inherit; color: inherit; }
.rid-org:hover, .rid-org:focus-visible { border-color: var(--os-ink); }
.rid-scope { border: 1px solid var(--os-line); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; }
.rid-scope legend { font-weight: 600; padding: 0 4px; }
.rid-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; max-height: 220px; overflow-y: auto; }
.rid-checks label, .rid-check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.rid-acct { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.rid-acct .field { margin: 0; }
.rid-grant-form { border-top: 1px solid var(--os-line); padding-top: 8px; margin-top: 8px; }
.modal select, .modal input:not([type=checkbox]):not([type=radio]), .modal textarea, .rid-admin select, .rid-admin input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
@media (max-width: 700px) {
  .rid-table thead { display: none; }
  .rid-table tr { display: block; border-top: 1px solid var(--os-line); padding: 8px 12px; }
  .rid-table tbody tr:first-child { border-top: 0; }
  .rid-table th, .rid-table td { display: block; border: 0; padding: 4px 0; }
  .rid-app { white-space: normal; }
}

/* Dock: the Products tile's flyout list */
.dock-products { border: 0; cursor: pointer; font: inherit; }
.dock-products[aria-expanded=true] { filter: brightness(1.25); }
.dock-flyout { position: fixed; z-index: 1000; width: 260px; max-height: min(70vh, 520px); overflow-y: auto; background: #0B0F19; color: #E6EAF2; border: 1px solid var(--os-dock-line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); padding: 8px; font-family: var(--os-sans); }
.dock-flyout[hidden] { display: none; }
.dock-fly-head { margin: 4px 8px 6px; font: 500 12px var(--os-mono); letter-spacing: 0.08em; text-transform: uppercase; color: #8592AA; }
.dock-flyout ul { list-style: none; margin: 0; padding: 0; }
.dock-flyout a, .dock-flyout button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: 500 14px var(--os-sans); text-align: left; text-decoration: none; cursor: pointer; }
.dock-flyout a:hover, .dock-flyout button:hover, .dock-flyout a:focus-visible, .dock-flyout button:focus-visible { background: var(--os-tile); outline: none; }
.dock-flyout a:focus-visible, .dock-flyout button:focus-visible { box-shadow: inset 0 0 0 2px #F28C4B; }
.dock-flyout a.on { background: var(--os-tile); box-shadow: inset 3px 0 0 #F28C4B; }
.dock-fly-mono { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font: 600 12px var(--os-mono); }
.dock-fly-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-flyout .i-external { color: #8592AA; font-size: 14px; }
.dock-fly-add { border-top: 1px solid var(--os-dock-line); margin-top: 6px; padding-top: 6px; }
.dock-fly-plus { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1.5px dashed #4A5670; display: grid; place-items: center; color: #C9D1DE; }
.dock-fly-empty { padding: 8px; color: #8592AA; font-size: 14px; }

/* Customers: the shared customer record */
.cust { max-width: 1100px; }
.cust-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--os-muted); font: 500 15px var(--os-sans); border-bottom: 3px solid transparent; text-decoration: none; white-space: nowrap; }
.cust-tab[aria-current=page] { color: var(--os-ink); border-bottom-color: var(--os-accent); }
.cust-tab:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
.cust-filters .field { margin: 0; }
.cust-filters select { min-width: 140px; }
.cust-counts { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 12px; }
.cust-sync-line { margin: 0 0 10px; font-size: 14px; }
.cust-err { color: var(--os-danger); font-weight: 600; }
/* Customer record: people, stage per brand, activity, the HighLevel mirror (Nov 6). */
.cust-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
.cust-clean-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0 0 12px; }
.cust-clean-form .field { flex: 1 1 240px; }
.cust-clean-list { max-height: 50vh; overflow: auto; margin: 0 0 16px; }
.cust-clean-list .os-row { align-items: flex-start; }
.cust-merge-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.cust-merge-pick label.cust-check { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.cust-merge-pick input[type=radio] { margin-top: 3px; flex: none; }
.cust-merge-pick .os-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cust-merge-pick .os-row-sub { overflow-wrap: anywhere; }
.cust-pick { width: 44px; text-align: center; }
.cust-pick input { width: 18px; height: 18px; }
.cust-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 12px; margin: 0 0 12px; border: 1px solid var(--os-line); border-radius: var(--os-radius-lg); background: var(--os-raised); }
.cust-bulk [data-bulk-count] { font-weight: 600; margin-right: auto; }
.cust-clean-pick { width: 18px; height: 18px; margin: 3px 12px 0 0; flex: none; }
.cust-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-bottom: 72px; } /* room for the Ask ResQ bubble */
.cust-foot #cust-total { margin: 0; }
.cust-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cust-per { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.cust-per select { width: auto; }
.cust-pages { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.cust-pad { padding: 12px var(--os-s-5); margin: 0; }
.cust-crm .rid-list { margin: 0; padding: 0; }
.os-main .cust-crm .os-card .rid-list > li { padding: 10px 16px; }
.cust-crm .rid-list > li:first-child { border-top: 0; }
.cust-row-link { cursor: pointer; }
.cust-row-link:hover > * { background: var(--os-hover); }
.cust-stage { display: inline-flex; align-items: center; gap: 6px; margin: 0 8px 4px 0; font-size: 13px; white-space: nowrap; }
.cust-people .rid-sub a { color: inherit; }
.cust-mono { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font: 600 10px var(--os-mono); vertical-align: middle; }
.cust-activity .os-chip { margin-right: 6px; }
.cust-mirror .field { max-width: 420px; }
.cust-backfill { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cust-backfill p { margin: 0; }
.cust-back { margin: 0 0 12px; }
.cust-back a { display: inline-flex; align-items: center; min-height: 44px; }
.cust-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cust-reviews { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.cust-review { padding: 16px; }
.cust-why { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.cust-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cust-card { border: 1px solid var(--os-line); border-radius: 10px; padding: 12px; }
.cust-card p { margin: 0 0 8px; }
.cust-idents { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.cust-idents li { padding: 6px 0; border-top: 1px solid var(--os-line); }
.cust-src { padding: 14px; }
.cust-panel-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: var(--os-s4) var(--os-s-5) 4px; }
.cust-panel-summary .os-num { font: 600 var(--os-text-kpi) var(--os-num); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
/* The customer record (design system v2): page-specific bits only */
.cust-record > * + * { margin-top: var(--os-s4); }
.cust-record > .os-crumbs + .os-identity { margin-top: 0; }
.os-main .cust-record .os-tabs { margin: var(--os-s5) 0 var(--os-s4); }
.cust-record [data-rec-panel] > * + * { margin-top: var(--os-s4); }
.cust-dd-edit { display: inline-flex; align-items: center; gap: 6px; margin: -4px -8px; padding: 4px 8px; border: 0; border-radius: var(--os-radius-sm); background: none; color: inherit; font: inherit; cursor: pointer; }
.cust-dd-edit .i { color: var(--os-subtle); opacity: 0; }
.cust-dd-edit:hover, .cust-dd-edit:focus-visible { background: var(--os-hover); }
.cust-dd-edit:hover .i, .cust-dd-edit:focus-visible .i { opacity: 1; }
.cust-brand { display: inline-flex; gap: 4px; align-items: center; margin: 2px 8px 2px 0; }
.cust-tl-title { white-space: normal; }
.cust-flush > li { padding-left: 0; padding-right: 0; }
.cust-orphan { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cust-orphan select { min-height: var(--os-control-h-sm); font-size: 13px; }
.cust-record .cust-panel { padding: 0; }
.cust-panel-actions { margin: 10px 0 6px; flex-wrap: wrap; }
.cust-src p { margin: 0 0 6px; }
.cust-token input { min-width: 160px; }
.os-label .cust-id { text-transform: none; letter-spacing: 0; }
.cust-edit .field input { width: 100%; }

/* ---------- capabilities (Home, module pages, edit screen) ---------- */
.cap-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cap-bar .os-label { margin: 0 auto 0 0; }
.cap-filter { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--os-line); border-radius: 10px; background: var(--os-card); overflow: hidden; }
.cap-filter button { min-height: 44px; padding: 0 14px; border: 0; border-left: 1px solid var(--os-line); background: none; color: var(--os-muted); font: 500 14px var(--os-sans); cursor: pointer; }
.cap-filter button:first-child { border-left: 0; }
.cap-filter button[aria-pressed=true] { background: var(--os-navy); color: #fff; }
.cap-filter button:focus-visible, .cap-toggle:focus-visible { outline: 2px solid var(--os-accent); outline-offset: -2px; }
.os-pillar .cap-mods > li { display: block; min-height: 0; }
.cap-mod-row { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.cap-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cap-toggle:hover .cap-mod-name { text-decoration: underline; }
.cap-chev { font-size: 14px; color: var(--os-muted); transition: transform 0.12s; }
.cap-toggle[aria-expanded=true] .cap-chev { transform: rotate(90deg); }
.cap-mod-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-count { margin-left: auto; font-size: 12px; }
.cap-panel { padding: 0 0 10px 22px; }
.os-pillar .cap-panel ul { margin: 0; }
.cap-list { list-style: none; padding: 0; margin: 0; }
.os-pillar .cap-list li, .cap-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 8px 0; min-height: 0; border-top: 1px dashed var(--os-line); }
.cap-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cap-name { font-size: 14px; }
.cap-prov { font-size: 13px; }
.cap-notes { grid-column: 1 / -1; font-size: 13px; color: var(--os-muted); line-height: 1.45; }
.cap-credits { display: inline-flex; gap: 4px; margin-top: 2px; }
.cap-credit { display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 4px; border-radius: 6px; color: #fff; font: 600 11px var(--os-mono); }
.cap-open { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 500; }
.cap-none, .cap-empty { font-size: 14px; padding: 10px 0; }
.cap-sum { font-size: 13px; margin: 4px 0 6px; }
.cap-card { padding: 4px 16px; }
.cap-card li:first-child { border-top: 0; }
/* Edit screen */
.cap-admin { max-width: 1100px; }
.cap-add { padding: 4px 16px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.cap-wide { grid-column: 1 / -1; }
.cap-add .field, .cap-edit .field { margin: 10px 0 0; }
.cap-admin input, .cap-admin select, .cap-admin textarea { width: 100%; min-height: 44px; box-sizing: border-box; font: inherit; }
.cap-search { flex: 1; min-width: 220px; margin: 0; }
.cap-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.cap-check input { width: auto; min-height: 0; }
.cap-adm-mod { margin-top: 28px; }
.cap-adm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cap-adm-head h2 { font-size: 18px; margin: 0; }
.cap-adm-head a { margin-left: auto; font-size: 14px; }
.cap-edit { display: grid; grid-template-columns: minmax(180px, 2fr) 130px minmax(160px, 2fr) minmax(160px, 2fr); gap: 0 12px; padding: 4px 14px 12px; margin-bottom: 8px; }
.cap-products { grid-column: 1 / 3; margin-top: 10px; }
.cap-products summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 14px; }
.cap-products fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0 16px; }
.cap-actions { grid-column: 3 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }
.cap-retired { opacity: 0.7; }
@media (max-width: 760px) {
  .cap-edit { grid-template-columns: minmax(0, 1fr); }
  .cap-products, .cap-actions { grid-column: 1; }
  .cap-actions { justify-content: flex-start; }
  .cap-filter { width: 100%; }
  .cap-filter button { flex: 1; padding: 0 8px; }
}
.os-pillars:has(.cap-mods) { align-items: start; }
.cap-admin input:not([type=checkbox]), .cap-admin select, .cap-admin textarea { padding: 8px 10px; border: 1px solid var(--os-line); border-radius: 8px; background: var(--os-card); color: var(--os-ink); }
.cap-admin textarea { resize: vertical; }

/* Dock: the account button (your avatar) and its menu */
.dock-account { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; padding: 4px; background: none; display: grid; place-items: center; cursor: pointer; position: relative; }
.dock-account:hover, .dock-account[aria-expanded=true] { background: var(--os-tile); }
.dock-account:focus-visible { outline: 2px solid #F28C4B; outline-offset: 2px; }
.dock-account .avatar { width: 32px; height: 32px; border-radius: 50%; font-size: 12px; display: grid; place-items: center; color: #fff; object-fit: cover; }
.dock-left .dock-account { margin-bottom: 6px; }
.dock-acct-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; border-bottom: 1px solid var(--os-dock-line); margin-bottom: 6px; }
.dock-acct-head .avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; object-fit: cover; }
.dock-acct-name { display: block; font-weight: 600; font-size: 14px; }
.dock-acct-email { display: block; font-size: 12.5px; color: #A3ADBB; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.dock-flyout .i-users, .dock-flyout .i-log-out { flex: none; width: 32px; text-align: center; font-size: 17px; color: #C9D1DE; }

/* Entities & structure (entities.js) */
.ent-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ent-hero .os-chip { vertical-align: middle; }
.ent-pad { padding: 16px; }
.ent-mono { font-family: var(--os-mono); font-size: 13px; }
.ent-text { white-space: pre-wrap; }
.ent-note { font-size: 13px; line-height: 1.45; margin: 10px 0 0; }
.ent-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 0 24px; align-items: start; }
.ent-sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.ent-sec-head .os-label { margin: 0; }
.ent-props { display: grid; grid-template-columns: max-content 1fr; gap: 10px 14px; margin: 0; font-size: 14px; }
.ent-props dt { color: var(--os-muted); }
.ent-props dd { margin: 0; overflow-wrap: anywhere; }
.ent-ein-actions { display: inline-flex; margin-left: 8px; gap: 6px; }
.ent-ended { opacity: .7; }
.ent-owns { margin: 10px 0 0; font-size: 14px; }
.ent-area { font: 500 12px var(--os-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--os-muted); margin: 14px 0 4px; }
.ent-area:first-child { margin-top: 0; }
.ent-none { margin: 0 0 4px; font-size: 14px; }
.ent-docs { margin: 0; }
.ent-docs > li { align-items: flex-start; }
.ent-docs .rid-name { overflow-wrap: anywhere; }
.ent-docs .rid-actions { flex-wrap: wrap; align-items: center; }
.ent-upload { cursor: pointer; min-height: 44px; }
.ent-upload:focus-within { outline: 2px solid var(--os-accent); outline-offset: 2px; }
.ent-counts { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 0; font-size: 14px; }
.ent-fails { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.ent-check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.ent-check input { width: 20px; height: 20px; flex: none; }
.ent-asof { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0; }
.ent-asof .field { margin: 0; }
.ent-asof input { min-height: 44px; }
.ent-tree-card { padding: 12px 16px; }
.ent-tree, .ent-tree ul { list-style: none; margin: 0; padding: 0; }
.ent-tree ul { margin-left: 14px; padding-left: 16px; border-left: 2px solid var(--os-line); }
.ent-tree li { padding: 6px 0; }
.ent-node { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ent-node .rid-sub { flex-basis: 100%; }
.ent-pct { font: 600 13px var(--os-mono); color: var(--os-ink); }
.ent-form .field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.ent-form input:not([type=checkbox]), .ent-form select, .ent-form textarea { width: 100%; min-height: 44px; box-sizing: border-box; }
.ent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.ent-form-foot { justify-content: flex-end; }
@media (max-width: 900px) { .ent-cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ent .rid-table td[data-label]::before { content: attr(data-label); display: block; font: 500 11px var(--os-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--os-muted); } }

.ent-scans { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--os-line); border-radius: 10px; background: var(--os-ground); }
.ent-scans p { margin: 4px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ent-sum { margin: 6px 0 0; font-size: 13px; }
.ent-sum summary { cursor: pointer; color: var(--os-muted); min-height: 28px; display: flex; align-items: center; }
.ent-sum p, .ent-sum ul { margin: 6px 0; }
.ent-sum ul { padding-left: 18px; }
.ent-review .rid-table td input[type=checkbox] { width: 20px; height: 20px; }
.ent-review .ent-low td, .ent-review .ent-low th { background: var(--os-partial-bg); }
:root[data-theme=dark] .ent-review .ent-low td, :root[data-theme=dark] .ent-review .ent-low th { background: #3A2E17; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .ent-review .ent-low td, :root:not([data-theme=light]) .ent-review .ent-low th { background: #3A2E17; } }
@media (max-width: 640px) { .ent-review .rid-table td[data-label]::before { content: attr(data-label); display: block; font: 500 11px var(--os-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--os-muted); } }

/* ResQ Keys (secrets vault) */
.keys-banner { background: var(--os-gap-bg); color: var(--os-gap-ink); border: 1px solid var(--os-danger); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.keys-counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.keys-count { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--os-line); border-radius: 10px; background: var(--os-card); cursor: pointer; font: inherit; color: var(--os-ink); }
.keys-count:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; }
.keys-counts { align-items: center; }
.keys-count-sep { width: 1px; align-self: stretch; background: var(--os-line); margin: 4px 4px; }
.keys-impact { border: 1px solid var(--os-line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.keys-impact .keys-list { margin: 6px 0; }
.keys-filters .field { margin: 0; }
.keys-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin: 0 0 12px; }
.keys-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.keys-card { padding: 18px; margin-bottom: 16px; min-width: 0; }
.keys-cols .keys-card { margin-bottom: 0; }
.keys-card h2, .keys-h2 { font-size: 17px; margin: 0 0 10px; }
.keys-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.keys-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
/* Apps and their places: each place can be deleted on its own (typed confirmation). */
.keys-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.keys-places li { display: flex; align-items: center; gap: 4px; min-width: 0; }
.keys-places .os-mono-text { overflow-wrap: anywhere; }
.keys-place-del { flex: none; width: 44px; height: 44px; margin: -10px 0; border: 0; background: none; color: var(--os-muted); font-size: 20px; line-height: 1; border-radius: 8px; cursor: pointer; }
.keys-place-del:hover, .keys-place-del:focus-visible { color: var(--os-accent); background: var(--os-gap-bg); }
.keys-place-del:focus-visible { outline: 2px solid var(--os-accent); outline-offset: -2px; }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.keys-confirm-err { color: var(--os-gap-ink); margin: 4px 0 0; min-height: 1em; }
.keys-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.keys-dl dt { color: var(--os-muted); }
.keys-dl dd { margin: 0; overflow-wrap: anywhere; }
.keys-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.keys-list li { padding: 8px 0; border-top: 1px solid var(--os-line); overflow-wrap: anywhere; }
.keys-steps { margin: 8px 0; padding-left: 20px; font-size: 14px; }
.keys-steps li { margin: 3px 0; overflow-wrap: anywhere; }
.keys-run { border-top: 1px solid var(--os-line); padding: 10px 0; }
.keys-run summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.keys-pre { white-space: pre-wrap; word-break: break-all; font: 12px/1.4 var(--os-mono); background: var(--os-ground); color: var(--os-ink); padding: 10px; border-radius: 8px; max-height: 200px; overflow: auto; }
.keys-secret-input { width: 100%; box-sizing: border-box; font: 13px/1.4 var(--os-mono); }
.keys-reveal:empty { display: none; }
.keys-reveal { margin: 10px 0; }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.keys-grid .field input, .keys-grid .field select, .keys-grid .field textarea { width: 100%; box-sizing: border-box; }
.keys-wide { grid-column: 1 / -1; }
.keys-fieldset { border: 1px solid var(--os-line); border-radius: 10px; padding: 10px 12px; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 12px; }
.keys-fieldset .field { margin: 0; }
.keys-fieldset .field input, .keys-fieldset .field select { width: 100%; box-sizing: border-box; }
.keys-fieldset legend { padding: 0 4px; font-weight: 600; font-size: 14px; }
.keys-inline { margin: 0; flex: 1 1 100%; }
.keys-add-consumer { margin-top: 12px; align-items: flex-end; }
.keys-check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.keys-check input { width: 20px; height: 20px; }
.keys-howto { padding-left: 20px; margin: 0 0 12px; }
.keys-days { width: 100px; min-height: 40px; }
.keys .rid-table td, .keys .rid-table th { vertical-align: top; }

/* Offboarding (People & access → a person → Offboard) */
.off-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.off-card { padding: 18px; min-width: 0; }
.off-card h2 { font-size: 17px; margin: 0 0 10px; }
.off-card h3 { font: 500 12px var(--os-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--os-muted); margin: 14px 0 6px; }
.off-card .rid-list li { overflow-wrap: anywhere; }
.off-outside { list-style: none; padding: 0; margin: 0; }
.off-done { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0; }
.off-done .field { margin: 0; flex: 1 1 260px; }
.off-done .field input { width: 100%; box-sizing: border-box; min-height: 44px; }

/* ---------- Ask ResQ (ask.js): Home box, overlay, page, settings ---------- */
.ask-home-form { padding: 18px clamp(16px, 3vw, 24px); display: grid; gap: 10px; }
.ask-home-label { display: flex; align-items: center; gap: 8px; font: 600 18px var(--os-sans); color: var(--os-ink); }
.ask-home-label .i, .ask-title .i { color: var(--os-accent); }
.ask-home-row { display: flex; gap: 8px; }
.ask-home-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid var(--os-line); border-radius: 12px; font: 400 16px var(--os-sans); color: var(--os-ink); background: var(--os-card); }
.ask-home-row input:focus-visible, .ask-compose textarea:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 1px; border-color: transparent; }
.ask-home-row .btn, .ask-compose .btn { min-height: 48px; min-width: 64px; justify-content: center; font-size: 15px; }
.ask-home-hint { margin: 0; font-size: 14px; }
kbd { font: 500 12px var(--os-mono); padding: 2px 6px; border: 1px solid var(--os-line); border-bottom-width: 2px; border-radius: 6px; background: var(--os-ground); color: var(--os-ink); }
.ask-sugg { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.ask-chip { min-height: 44px; padding: 8px 14px; border: 1px solid var(--os-line); border-radius: 999px; background: var(--os-card); color: var(--os-ink); font: 500 14px var(--os-sans); text-align: left; cursor: pointer; }
.ask-chip:hover, .ask-chip:focus-visible { border-color: var(--os-ink); }
.ask-off { margin: 0; font-size: 14px; }
.ask-warn { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--os-partial-bg); color: var(--os-partial-ink); font-size: 14px; }

/* Ask ResQ chat bubble: on every page, bottom right, above a bottom dock (or Collab's composer). */
/* The phone's safe area (home bar) counts too, so the Ask button never lands on the bottom dock (Joe, Nov 10). */
body { --ask-fab-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
body:has(.dock-bottom) { --ask-fab-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
body.ask-raised { --ask-fab-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
.ask-fab { position: fixed; z-index: 880; right: 20px; bottom: var(--ask-fab-bottom); display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 20px 0 16px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; background: #12233D; color: #fff; font: 600 15px var(--os-sans, sans-serif); box-shadow: 0 10px 28px rgba(14, 19, 32, 0.32); cursor: pointer; }
.ask-fab[hidden] { display: none; }
/* A dialog owns the screen: the Ask ResQ bubble steps aside so it never covers a dialog's buttons (Joe's review, Nov 9). */
body:has(.modal-back) .ask-fab, body:has(.msg-sheet-back) .ask-fab, body:has(.rd-sheet:not([hidden])) .ask-fab { display: none; }
/* Toasts stack above the Ask ResQ bubble, so an Undo in a toast is never under it (Nov 9). */
body:has(.ask-fab:not([hidden])) .toast-wrap { bottom: calc(var(--ask-fab-bottom) + 64px); z-index: 885; }
/* Floating controls never sit on the last of the content (Joe, Nov 9): the page ends below the
   Ask button (and the bottom dock under it on phones), and anything scrolled into view or focused
   by keyboard stops above them. */
:root[data-dock=bottom] .os-main, body:has(.dock-bottom) .os-main { scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
body:has(.ask-fab:not([hidden])) .os-main { padding-bottom: calc(var(--ask-fab-bottom) + 76px); scroll-padding-bottom: calc(var(--ask-fab-bottom) + 76px); }
.ask-fab .i { color: #F28C4B; width: 20px; height: 20px; }
.ask-fab:hover { background: #1A3152; }
.ask-fab:focus-visible { outline: 3px solid #F28C4B; outline-offset: 3px; }
.ask-fab[aria-expanded=true] { background: #C8381E; }
.ask-fab[aria-expanded=true] .i { color: #fff; }
.ask-panel { position: fixed; z-index: 890; right: 20px; bottom: calc(var(--ask-fab-bottom) + 64px); width: min(440px, calc(100vw - 40px)); height: min(680px, calc(100vh - var(--ask-fab-bottom) - 96px)); min-height: 320px; background: var(--os-ground); color: var(--os-ink); border: 1px solid var(--os-line); border-radius: 18px; box-shadow: 0 24px 64px rgba(14, 19, 32, 0.3); overflow: hidden; font-family: var(--os-sans); }
.ask-panel[hidden] { display: none; }
.ask-ib { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--os-ink); cursor: pointer; text-decoration: none; }
.ask-ib:hover, .ask-ib:focus-visible { background: var(--os-card); }
.ask-ib[aria-expanded=true] { background: var(--os-card); box-shadow: inset 0 0 0 1px var(--os-line); }
.ask-compact .ask-head { padding: 6px 6px 6px 16px; flex-wrap: nowrap; }
.ask-compact .ask-title { font-size: 17px; }
.ask-compact .ask-head-acts { gap: 0; flex-wrap: nowrap; }
.ask-compact .ask-tabs { display: flex; border-bottom: 1px solid var(--os-line); }
.ask-compact .ask-tabs button { flex: 1; min-height: 44px; border: 0; background: none; color: var(--os-muted); font: 500 15px var(--os-sans); border-bottom: 3px solid transparent; cursor: pointer; }
.ask-compact .ask-tabs button[aria-selected=true] { color: var(--os-ink); border-bottom-color: var(--os-accent); }
.ask-compact .ask-body { grid-template-columns: minmax(0, 1fr); }
.ask-compact .ask-body[data-tab=answer] .ask-results, .ask-compact .ask-body[data-tab=results] .ask-thread { display: none; }
.ask-compact .ask-results { border-left: 0; padding: 14px; }
.ask-compact .ask-thread { padding: 14px; gap: 12px; }
.ask-compact .ask-user { max-width: 88%; }
.ask-compact .ask-history { width: 100%; }
.ask-compact .ask-sugg { flex-direction: column; }
.ask-compact .ask-compose { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
.ask-compact .ask-compose textarea { min-height: 44px; }
.ask-ctx { display: flex; align-items: center; gap: 6px; margin: 0; padding: 4px 6px 4px 14px; border-top: 1px solid var(--os-line); background: var(--os-card); font-size: 13px; color: var(--os-muted); min-width: 0; }
.ask-ctx[hidden] { display: none; }
.ask-ctx strong { color: var(--os-ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ask-ctx-label { flex: none; }
.ask-ctx-x { flex: none; margin-left: auto; display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--os-muted); cursor: pointer; }
.ask-ctx-x:hover, .ask-ctx-x:focus-visible { background: var(--os-ground); color: var(--os-ink); }
.ask-compact .ask-compose { border-top: 0; }
.ask-compact .ask-ctx[hidden] + .ask-compose, .ask-compact > .ask-off + .ask-compose { border-top: 1px solid var(--os-line); }
.ask-page { height: calc(100vh - 84px); min-height: 520px; }
.ask { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ask > .ask-body { flex: 1 1 auto; }
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--os-line); flex-wrap: wrap; }
.ask-title { display: flex; align-items: center; gap: 8px; margin: 0; font: 600 20px var(--os-sans); }
.ask-head-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.ask-tabs { display: none; }
.ask-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); min-height: 0; position: relative; }
.ask-history { position: absolute; z-index: 2; inset: 0 auto 0 0; width: min(340px, 100%); background: var(--os-card); border-right: 1px solid var(--os-line); padding: 14px; overflow-y: auto; box-shadow: 8px 0 24px rgba(14, 19, 32, 0.12); }
/* Left panels are soft grey in light mode only (Joe, Nov 7). */
:root[data-theme=light] .ask-history { background: var(--os-raised); }
@media (prefers-color-scheme: light) { :root:not([data-theme=dark]) .ask-history { background: #eef0f3; } }
.ask-history ul { list-style: none; margin: 0; padding: 0; }
.ask-history li { border-top: 1px solid var(--os-line); padding: 6px 0; }
.ask-conv { display: grid; width: 100%; min-height: 44px; text-align: left; border: 0; background: none; color: var(--os-ink); font: 500 14px var(--os-sans); cursor: pointer; padding: 6px 4px; border-radius: 8px; }
.ask-conv.is-current, .ask-conv:hover { background: var(--os-ground); }
.ask-conv-acts { display: flex; gap: 6px; }
.ask-conv-acts .btn { min-height: 36px; }
.ask-thread { overflow-y: auto; padding: 18px clamp(16px, 3vw, 28px); display: grid; align-content: start; gap: 16px; }
.ask-empty p { max-width: 62ch; }
.ask-thread > * { min-width: 0; }
.ask-msg p { margin: 0 0 8px; line-height: 1.55; }
.ask-answer, .ask-draft-body, .ask-user p { overflow-wrap: anywhere; }
.ask-user { justify-self: end; max-width: 80%; background: var(--os-navy); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.ask-user p { margin: 0; white-space: pre-wrap; }
.ask-assistant { background: var(--os-card); border: 1px solid var(--os-line); border-radius: 14px; padding: 14px 16px; max-width: 100%; }
.ask-status:empty { display: none; }
.ask-status { font: 500 13px var(--os-mono); margin-bottom: 8px; }
.ask-answer ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.55; }
.ask-answer .ask-h { font-weight: 600; }
.ask-answer code { font: 13px var(--os-mono); background: var(--os-ground); padding: 1px 4px; border-radius: 4px; }
.ask-cite { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; margin: 0 1px; border-radius: 6px; background: var(--os-ground); border: 1px solid var(--os-line); color: var(--os-ink); font: 600 12px var(--os-mono); text-decoration: none; vertical-align: 1px; }
.ask-cite:hover, .ask-cite:focus-visible { border-color: var(--os-accent); color: var(--os-accent); }
.ask-sources { margin-top: 12px; border-top: 1px solid var(--os-line); padding-top: 10px; }
.ask-src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ask-src { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; padding: 6px 0; }
.ask-src:target { background: var(--os-ground); border-radius: 8px; }
.ask-src-n { font: 600 13px var(--os-mono); color: var(--os-muted); padding-top: 2px; }
.ask-src-text { display: grid; gap: 3px; min-width: 0; }
.ask-src-text a { color: var(--os-ink); font-weight: 500; overflow-wrap: anywhere; }
.ask-src-meta { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ask-src-snip { font-size: 13px; overflow-wrap: anywhere; }
.ask-more { margin-top: 8px; }
.ask-more summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--os-muted); font-size: 14px; }
.ask-draft { padding: 12px 14px; margin-top: 10px; border-color: var(--os-accent); }
.ask-draft-title { font-weight: 600; }
.ask-draft-line { font-size: 14px; margin: 0 !important; }
.ask-draft-body { white-space: pre-wrap; font-size: 14px; }
.ask-draft-acts { display: flex; gap: 8px; margin-top: 8px; }
.ask-results { border-left: 1px solid var(--os-line); overflow-y: auto; padding: 18px 16px; background: var(--os-card); }
.ask-rgroup { margin-bottom: 16px; }
.ask-rlabel { font: 500 12px var(--os-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--os-muted); margin: 0 0 6px; }
.ask-rgroup ul { list-style: none; margin: 0; padding: 0; }
.ask-rgroup li { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--os-line); font-size: 14px; }
.ask-rgroup a { color: var(--os-ink); overflow-wrap: anywhere; }
.ask-rgroup span { font-size: 13px; overflow-wrap: anywhere; }
.ask > .ask-off { padding: 8px 18px; border-top: 1px solid var(--os-line); }
.ask-compose { display: flex; gap: 8px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--os-line); background: var(--os-card); }
.ask-compose textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 160px; resize: vertical; padding: 12px 14px; border: 1px solid var(--os-line); border-radius: 12px; font: 400 16px/1.4 var(--os-sans); color: var(--os-ink); background: var(--os-card); }
.ask-settings { padding: 18px; display: grid; gap: 14px; max-width: 640px; }
.ask-settings label { display: grid; gap: 6px; font-weight: 500; }
.ask-settings label .os-muted { font-weight: 400; font-size: 14px; }
.ask-settings select, .ask-settings input[type=number], .ask-filter input { min-height: 44px; padding: 0 10px; border: 1px solid var(--os-line); border-radius: 10px; font: 400 15px var(--os-sans); background: var(--os-card); color: var(--os-ink); max-width: 100%; }
.ask-settings .ask-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.ask-check input, .ask-x input { width: 20px; height: 20px; }
.ask-filter { display: grid; gap: 6px; max-width: 420px; margin: 0 0 12px; font-weight: 500; }
.ask-x { padding: 12px 16px; margin: 0 0 12px; }
.ask-x legend { font: 500 12px var(--os-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--os-muted); padding: 0 4px; }
.ask-x ul { list-style: none; margin: 0; padding: 0; columns: 2 260px; }
.ask-x li label { display: flex; align-items: center; gap: 10px; min-height: 44px; break-inside: avoid; }
.ask-idx-meta { font-size: 14px; }

@media (max-width: 760px) {
  .ask-fab { right: 16px; width: 56px; min-height: 56px; padding: 0; justify-content: center; }
  .ask-fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body.ask-open .ask-fab { display: none; }
  .ask-panel { inset: 0; width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; z-index: 950; }
  .ask-page { height: calc(100vh - 120px); }
  .ask-tabs { display: flex; border-bottom: 1px solid var(--os-line); }
  .ask-tabs button { flex: 1; min-height: 44px; border: 0; background: none; color: var(--os-muted); font: 500 15px var(--os-sans); border-bottom: 3px solid transparent; cursor: pointer; }
  .ask-tabs button[aria-selected=true] { color: var(--os-ink); border-bottom-color: var(--os-accent); }
  .ask-body { grid-template-columns: minmax(0, 1fr); }
  .ask-body[data-tab=answer] .ask-results, .ask-body[data-tab=results] .ask-thread { display: none; }
  .ask-results { border-left: 0; }
  .ask-user { max-width: 92%; }
  .ask-head { padding: 10px 12px; }
  .ask-head-acts .ask-wide { display: none; }
  .ask-thread { padding: 14px 12px; }
  .ask-home-row { flex-direction: column; }
}

/* Setup notices (packages/ui/public/setup-notice.js): a key a screen needs is missing on the Worker. */
.setup-notice { background: var(--os-partial-bg); color: var(--os-partial-ink); border: 1px solid var(--os-line-strong); border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.setup-notice-quiet { background: var(--os-ext-bg); color: var(--os-ext-ink); border-color: var(--os-line-strong); }
.setup-notice p { margin: 0; }
.setup-notice ul { margin: 6px 0; padding-left: 20px; }
.setup-notice code { font-family: var(--os-code); font-size: 12px; background: color-mix(in srgb, var(--os-card) 65%, transparent); color: inherit; border: 0; padding: 0 4px; border-radius: 4px; }
.setup-notice a { color: inherit; font-weight: 600; }
.setup-title { font-weight: 600; }
.setup-foot { font-size: 12.5px; }
.setup-opt { font-family: var(--os-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.os-setup:empty { display: none; }

/* A product's uploaded icon fills its mark box (product-mark.js). */
.os-logo { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.os-mono:has(.os-logo), .dock-fly-mono:has(.os-logo), .cap-credit:has(.os-logo) { overflow: hidden; border: 1px solid var(--os-line); }
.dock-mono:has(.os-logo) { display: block; width: 100%; height: 100%; border-radius: inherit; overflow: hidden; }
.cap-credit:has(.os-logo) { padding: 0; width: 24px; }
.cap-credit:has(.os-logo) > span { display: block; width: 100%; height: 100%; }
/* The product edit form: icon preview beside its buttons. */
.prod-icon-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.os-page-edit { margin-left: auto; align-self: flex-start; min-height: 44px; }
.os-form .check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.os-form fieldset.field { border: 0; padding: 0; margin: 0; }
#edit-entry .field input:not([type=color]):not([type=checkbox]), #edit-entry .field textarea, #edit-entry .field select { width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 12px; border: 1px solid var(--os-line); border-radius: 10px; font: 400 15px var(--os-sans); background: var(--os-card); color: var(--os-ink); }
#edit-entry .field textarea { padding: 10px 12px; }
/* ⓘ info buttons (packages/ui/public/info.js): the explanation one tap away instead of on the page. */
.info { position: relative; display: inline-flex; vertical-align: middle; margin-left: 2px; }
.info-btn { width: 44px; height: 44px; margin: -12px -10px; display: inline-flex; user-select: none; -webkit-user-select: none; align-items: center; justify-content: center; border: 0; background: transparent; cursor: help; padding: 0; color: var(--os-muted); }
.info-btn > span { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font: 600 11px/15px var(--os-mono); text-align: center; text-transform: none; letter-spacing: 0; }
.info-btn:hover, .info-btn[aria-expanded=true] { color: var(--os-ink); }
.info-btn:focus { outline: none; }
.info-btn:focus-visible { outline: none; }
.info-btn:focus-visible > span { outline: 2px solid var(--os-accent); outline-offset: 2px; }
.info-pop { position: absolute; z-index: 1200; top: calc(100% + 8px); left: -8px; width: max-content; max-width: min(320px, calc(100vw - 32px)); padding: 10px 12px; border-radius: 10px; background: var(--os-ink); color: var(--os-card); font: 400 13.5px/1.45 var(--os-sans); text-transform: none; letter-spacing: 0; white-space: normal; box-shadow: 0 10px 28px rgba(14, 19, 32, 0.25); text-align: left; }
.info-pop a { color: inherit; text-decoration: underline; }
.info-pop code { font-family: var(--os-mono); font-size: 12.5px; }
.info-pop .info-ul { display: block; margin: 6px 0 0; padding-left: 18px; }
.info-pop .info-li { display: list-item; list-style: disc; }
.info-pop .info-p { display: block; margin: 0 0 6px; }
.info-pop .info-p:last-child { margin: 0; }
.info-pop { max-height: min(70vh, 480px); overflow-y: auto; overscroll-behavior: contain; }
.info-pop .info-dl { display: block; margin: 0; }
.info-pop .info-dt { display: block; font-weight: 600; margin-top: 8px; }
.info-pop .info-dt:first-child { margin-top: 0; }
.info-pop .info-dd { display: block; margin: 2px 0 0; }

/* Keys: the one-step Add form, Connections, and the folded sections. */
.keys-fieldset.keys-fs { display: block; }
.keys-fs > legend .info, .keys-card h2 .info { margin-left: 4px; }
.keys-fs .keys-grid { margin-top: 4px; }
.field .keys-hint { font-weight: 400; color: var(--os-muted); }
.keys-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--os-muted); line-height: 1.4; overflow-wrap: anywhere; }
.keys-hint strong { color: var(--os-ink); font-weight: 600; }
.keys-hint a { color: inherit; text-decoration: underline; }
.keys-choice { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 2px 0 8px; }
.keys-more { margin: 12px 0 0; }
.keys-more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: 14px; }
.keys-more > summary::marker { content: ''; }
.keys-more > summary::before { content: '▸'; margin-right: 8px; color: var(--os-muted); }
.keys-more[open] > summary::before { content: '▾'; }
.keys-fold > summary { cursor: pointer; list-style: none; min-height: 44px; display: flex; align-items: center; }
.keys-fold > summary::-webkit-details-marker { display: none; }
.keys-fold > summary h2 { margin: 0; }
.keys-fold > summary::after { content: 'Show'; margin-left: auto; font-size: 13px; color: var(--os-muted); }
.keys-fold[open] > summary::after { content: 'Hide'; }
.btn-link { border: 0; background: none; color: var(--os-ink); text-decoration: underline; font: inherit; font-size: 14px; min-height: 44px; padding: 0 4px; cursor: pointer; }
.btn-link:focus-visible { outline: 2px solid var(--os-accent); outline-offset: 2px; border-radius: 4px; }
.keys-conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.keys-conn-grid .keys-card { margin: 0; display: flex; flex-direction: column; }
.keys-conn-grid .keys-btns { margin-top: auto; padding-top: 6px; }
.keys-conn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.keys-conn-head h2 { margin: 0; }
.keys-conn p { margin: 8px 0; }
.keys-howto { padding-left: 20px; margin: 0 0 8px; }
.keys-howto > li { margin: 8px 0; }
.keys-howto .field { margin: 4px 0 0; }
.keys-glossary h4 { margin: 14px 0 6px; font-size: 14px; }
.keys-glossary h4:first-child { margin-top: 0; }
.keys-glossary dl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.keys-glossary dt { font-weight: 600; }
.keys-glossary dd { margin: 0; color: var(--os-muted); }
@media (max-width: 560px) { .keys-glossary dl { grid-template-columns: 1fr; } .keys-glossary dd { margin-bottom: 6px; } }
.keys-grid.keys-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .keys-grid.keys-grid-2 { grid-template-columns: 1fr; } }

/* ======================================================================
   Design layer (docs/design-guide.md). Shared by every ResQ OS screen in
   the dock frame. Selectors start at .os-main so they win over the older
   per-module copies loaded after this file. Change the look here.
   ====================================================================== */

/* Page width and rhythm */
.os-main { padding: 28px clamp(16px, 3.5vw, 44px) 56px; }
.os-main > * { max-width: 1240px; }
.os-main .os-section { margin-top: var(--os-s6); }

/* Cards, tabs, chips, stats, buttons and inputs: /ui/modern.css (v2). */
.os-main a.os-card, .os-main button.os-card { transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s; }
.os-main .os-pad, .os-main .os-card.os-pad { padding: var(--os-s5); }

/* Page header: crumbs, title (+ ⓘ), one short line, actions */
.os-main .os-hero.os-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--os-s4); flex-wrap: wrap; margin-bottom: var(--os-s5); }
.os-main .os-hero.os-head:has(+ nav) { margin-bottom: var(--os-s3); }
.os-head-main { min-width: 0; flex: 1 1 320px; }
.os-main .os-hero h1 { font-size: clamp(24px, 3.2vw, 30px); font-weight: 600; letter-spacing: -0.015em; margin: 0; line-height: 1.2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.os-main .os-hero h1 .info { margin-left: 2px; }
.os-sub { margin: 6px 0 0; color: var(--os-muted); font-size: 14.5px; line-height: 1.45; }
.os-head-actions { display: flex; gap: var(--os-s2); flex-wrap: wrap; align-items: center; }
.os-main .os-hero > .os-label, .os-main .os-hero > div > .os-label { margin-bottom: 8px; }

/* Breadcrumbs */
.os-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0 0 8px; padding: 0; font: 500 12px/1.2 var(--os-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--os-muted); }
.os-crumbs li { display: inline-flex; align-items: center; }
.os-crumbs li + li::before { content: '›'; margin: 0 8px; color: var(--os-line); font-size: 15px; letter-spacing: 0; }
.os-main .os-crumbs a { display: inline-flex; align-items: center; min-height: 28px; color: var(--os-muted); text-decoration: none; }
.os-main .os-crumbs a:hover { color: var(--os-ink); text-decoration: underline; }
.os-crumbs [aria-current=page] { color: var(--os-ink); }

/* Section header: label + ⓘ + count, actions on the right */
.os-sec { display: flex; align-items: center; justify-content: space-between; gap: var(--os-s3); flex-wrap: wrap; margin: var(--os-s6) 0 var(--os-s3); min-height: 32px; }
.os-main > div > .os-sec:first-child, .os-hero + .os-sec, nav + .os-sec { margin-top: 0; }
.os-sec-title { margin: 0; display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1.2 var(--os-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--os-muted); }
.os-sec-actions { display: flex; gap: var(--os-s2); flex-wrap: wrap; align-items: center; }
.os-main .os-label { letter-spacing: 0.08em; }

/* Workflow bubbles */
.os-steps { list-style: none; display: flex; margin: 0 0 var(--os-s5); padding: 14px 16px; gap: 0; background: var(--os-card); border: 1px solid var(--os-line); border-radius: var(--os-radius); box-shadow: var(--os-shadow-sm); overflow-x: auto; scrollbar-width: none; counter-reset: none; }
.os-step { flex: 1 1 0; min-width: 104px; position: relative; display: flex; }
.os-step > a, .os-step > .os-step-dot { color: inherit; }
.os-step > a { display: flex; flex-direction: column; align-items: center; width: 100%; text-decoration: none !important; }
.os-step { flex-direction: column; align-items: center; text-align: center; }
.os-step > a { gap: 6px; }
.os-step:not(:has(> a)) { gap: 6px; }
.os-step::before { content: ''; position: absolute; top: 14px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--os-line); border-radius: 2px; }
.os-step:first-child::before { display: none; }
.os-step-done::before, .os-step-current::before { background: var(--os-navy); }
.os-step-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 12.5px var(--os-mono); background: var(--os-card); border: 2px solid var(--os-line); color: var(--os-muted); position: relative; z-index: 1; }
.os-step-dot .i { font-size: 14px; }
.os-step-done .os-step-dot { background: var(--os-navy); border-color: var(--os-navy); color: #fff; }
.os-step-current .os-step-dot { border-color: var(--os-accent); color: var(--os-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--os-accent) 16%, transparent); }
.os-step-error .os-step-dot { background: var(--os-gap-bg); border-color: var(--os-gap-ink); color: var(--os-gap-ink); }
.os-step-label { font-size: 13px; font-weight: 500; color: var(--os-muted); line-height: 1.3; display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.os-step-label small { font: 400 11.5px var(--os-mono); color: var(--os-muted); }
.os-step-current .os-step-label, .os-step-done .os-step-label { color: var(--os-ink); }
.os-step-current .os-step-label { font-weight: 600; }

/* Overflow menu (more()) */
.os-more { position: relative; display: inline-block; }
.os-more > summary { list-style: none; cursor: pointer; min-width: 44px; justify-content: center; }
.os-more > summary::-webkit-details-marker { display: none; }
.os-more-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 300; min-width: 200px; padding: 6px; background: var(--os-card); border: 1px solid var(--os-line); border-radius: 12px; box-shadow: var(--os-shadow-lg); display: flex; flex-direction: column; }
.os-more-pop :is(button, a) { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--os-ink); font: 500 14px var(--os-sans); text-align: left; text-decoration: none !important; cursor: pointer; white-space: nowrap; box-shadow: none; }
.os-more-pop :is(button, a):hover, .os-more-pop :is(button, a):focus-visible { background: var(--os-hover); outline: none; }
.os-more-pop .danger, .os-more-pop [data-danger] { color: var(--os-gap-ink); }
.os-more-pop hr { border: 0; border-top: 1px solid var(--os-line); margin: 4px 0; }

/* Folded cards (fold()): settings groups and read-once detail */
.os-fold { padding: 0; }
.os-fold + .os-fold { margin-top: var(--os-s3); }
.os-fold > summary { list-style: none; display: flex; align-items: center; gap: var(--os-s3); min-height: 60px; padding: 10px 20px; cursor: pointer; border-radius: var(--os-radius); }
.os-fold > summary::-webkit-details-marker { display: none; }
.os-fold > summary:hover { background: var(--os-hover); }
.os-fold > summary:focus-visible { outline: 2px solid var(--os-accent); outline-offset: -2px; }
.os-fold-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15.5px; display: flex; flex-direction: column; gap: 2px; }
.os-fold-title small { font-weight: 400; font-size: 13.5px; color: var(--os-muted); }
.os-fold-status { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.os-fold-chev { color: var(--os-muted); transition: transform 0.15s; }
.os-fold[open] > summary { border-bottom: 1px solid var(--os-line); border-radius: var(--os-radius) var(--os-radius) 0 0; }
.os-fold[open] .os-fold-chev { transform: rotate(180deg); }
.os-fold-body { padding: 18px 20px 20px; }
.os-fold-body > * + * { margin-top: 14px; }
.os-help-line { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--os-muted); font-size: 13.5px; }

/* Tables */
.os-main .rid-table th, .os-main .rid-table td { padding: 12px 14px; }
.os-main .rid-table tbody tr { transition: background 0.1s; }
.os-main .rid-table tbody tr:hover { background: var(--os-hover); }
.os-main .rid-table-wrap { overflow: auto; }

/* Lists inside cards */
.os-main .rid-list li { padding: 10px 0; }
.os-main .os-card > .rid-list li:first-child { border-top: 0; }

/* Links that act as buttons, and form fields (button and input looks: /ui/modern.css) */
.os-main .btn-link, .os-main .link-btn { min-height: 44px; }
.os-main .field { margin-bottom: var(--os-s4); }
.os-main .field > label, .os-main label.field > span:first-child { font-weight: 500; }
.os-main .field small, .os-main .hint { color: var(--os-muted); }

/* Help that used to be paragraphs: one muted line, the rest behind ⓘ */
.os-main .os-help-text { color: var(--os-muted); font-size: 13.5px; line-height: 1.45; margin: 4px 0 0; max-width: 72ch; }

/* Setup notice: one line, the list folds open */
.setup-notice { border-radius: 12px; box-shadow: var(--os-shadow-sm); padding: 0; }
.setup-notice > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.setup-notice > summary::-webkit-details-marker { display: none; }
.setup-notice > summary::after { content: '▾'; margin-left: auto; opacity: 0.7; }
.setup-notice[open] > summary::after { content: '▴'; }
.setup-notice > div { padding: 0 16px 12px; }

/* Empty states */
.os-main .os-empty, .os-main [class$=-empty] { color: var(--os-muted); }

/* Modals share the card look */

@media (max-width: 700px) {
  .os-main { padding: 20px 16px 96px; }
  .os-main .os-hero.os-head { align-items: flex-start; }
  .os-head-actions { width: 100%; }
  .os-steps { padding: 12px 8px; }
  .os-step { min-width: 84px; }
  .os-step-label { font-size: 12px; }
  .os-fold > summary { padding: 10px 14px; }
  .os-fold-body { padding: 14px; }
}
/* A section header that opens a section adds no second gap. */
.os-section > .os-sec:first-child, .os-card > .os-sec:first-child { margin-top: 0; }
/* Workflow bubbles inside a card: flat, no second frame. */
.os-card .os-steps, .os-steps.os-steps-flat { background: none; border: 0; box-shadow: none; padding: 8px 0; margin: 0 0 12px; }

/* My to-dos on Home */
.home-todos { padding: 12px 16px; }
.home-todo-sums { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.home-todo-sum { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; background: var(--bg-soft, transparent); }
.home-todo-sum:hover { border-color: var(--accent); }
.home-todo-count { margin: 0 0 6px; font-size: 13px; }
.home-todo-list { list-style: none; margin: 0; padding: 0; }
.home-todo { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.home-todo:first-child { border-top: 0; }
.home-todo-src { font-family: var(--os-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-right: 6px; }
.home-todo-main a { color: inherit; font-weight: 600; }
@media (max-width: 640px) {
  .home-todo { grid-template-columns: 1fr auto; }
  .home-todo-due { grid-column: 1 / -1; }
}

/* Vendors (Session 10): the shared vendor record. */
.vnd-stats { margin: 0 0 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.vnd-pick { width: 44px; }
.vnd-pick input { width: 18px; height: 18px; }
.vnd-bulk { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 16px; margin: 0 0 12px; }
.vnd-bulk [data-bulk-count] { font-weight: 600; margin-right: auto; }
.vnd-bulk-list { max-height: 50vh; overflow: auto; margin: 0 0 12px; }
.vnd-why { display: block; }
.vnd-bulk-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.vnd-bulk-form .field { flex: 1 1 240px; margin: 0; }
.vnd-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.vnd-filters .field { min-width: 160px; flex: 1; margin: 0; }
.vnd-dl { margin: 8px 0 0; display: grid; gap: 8px; }
.vnd-dl > div { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 8px; align-items: center; }
.vnd-dl dt { color: var(--os-muted); font-size: 13px; }
.vnd-dl dd { margin: 0; overflow-wrap: anywhere; }
.vnd-pre { white-space: pre-wrap; }
.vnd .rid-list li .btn.small, .vnd .rid-table .btn.small { min-height: 44px; }
.vnd-reviews { list-style: none; padding: 0; display: grid; gap: 12px; }
.vnd-review { padding: 16px; }
.vnd-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.vnd-review .rid-actions { flex-wrap: wrap; }
@media (max-width: 640px) {
  .vnd .rid-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .vnd .rid-table, .vnd .rid-table tbody, .vnd .rid-table tr, .vnd .rid-table th, .vnd .rid-table td { display: block; width: 100%; box-sizing: border-box; }
  .vnd .rid-table tr { border-top: 1px solid var(--os-line); padding: 8px 0; }
  .vnd .rid-table td[data-label]::before { content: attr(data-label); display: block; font: 500 11px var(--os-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--os-muted); }
  .vnd-dl > div, .vnd-pair { grid-template-columns: 1fr; }
}

/* Entities → Business tab (entity-profile.js): tabs, module switches. Tokens only. */
.ent-rec-tabs { margin: 0 0 var(--os-s4, 16px); }
.ent-fieldset { border: 1px solid var(--os-line); border-radius: 8px; padding: 8px 12px 10px; margin: 0 0 12px; display: grid; gap: 6px; }
.ent-fieldset legend { font: 500 13px var(--os-sans); color: var(--os-muted); padding: 0 4px; }
.ent-toggles { list-style: none; margin: 0; padding: 0; display: grid; }
.ent-toggles li + li { border-top: 1px solid var(--os-line); }
.ent-toggle { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; min-height: 44px; cursor: pointer; }
.ent-toggle input { margin-top: 3px; flex: none; }
.ent-toggle input:disabled { cursor: not-allowed; }
.ent-toggle-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.ent-toggle-title { font-weight: 500; }
.ent-toggle-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .ent-toggle { flex-wrap: wrap; } .ent-toggle-tags { width: 100%; justify-content: flex-start; padding-left: 28px; } }
/* People & access: where a permission applies (entities and their brands). */
.rid-fieldset { border: 1px solid var(--os-line); border-radius: 8px; padding: 0 12px 4px; margin: 0 0 8px; }
.rid-fieldset legend { padding: 0 4px; }
.rid-indent { padding-left: 28px; }
