/* Final workspace theme layer. Palette only: state and persistence stay in the existing app. */
html[data-rf-theme="light"] {
  --canvas: #ffffff;
  --sidebar: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #f4f4f6;
  --text: #242529;
  --muted: #60636c;
  --faint: #747882;
  --border: #e4e5e8;
  --border-strong: #cfd1d7;
  --primary: #191a1e;
  --rf-theme-link: #215fc7;
  --rf-theme-hover: #ededef;
  --rf-theme-selected: #e7e8ed;
  --rf-theme-raised: #ffffff;
  --rf-theme-shadow: 0 12px 32px #16182016, 0 2px 5px #1618200b;
  --shadow: var(--rf-theme-shadow);
  --green: #246640;
  --green-soft: #e3f4e9;
  --amber: #79520b;
  --amber-soft: #fff2cf;
  --red: #ad3545;
  --red-soft: #ffedf0;
}

html[data-rf-theme="dark"] {
  --canvas: #101112;
  --sidebar: #101112;
  --surface: #17181a;
  --surface-soft: #1d1f22;
  --text: #e7e8ec;
  --muted: #a7a9b2;
  --faint: #8b8e99;
  --border: #2b2d32;
  --border-strong: #40434b;
  --primary: #f0f1f5;
  --rf-theme-link: #82b1ff;
  --rf-theme-hover: #222428;
  --rf-theme-selected: #292c32;
  --rf-theme-raised: #202226;
  --rf-theme-shadow: 0 12px 32px #00000055, 0 1px 3px #00000044;
  --shadow: var(--rf-theme-shadow);
  --green: #a5e9c5;
  --green-soft: #173d2e;
  --amber: #ffdb80;
  --amber-soft: #433415;
  --red: #ffc0c8;
  --red-soft: #48242a;
  color-scheme: dark;
}

/* Neutral defaults also undo older blue-grey hardcoded component colours. */
html[data-rf-theme] body { background:var(--canvas); color:var(--text); }
html[data-rf-theme] body :is(.app-shell,.main,.content,.pui-content,.overview-content,.task-overview,.record-main,.rfp-page,.board,.deals-content,.mkt-content) { background:var(--canvas); color:var(--text); }
html[data-rf-theme] body :is(.sidebar,.sidebar-bottom) { background:var(--sidebar); border-color:var(--border); color:var(--text); }
html[data-rf-theme] body :is(.topbar,.viewbar,.toolbar,.table-footer,.content-footer,.pui-subnav,.mkt-projectbar,.mkt-areas,.mkt-tabs) { background:var(--canvas); border-color:var(--border); color:var(--muted); }
html[data-rf-theme] body :is(.main h1,.main h2,.main h3,.modal h2,.modal h3,.main strong,.workspace-label b,.user-button b,.breadcrumbs strong,.rfp-card h3,.rfp-detail h3,.rfp-metrics strong) { color:var(--text); }
html[data-rf-theme] body .main :is(p,small,time,label,dt,dd) { color:inherit; }
html[data-rf-theme] body :is(.muted,.eyebrow,.workspace-label small,.user-button small,.local-badge,.local-indicator,.table-count,.table-footer-hint,.board-drag-hint,.form-field>span,.pui-check,.column-options label,.rfp-card p,.rfp-empty,.rfp-footer,.rfp-note,.rfp-notice,.rfp-legend) { color:var(--muted); }
html[data-rf-theme] body :is(a:not(.btn):not(.nav-item):not(.mkt-list-row):not(.pui-list-item),.link-color,.pui-record-name,.company-domain-link:not(.is-example)) { color:var(--rf-theme-link); }
html[data-rf-theme] body :is(.row-name,.company-domain-link.is-example,.rfp-record,.deal-record-link,.record-aside .linked-record) { color:var(--text); }
html[data-rf-theme] body :is(.row-name:hover,.pui-record-name:hover,.company-domain-link:not(.is-example):hover,.overview-record-link:hover,.text-btn) { color:var(--rf-theme-link); }
html[data-rf-theme] body :is(button,a,input,select,textarea,[tabindex]):focus-visible { outline:2px solid var(--rf-theme-link); outline-offset:2px; }
html[data-rf-theme] ::selection { background:var(--rf-theme-selected); color:var(--text); }
html[data-rf-theme] :is(input,textarea)::placeholder { color:var(--faint); opacity:1; }
html[data-rf-theme] :is(input,select,textarea) { accent-color:var(--rf-accent,#266df0); }
html[data-rf-theme] body :is(.input,.search-input,.sidebar-search,.inline-editor,.attribute-input,.command-search input,.rfs-cell-input) { background:var(--surface); color:var(--text); border-color:var(--border-strong); box-shadow:none; }
html[data-rf-theme] body :is(.input,.search-input,.sidebar-search):focus-within { border-color:var(--rf-theme-link); }
html[data-rf-theme] body :is(.cell.editing,.name-cell.editing,.attribute-value.editing) { background:var(--surface)!important; border-color:var(--rf-theme-link)!important; box-shadow:0 0 0 1px var(--rf-theme-link); }
html[data-rf-theme] body :is(.cell,.attribute-value):focus-within { outline:2px solid var(--rf-theme-link); outline-offset:1px; }
html[data-rf-theme] body .inline-editor { background:transparent!important; color:var(--text); }

/* Compact controls. Primary actions keep the user's persisted accent. */
html[data-rf-theme] body .btn { background:var(--surface); border-color:var(--border-strong); color:var(--text); box-shadow:none; }
html[data-rf-theme] body .btn:hover { background:var(--rf-theme-hover); border-color:var(--border-strong); color:var(--text); }
html[data-rf-theme] body :is(.btn.primary,.quick-note-footer .btn) { background:var(--rf-accent,#266df0); border-color:var(--rf-accent,#266df0); color:var(--rf-accent-contrast,#fff); }
html[data-rf-theme] body .btn.primary:hover { filter:brightness(1.08); }
html[data-rf-theme] body .btn.ghost { background:transparent; border-color:transparent; color:var(--muted); }
html[data-rf-theme] body :is(.btn.ghost:hover,.icon-btn:hover,.workspace-switch:hover,.user-button:hover,.profile-button:hover) { background:var(--rf-theme-hover); color:var(--text); }
html[data-rf-theme] body .btn.danger { background:var(--red-soft); border-color:var(--red-soft); color:var(--red); }
html[data-rf-theme] body .icon-btn { color:var(--muted); }
html[data-rf-theme] body button:disabled { opacity:.48; filter:none; }
html[data-rf-theme] body :is(.modal,.dropdown-menu,.command-modal,.rfp-dialer,.rfp-dialer.rfc-panel) { background:var(--surface); border:1px solid var(--border-strong); color:var(--text); box-shadow:var(--rf-theme-shadow); }
html[data-rf-theme="dark"] body .modal-backdrop { background:#00000099; }
html[data-rf-theme] body :is(.modal-header,.modal-footer,.command-search,.command-footer,.form-actions,.rfc-header,.rfp-dialer>header) { background:transparent; border-color:var(--border); color:var(--muted); }
html[data-rf-theme] body :is(.command-item,.command-item>svg,.command-label,.command-footer) { color:var(--muted); }
html[data-rf-theme] body :is(.command-item:hover,.command-item.selected,.command-item[aria-selected=true]) { background:var(--rf-theme-selected); color:var(--text); }
html[data-rf-theme] body kbd { background:var(--surface-soft); border-color:var(--border-strong); color:var(--muted); box-shadow:none; }
html[data-rf-theme] body .toast { background:var(--rf-theme-raised); color:var(--text); border:1px solid var(--border-strong); box-shadow:var(--rf-theme-shadow); }
html[data-rf-theme] body :is(.toast.error,.error,.rfs-toolbar #rf-sheet-status.error) { color:var(--red); }

/* Panels and records stay neutral; colour is reserved for meaning and actions. */
html[data-rf-theme] body :is(.deal-card,.pui-kanban-card,.detail-note-composer,.detail-note-card,.detail-email-card,.linked-record,.rich-editor,.pui-card,.pui-list,.pui-catalog-card,.pui-settings-panel,.pui-flow-node,.report-panel,.metric-card,.report-card,.report-metrics>article,.summary-card,.overview-note-card,.notification-card,.notification-card.read,.mkt-panel,.mkt-empty,.mkt-list-row,.mkt-catalog article,.mkt-sources article,.rfp-card,.rfp-tag-grid>button,.rfp-contact-choice) { background:var(--surface); color:var(--text); border-color:var(--border); box-shadow:none; }
html[data-rf-theme] body :is(.welcome-card,.pui-notice,.pui-date-view>section,.pui-chat-messages article,.mkt-intro,.mkt-note,.rfp-summary,.rfp-flow section,.rfp-player,.rfc-demo-note) { background:var(--surface-soft); background-image:none; color:var(--muted); border-color:var(--border); }
html[data-rf-theme] body .pui-chat-messages article.user { background:var(--rf-theme-selected); }
html[data-rf-theme] body :is(.rich-editor-body,.quick-note-title,.note-composer textarea,.rich-content,.email-text,.timeline-text,.timeline-text p,.attribute-value,.record-main .task-title,.rfp-transcript b,.rfp-summary b) { color:var(--text); background-color:transparent; }
html[data-rf-theme] body :is(.record-aside,.pui-settings>aside) { background:var(--canvas); border-color:var(--border); }
html[data-rf-theme] body :is(.record-aside .attribute-row>label,.relationship-group h3,.record-timestamps,.deal-card-company,.deal-card-date,.board-column .board-total,.board-column-name>span,.record-main .task-meta,.record-main .timeline-title time,.detail-note-card time,.detail-email-card header p) { color:var(--muted); }
html[data-rf-theme] body :is(.rich-editor-toolbar,.quick-note-footer,.pui-flow-trigger,.pui-order-item,.deal-stage-control,.board-empty-column) { background:var(--surface-soft); border-color:var(--border); color:var(--muted); }
html[data-rf-theme] body :is(.deal-card-divider,.timeline-item:before) { background:var(--border); }
html[data-rf-theme] body .board-column.drag-over { background:var(--rf-theme-selected); outline-color:var(--rf-theme-link); }
html[data-rf-theme] body :is(.empty-icon,.record-identity-icon,.timeline-icon,.pui-symbol,.pui-catalog-icon,.chart-icon,.notification-symbol,.relationship-icon,.mini-company,.company-logo) { background:var(--surface-soft); color:var(--muted); border-color:var(--border); }
html[data-rf-theme] body :is(.pui-content pre,.pui-result pre,.modal pre) { background:var(--canvas); color:var(--text); border-color:var(--border); }
html[data-rf-theme] body .main svg text { fill:var(--muted); }
html[data-rf-theme] body .skeleton { background:var(--surface-soft); background-image:none; animation:none; }

/* Tables use the same ground as the page, including sticky cells. */
html[data-rf-theme] body :is(.data-table,.pui-table,.mkt-table,.rfp-table,.rfs-table) { background:var(--canvas); color:var(--text); }
html[data-rf-theme] body :is(.data-table th,.crm-table th.name-col,.crm-table th.select-col,.pui-table th,.mkt-table th,.rfp-table th,.rfs-table th) { background:var(--surface); color:var(--muted); border-color:var(--border); font-size:11.5px; }
html[data-rf-theme] body :is(.data-table td,.crm-table .name-col,.crm-table .select-col,.pui-table td,.pui-table td:first-child,.mkt-table td,.rfp-table td,.rfs-table td) { background:var(--canvas); color:var(--text); border-color:var(--border); }
html[data-rf-theme] body :is(.data-table tr:hover td,.pui-table tr:hover td,.rfp-table tr:hover td,.mkt-list-row:hover) { background:var(--rf-theme-hover); }
html[data-rf-theme] body .crm-table tr.selected>td { background:var(--rf-theme-selected); }
html[data-rf-theme] body :is(.crm-table .row-name,.crm-table .numeric,.crm-table .date-cell,.crm-table .owner-label,.crm-table .related-label,.crm-table td .cell) { color:var(--text); }
html[data-rf-theme] body :is(.crm-table td .cell:hover,.attribute-value:hover) { background:var(--rf-theme-hover); border-color:var(--border-strong); }
html[data-rf-theme] body :is(.filter-chip,.bulk-toolbar,.table-filter-chips.has-filters) { background:var(--surface-soft); border-color:var(--border); color:var(--muted); }
html[data-rf-theme] body :is(.rfs-card,.rfs-editor,.rfs-cell-input,.rfs-formula-bar,.rfs-footer,.suite-document-meta,.suite-editor-toolbar,.suite-rich-editor,.suite-editor-content>.suite-footnote) { background:var(--surface); color:var(--text); border-color:var(--border); }
html[data-rf-theme] body :is(.suite-editor-content,.suite-paper-preview) { background:var(--canvas); color:var(--muted); }
html[data-rf-theme] body :is(.suite-rich-editor h1,.suite-rich-editor h2,.suite-rich-editor h3,.rfs-title,.suite-document-title) { color:var(--text); }
html[data-rf-theme] body :is(.rfs-card small,.rfs-toolbar #rf-sheet-status,.rfs-fx,.rfs-footer span,.suite-footnote,.suite-breadcrumbs a) { color:var(--muted); }
html[data-rf-theme] body :is(.rfs-title:hover,.rfs-title:focus,.rfs-table td:focus,.rfs-table td.rfs-selected) { background:var(--rf-theme-selected); color:var(--text); }
html[data-rf-theme] body .rfs-table td:focus,html[data-rf-theme] body .rfs-table td.rfs-selected { box-shadow:inset 0 0 0 2px var(--rf-theme-link); }
html[data-rf-theme] body :is(.mail-app,.mail-message-list,.mail-reading-header) { background:var(--canvas); color:var(--text); border-color:var(--border); }
html[data-rf-theme] body :is(.mail-folders,.mail-search,.mail-row,.mail-pagination,.mail-attachment) { border-color:var(--border); }
html[data-rf-theme] body :is(.mail-row:hover,.mail-row.selected,.mail-folders a:hover,.mail-folders a.active,.suite-drive-nav a.active,.suite-view-toggle .active) { background:var(--rf-theme-selected); color:var(--text); }
html[data-rf-theme] body :is(.rfp-key,.rfc-key) { background:var(--surface-soft); color:var(--text); border-color:var(--border); }
html[data-rf-theme] body :is(.rfp-key:hover,.rfc-key:hover,.rfc-inbox-call:hover) { background:var(--rf-theme-selected); }
html[data-rf-theme] body :is(.rfp-timer,.rfp-phone-body>h3,.rfp-dialer>header strong,.rfp-call-person p,.rfp-check,.rfp-flow b,.rfp-outcome b) { color:var(--text); }
html[data-rf-theme] body :is(.rfc-main-tabs>button.active,.rfc-detail-tabs>button.active,.rfc-small-tabs>button.active,.pui-subnav a.active,.view-tab.active,.overview-tab.active,.deal-view-switch button.active) { background:var(--rf-theme-selected); color:var(--rf-theme-link); }

/* Accordion navigation occupies the existing sidebar in both work and settings mode. */
#rf-sidebar-navigation { display:flex; flex-direction:column; gap:3px; padding:0; min-width:0; }
.rf-nav-group { margin:7px 0 0; padding:0; min-width:0; }
.rf-nav-heading { margin:0; padding:0; font:inherit; line-height:inherit; color:inherit; }
.rf-nav-mode-label { padding:5px 8px 9px; color:var(--muted); font-size:11px; font-weight:600; }
.rf-nav-group-toggle { width:100%; min-height:31px; padding:6px 8px; display:flex; align-items:center; gap:8px; border:0; border-radius:5px; background:transparent; text-align:left; color:var(--muted); font-size:12px; font-weight:550; line-height:1.4; }
.rf-nav-group-label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rf-nav-group-toggle>svg:first-child { width:16px; height:16px; flex-shrink:0; color:var(--muted); }
.rf-nav-chevron { display:inline-flex; width:13px; height:13px; flex-shrink:0; color:var(--faint); transform:rotate(-90deg); transition:transform .12s ease; }
.rf-nav-group-toggle[aria-expanded="true"] { color:var(--text); }
.rf-nav-group-toggle[aria-expanded="true"] .rf-nav-chevron { transform:rotate(0); }
.rf-nav-group-toggle:hover { background:var(--rf-theme-hover); color:var(--text); }
.rf-nav-group-items { display:flex; flex-direction:column; gap:1px; padding:3px 0 4px; }
.rf-nav-group-items[hidden] { display:none!important; }
html[data-rf-theme] body :is(.nav-item,.rf-nav-item) { min-height:31px; border-radius:5px; color:var(--muted); font-size:12px; }
html[data-rf-theme] body .rf-nav-group-items .nav-item { padding:6px 9px 6px 15px; gap:9px; }
html[data-rf-theme] body :is(.nav-item svg,.rf-nav-item svg) { color:currentColor; width:16px; height:16px; }
html[data-rf-theme] body :is(.nav-item:hover,.rf-nav-item:hover) { background:var(--rf-theme-hover); color:var(--text); text-decoration:none; }
html[data-rf-theme] body :is(.nav-item.active,.rf-nav-item[aria-current="page"]) { background:var(--rf-theme-selected); color:var(--text); box-shadow:none; }
html[data-rf-theme] body .nav-item.active>svg { color:var(--rf-theme-link); }
html[data-rf-theme] body .nav-item .nav-count { background:var(--surface-soft); color:var(--muted); font-size:10.5px; }
.rf-nav-back { display:flex; align-items:center; gap:8px; min-height:32px; padding:7px 8px; margin:2px 0 8px; font-size:12px; font-weight:550; border-bottom:1px solid var(--border); color:var(--muted)!important; }
.rf-nav-back:hover { color:var(--text)!important; text-decoration:none; }
.rf-nav-settings { margin-top:10px; padding:7px 8px; border-top:1px solid var(--border); }
.rf-workspace-menu { min-height:39px; border-radius:6px; }
.rf-workspace-menu .workspace-label { gap:2px; }
.rf-workspace-menu .workspace-label b { font-size:12px; }
.rf-workspace-menu .workspace-label small { font-size:11px; }
html[data-rf-theme] body .pui-settings { display:block; grid-template-columns:minmax(0,1fr); gap:0; }
html[data-rf-theme] body .pui-settings-main { display:block; width:100%; min-width:0; }
html[data-rf-theme] body .pui-settings>aside { display:none; }
html[data-rf-theme] body .pui-settings-panel { width:100%; max-width:900px; margin-left:0; }
html[data-rf-theme] body .pui-settings-panel input[readonly] { background:var(--surface-soft); color:var(--muted); }
.sidebar.collapsed .rf-nav-group-items { display:none; }
.sidebar.collapsed :is(.rf-nav-group-toggle,.rf-nav-back) { justify-content:center; padding:8px 4px; }
.sidebar.collapsed :is(.rf-nav-group-label,.rf-nav-chevron,.rf-nav-back>span) { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.sidebar.collapsed .rf-nav-settings>span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.sidebar.collapsed #rf-sidebar-navigation .nav-item>span:not(.nav-count) { display:block!important; position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.sidebar.collapsed .rf-nav-group-toggle>svg:first-child { width:18px; height:18px; }

/* Deterministic category colours: readable light and dark pairs, no external assets. */
html[data-rf-theme] :is(.badge,.status-pill,.tag,.industry-label,.pui-tag,.company-category) { --rf-chip-bg:var(--surface-soft); --rf-chip-fg:var(--muted); --rf-chip-border:var(--border); background:var(--rf-chip-bg); color:var(--rf-chip-fg); border:1px solid var(--rf-chip-border); border-radius:4px; font-size:11px; line-height:1.55; padding:1px 6px; font-weight:500; }
html[data-rf-theme] .company-category { --rf-chip-bg:hsl(var(--rf-tag-hue,220) 72% 94%); --rf-chip-fg:hsl(var(--rf-tag-hue,220) 56% 32%); --rf-chip-border:hsl(var(--rf-tag-hue,220) 52% 85%); }
html[data-rf-theme="dark"] .company-category { --rf-chip-bg:hsl(var(--rf-tag-hue,220) 40% 22%); --rf-chip-fg:hsl(var(--rf-tag-hue,220) 92% 83%); --rf-chip-border:hsl(var(--rf-tag-hue,220) 38% 34%); }
html[data-rf-theme="light"] :is([data-tone="blue"],.badge.blue,.status-pill.blue) { --rf-chip-bg:#e8f0ff; --rf-chip-fg:#164baf; --rf-chip-border:#ccddff; }
html[data-rf-theme="light"] :is([data-tone="violet"],.badge.violet,.status-pill.violet) { --rf-chip-bg:#eee8ff; --rf-chip-fg:#5d2fad; --rf-chip-border:#dccffa; }
html[data-rf-theme="light"] [data-tone="cyan"] { --rf-chip-bg:#ddf5fc; --rf-chip-fg:#006580; --rf-chip-border:#b5e7f4; }
html[data-rf-theme="light"] [data-tone="teal"] { --rf-chip-bg:#dff5ef; --rf-chip-fg:#075f50; --rf-chip-border:#b7e5d9; }
html[data-rf-theme="light"] :is([data-tone="green"],.badge.green,.status-pill.green) { --rf-chip-bg:#e3f4de; --rf-chip-fg:#2b6120; --rf-chip-border:#c7e5bc; }
html[data-rf-theme="light"] :is([data-tone="amber"],.badge.amber,.status-pill.amber) { --rf-chip-bg:#fff2cf; --rf-chip-fg:#79520b; --rf-chip-border:#f2dea8; }
html[data-rf-theme="light"] [data-tone="pink"] { --rf-chip-bg:#ffe5f2; --rf-chip-fg:#a12a65; --rf-chip-border:#f4c4df; }
html[data-rf-theme="light"] :is([data-tone="red"],.badge.red,.status-pill.red) { --rf-chip-bg:#ffedf0; --rf-chip-fg:#ad3545; --rf-chip-border:#f5cbd3; }
html[data-rf-theme="dark"] :is([data-tone="blue"],.badge.blue,.status-pill.blue) { --rf-chip-bg:#152c51; --rf-chip-fg:#9fc4ff; --rf-chip-border:#254875; }
html[data-rf-theme="dark"] :is([data-tone="violet"],.badge.violet,.status-pill.violet) { --rf-chip-bg:#302047; --rf-chip-fg:#d1b4ff; --rf-chip-border:#513778; }
html[data-rf-theme="dark"] [data-tone="cyan"] { --rf-chip-bg:#123840; --rf-chip-fg:#8ce5f5; --rf-chip-border:#225562; }
html[data-rf-theme="dark"] [data-tone="teal"] { --rf-chip-bg:#143a32; --rf-chip-fg:#91e5cd; --rf-chip-border:#245647; }
html[data-rf-theme="dark"] :is([data-tone="green"],.badge.green,.status-pill.green) { --rf-chip-bg:#263e20; --rf-chip-fg:#b4ed9d; --rf-chip-border:#3c5c32; }
html[data-rf-theme="dark"] :is([data-tone="amber"],.badge.amber,.status-pill.amber) { --rf-chip-bg:#433415; --rf-chip-fg:#ffdb80; --rf-chip-border:#665026; }
html[data-rf-theme="dark"] [data-tone="pink"] { --rf-chip-bg:#432339; --rf-chip-fg:#ffb4dc; --rf-chip-border:#683550; }
html[data-rf-theme="dark"] :is([data-tone="red"],.badge.red,.status-pill.red) { --rf-chip-bg:#48242a; --rf-chip-fg:#ffc0c8; --rf-chip-border:#6c3540; }
html[data-rf-theme] body :is(.crm-table .tag,.crm-table .industry-label,.crm-table .badge,.attribute-value .badge) { background:var(--rf-chip-bg); color:var(--rf-chip-fg); border-color:var(--rf-chip-border); font-size:11px; }
html[data-rf-theme] body :is(.main,.modal,.rfp-dialer) :is(.badge,.status-pill,.tag,.industry-label,.pui-tag,.company-category) { background:var(--rf-chip-bg); color:var(--rf-chip-fg); border-color:var(--rf-chip-border); }
html[data-rf-theme] body .main :is(.muted,.eyebrow,.table-count,.table-footer-hint,.board-drag-hint,.form-field>span,.aside-heading,.feed-heading,.detail-empty p,.record-timestamps) { color:var(--muted); }
html[data-rf-theme] body .detail-tab.active { color:var(--rf-theme-link); box-shadow:0 2px 0 var(--rf-theme-link); }

/* Local corporate glyphs are kept crisp, with a neutral fallback and no inversion. */
.company-brand { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; flex:0 0 auto; overflow:hidden; border:1px solid var(--rf-chip-border,var(--border)); border-radius:7px; background:var(--rf-chip-bg,var(--rf-brand-bg,var(--surface-soft))); color:var(--rf-chip-fg,var(--rf-brand-color,var(--text))); vertical-align:middle; }
.company-brand--sm { width:24px; height:24px; border-radius:6px; }
.company-brand--md { width:30px; height:30px; border-radius:7px; }
.company-brand--lg { width:44px; height:44px; border-radius:10px; }
.company-brand-image { display:block; width:100%; height:100%; object-fit:contain; padding:3px; color:inherit; flex-shrink:0; }
.company-brand-fallback { display:block; font-size:11px; line-height:1; letter-spacing:-.03em; font-weight:650; color:inherit; }
.company-brand--lg .company-brand-fallback { font-size:17px; }
.company-brand-theme { background:var(--rf-chip-bg,var(--surface-soft)); color:var(--rf-chip-fg,var(--text)); }
.company-domain-link { font-size:12px; overflow-wrap:anywhere; }
.company-domain-link.is-example { cursor:default; text-decoration:none; }

/* Only the workspace/account dialog behaves as a corner popover. */
html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) { display:block; padding:0; background:transparent; backdrop-filter:none; animation:none; }
html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) .modal { position:fixed; top:74px; left:12px; width:300px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 86px); margin:0; padding:14px; border-radius:8px; overflow:auto; animation:none; box-shadow:var(--rf-theme-shadow); }
html[data-rf-theme] body:has(.app-shell.sidebar-collapsed) .modal-backdrop:has(.rf-workspace-popover) .modal { top:68px; left:8px; }
html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) .modal-header { align-items:center; gap:8px; padding-bottom:10px; margin-bottom:10px; border-bottom:1px solid var(--border); }
html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) .modal-header h2 { font-size:13px; font-weight:600; line-height:1.4; letter-spacing:0; }
html[data-rf-theme] body .rf-workspace-popover { padding:0; margin:0; }
html[data-rf-theme] body .rf-workspace-menu-links { display:flex; flex-direction:column; grid-template-columns:none; gap:2px; margin:0 0 12px; padding:0 0 10px; border-bottom:1px solid var(--border); }
html[data-rf-theme] body .rf-workspace-popover :is(.rf-workspace-menu-links .btn,.workspace-option,#workspace-logout) { width:100%; min-height:34px; justify-content:flex-start; gap:9px; padding:7px 9px; border-color:transparent; background:transparent; border-radius:5px; text-align:left; font-size:12px; font-weight:450; white-space:normal; }
html[data-rf-theme] body .rf-workspace-popover :is(.rf-workspace-menu-links .btn,.workspace-option,#workspace-logout):hover { background:var(--rf-theme-hover); border-color:transparent; }
html[data-rf-theme] body .rf-workspace-popover h3 { margin:0 8px 6px; color:var(--muted); font-size:11px; font-weight:550; letter-spacing:.02em; }
html[data-rf-theme] body .rf-workspace-popover p.muted { margin:9px 8px 12px; font-size:11px; line-height:1.55; }
html[data-rf-theme] body .rf-workspace-popover #workspace-logout { border-top:1px solid var(--border); border-radius:0 0 5px 5px; padding-top:11px; }
/* Workspace-triggered settings dropdown: one vertical menu below the name. */
html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) .modal { padding:6px; }
html[data-rf-theme] body .rf-workspace-menu-section { padding:5px 0; }
html[data-rf-theme] body .rf-workspace-menu-section + .rf-workspace-menu-section { border-top:1px solid var(--border); }
html[data-rf-theme] body .rf-workspace-menu-section .rf-workspace-menu-links { margin:0; padding:0; border:0; }
html[data-rf-theme] body .rf-workspace-menu-section.rf-workspace-menu-links { margin:0; padding:5px 0; border-bottom:0; }
html[data-rf-theme] body .rf-workspace-popover .workspace-option { display:flex; align-items:center; font-weight:600; }
.rf-workspace-avatar { display:inline-flex; flex:0 0 23px; align-items:center; justify-content:center; height:23px; background:#d08c00; color:#fff; font-size:13px; border-radius:6px; }
.rf-workspace-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
.rf-workspace-check { display:inline-flex; color:var(--rf-theme-link); margin-left:auto; }
html[data-rf-theme] body .rf-workspace-popover #workspace-logout { border-top:0; border-radius:5px; padding-top:7px; }

@media (max-width:600px) {
  #rf-sidebar-navigation { gap:2px; }
  .rf-nav-group { margin-top:8px; }
  .rf-nav-group-toggle,.rf-nav-back { min-height:34px; padding:8px 4px; justify-content:center; }
  .rf-nav-group-label,.rf-nav-chevron,.rf-nav-back>span { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .rf-nav-settings>span,.rf-nav-mode-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  #rf-sidebar-navigation .nav-item>span:not(.nav-count) { display:block!important; position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .rf-nav-group-items { padding:3px 0; }
  html[data-rf-theme] body .rf-nav-group-items .nav-item { min-height:34px; justify-content:center; padding:8px 4px; }
  html[data-rf-theme] body .pui-settings-panel { padding:16px; }
  .company-brand--sm { width:23px; height:23px; }
  html[data-rf-theme] body .modal-backdrop:has(.rf-workspace-popover) .modal,
  html[data-rf-theme] body:has(.app-shell.sidebar-collapsed) .modal-backdrop:has(.rf-workspace-popover) .modal { top:64px; left:8px; width:300px; max-width:calc(100vw - 16px); max-height:calc(100dvh - 76px); padding:12px; }
}
/* Mobile navigation overlay */
.app-shell>.rf-nav-scrim { display:none; }
@media (max-width:600px) {
  .app-shell { position:relative; }
  .app-shell>.sidebar { position:fixed; inset:0 auto 0 0; width:61px; height:100dvh; flex:none; z-index:50; overflow-y:auto; overflow-x:hidden; }
  .app-shell>.main { margin-left:61px; width:calc(100% - 61px); min-width:0; }
  .app-shell>.sidebar:not(.collapsed) { width:260px; max-width:calc(100vw - 48px); padding:12px; box-shadow:8px 0 24px #0000001f; }
  .app-shell:not(.sidebar-collapsed)>.rf-nav-scrim { display:block; position:fixed; inset:0 0 0 min(260px, calc(100vw - 48px)); z-index:40; width:auto; height:100dvh; padding:0; margin:0; border:0; border-radius:0; background:#00000066; cursor:pointer; }
  .sidebar .rf-nav-group-toggle { min-height:44px; }
  .sidebar:not(.collapsed) .rf-nav-group-toggle { justify-content:flex-start; padding:10px 8px; gap:9px; }
  .sidebar:not(.collapsed) .rf-nav-group-label { display:block; position:static; width:auto; height:auto; overflow:hidden; clip-path:none; white-space:nowrap; flex:1; text-align:left; }
  .sidebar:not(.collapsed) .rf-nav-chevron { display:inline-flex; position:static; width:14px; height:14px; overflow:visible; clip-path:none; }
  .sidebar:not(.collapsed) .rf-nav-group-items { display:flex; padding:2px 0 5px; }
  .sidebar:not(.collapsed) .rf-nav-group-items[hidden] { display:none!important; }
  html[data-rf-theme] body .sidebar:not(.collapsed) #rf-sidebar-navigation .nav-item { justify-content:flex-start; min-height:40px; padding:9px 10px 9px 16px; gap:9px; }
  .sidebar:not(.collapsed) #rf-sidebar-navigation .nav-item>span:not(.nav-count) { display:block!important; position:static; width:auto; height:auto; overflow:hidden; clip-path:none; white-space:nowrap; flex:1; text-align:left; }
  .sidebar:not(.collapsed) #rf-sidebar-navigation .nav-count { display:inline-flex!important; position:static; width:auto; height:auto; flex:0 0 auto; clip-path:none; }
  .sidebar:not(.collapsed) .rf-nav-mode-label { display:block; position:static; width:auto; height:auto; clip-path:none; white-space:normal; padding:6px 8px 9px; }
  .sidebar:not(.collapsed) .rf-nav-back { justify-content:flex-start; padding:9px 8px; min-height:44px; }
  .sidebar:not(.collapsed) .rf-nav-settings { margin-top:10px; }
  .sidebar:not(.collapsed) .workspace-switch { justify-content:flex-start; min-height:44px; gap:9px; padding:6px; }
  .sidebar:not(.collapsed) .workspace-switch>.brand-mark { display:inline-grid!important; width:30px; height:30px; flex-shrink:0; }
  .sidebar:not(.collapsed) .workspace-switch>.workspace-label { display:flex!important; position:static; width:auto; height:auto; min-width:0; flex:1; clip-path:none; text-align:left; }
  .sidebar:not(.collapsed) .workspace-switch>svg { display:block!important; flex-shrink:0; }
  .sidebar:not(.collapsed) .sidebar-search { min-height:42px; justify-content:flex-start; padding:9px 10px; gap:8px; }
  .sidebar:not(.collapsed) .sidebar-search span { display:inline!important; }
  .sidebar:not(.collapsed) .sidebar-search kbd { display:inline-block!important; margin-left:auto; }
  .sidebar:not(.collapsed) .sidebar-bottom { padding:12px 5px 0; }
  .sidebar:not(.collapsed) .local-indicator { display:flex; }
  .sidebar:not(.collapsed) .local-indicator span { display:inline!important; }
  .sidebar:not(.collapsed) .user-button { justify-content:flex-start; gap:8px; min-height:44px; }
  .sidebar:not(.collapsed) .user-button>span:nth-child(2) { display:flex!important; position:static; width:auto; height:auto; min-width:0; flex:1; clip-path:none; text-align:left; }
}
@media (prefers-reduced-motion:reduce) {
  html[data-rf-theme] *,html[data-rf-theme] *::before,html[data-rf-theme] *::after { scroll-behavior:auto!important; transition:none!important; }
  html[data-rf-theme] body :is(.skeleton,.rfp-skeleton) { animation:none!important; }
}
