/* Shared visual language with CSFreshDesk/Beacon: warm surfaces, charcoal navigation,
   Bradbury maroon primary actions, blue links and focus, and quiet card elevation. */
:root {
    --app-radius: 12px;
    --app-nav-width: 216px;
}

body {
    --app-surface: #fcfcfb;
    --app-canvas: #f2f1ee;
    --app-inset: #f0efec;
    --app-hover: #f3f7fd;
    --app-text: #16191f;
    --app-text-2: #52514e;
    --app-muted: #6f6d67;
    --app-line: rgba(11, 11, 11, .11);
    --app-border: 1px solid var(--app-line);
    --app-brand: #2369bc;
    --app-brand-fill: #2a78d6;
    --app-brand-tint: #eaf2fc;
    --app-primary: #842934;
    --app-primary-hover: #73232e;
    --app-primary-pressed: #621e28;
    --app-control-line: #827f79;
    --app-selection-line: #6080a7;
    --app-shadow: 0 1px 2px rgba(25, 25, 18, .04), 0 3px 10px rgba(25, 25, 18, .035);
    --colorNeutralBackground1: var(--app-surface);
    --colorNeutralBackground2: var(--app-canvas);
    --colorNeutralBackground3: var(--app-inset);
    --colorNeutralBackground1Hover: var(--app-hover);
    --colorNeutralBackground1Pressed: color-mix(in srgb, var(--app-text) 9%, var(--app-surface));
    --colorNeutralForeground1: var(--app-text);
    --colorNeutralForeground2: var(--app-text-2);
    --colorNeutralForeground3: var(--app-muted);
    --colorNeutralStroke2: var(--app-line);
    --colorBrandBackground: #236bc4;
    --colorBrandBackgroundHover: #1f63b6;
    --colorBrandBackgroundPressed: #1a5298;
    --colorBrandBackground2: var(--app-brand-tint);
    --colorBrandForeground1: var(--app-brand);
    --colorBrandForegroundLink: var(--app-brand);
    --colorBrandStroke1: var(--app-brand-fill);
    --colorCompoundBrandStroke: var(--app-brand-fill);
    --colorCompoundBrandStrokeHover: var(--app-brand);
    --colorCompoundBrandStrokePressed: var(--app-brand);
    --colorStrokeFocus2: var(--app-brand-fill);
    --borderRadiusMedium: 8px;
    --borderRadiusLarge: 12px;
    margin: 0;
    font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    font-size: 14px;
    background: var(--app-canvas);
    color: var(--app-text);
    color-scheme: light;
}

body[data-theme="dark"] {
    --app-surface: #282c34;
    --app-canvas: #20232a;
    --app-inset: #23272f;
    --app-hover: #303a49;
    --app-text: #f0f1f4;
    --app-text-2: #c3c8d1;
    --app-muted: #a5acb9;
    --app-line: rgba(225, 231, 242, .13);
    --app-brand: #84b7f2;
    --app-brand-tint: #2b3b51;
    --app-brand-fill: #78aaf0;
    --app-primary: #a74350;
    --app-primary-hover: #ae4552;
    --app-primary-pressed: #903744;
    --app-control-line: #788490;
    --app-selection-line: #6d8bb7;
    color-scheme: dark;
    --app-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 12px rgba(0, 0, 0, .08);
}

*, *::before, *::after { box-sizing: border-box; }
button, input, textarea, select { font: inherit; }
:focus-visible { outline: 2px solid var(--app-brand-fill); outline-offset: 3px; }
h1, h2, h3, .page-title, .record-title { font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; letter-spacing: -.025em; }

/* Set Fluent action colors on hosts so the shadow controls inherit them without recoloring charts or status tokens. */
:where(fluent-button, fluent-menu-button, fluent-anchor-button, fluent-compound-button)[appearance="primary"]:not([color="danger"], [color="warning"], [color="success"]) {
    --colorBrandBackground: var(--app-primary);
    --colorBrandBackgroundHover: var(--app-primary-hover);
    --colorBrandBackgroundPressed: var(--app-primary-pressed);
    --colorNeutralForegroundOnBrand: #fff;
}

:where(fluent-button, fluent-menu-button, fluent-anchor-button, fluent-toggle-button, fluent-text-input,
       fluent-textarea, fluent-dropdown, fluent-combobox, fluent-number-field, .native-input, .rollup-toggle, .filters-choice) {
    --colorNeutralStroke1: var(--app-control-line);
    --colorNeutralStroke1Hover: var(--app-text-2);
    --colorNeutralStroke1Pressed: var(--app-text-2);
    --colorNeutralStrokeAccessible: var(--app-control-line);
    --colorNeutralStrokeAccessibleHover: var(--app-text-2);
}

/* A menu opens below its button from the button's left edge. Near the window's right edge Fluent's list shrank to the
   room left and scrolled sideways (Dashboards' Templates). Kept at its own width it overflows instead, so the browser
   opens it leftward from the button's right edge, and where neither fits (a phone) holds it inside the page gutters.
   Submenus are fluent-menu-item children, not fluent-menu ones, and keep Fluent's own placement.
   Fluent sets no height limit either, and the list is a fixed popover, so a long one (Assign to's 55 people) ran past
   the bottom of an iPad's screen where nothing could reach it: a fixed box doesn't scroll with the page. Held to half
   the screen less a button's height, it always fits below its button or, by flip-block, above it, since one side has
   at least that much room; it then scrolls within itself by touch and wheel, and arrow keys move focus, which scrolls
   the focused item into view (FR-544). Most of the screen didn't fit on a phone, where neither side had room for it. */
@position-try --menu-in-view {
    inset-inline-start: 16px;
    inset-inline-end: auto;
}
fluent-menu > fluent-menu-list[popover] {
    inline-size: max-content;
    max-inline-size: calc(100vw - 32px);
    max-block-size: min(560px, calc(50dvh - 48px));
    overflow-y: auto;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline, --menu-in-view, flip-block --menu-in-view;
}
/* A second, quieter line under a menu item's label, which wraps when the menu is held to the window's width. */
.menu-item-note { display: block; white-space: normal; }
.native-input:focus-visible { outline: 2px solid var(--app-brand-fill); outline-offset: 1px; }
.qrf-import-pick { background: var(--app-primary); color: #fff; }
.qrf-import-pick:hover { background: var(--app-primary-hover); filter: none; }

/* Shell */
.workspace-shell { display: grid; grid-template-columns: var(--app-nav-width) minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.workspace-sidebar {
    --colorNeutralForeground1: #dde1e8;
    display: flex; flex-direction: column; min-height: 0;
    background: #171a21; color: #dde1e8; border-right: 1px solid rgba(255, 255, 255, .04);
}
.sidebar-brand-row { display: flex; align-items: center; padding: 10px 16px; gap: 10px; }
body a.sidebar-brand { display: flex; align-items: center; gap: 11px; color: #f4f5f7; text-decoration: none; min-width: 0; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px; font-size: 21px; font-weight: 650;
    background: radial-gradient(100% 90% at 20% 10%, #ffffff24, transparent 70%), linear-gradient(135deg, #8d2a36, #1d2135);
    box-shadow: inset 0 1px 0 #ffffff24, 0 4px 10px #10131c60;
}
.brand-copy { display: flex; flex-direction: column; gap: 3px; line-height: 1.2; }
.brand-copy strong { font-size: 15px; font-weight: 650; letter-spacing: .01em; }
.brand-copy > span { color: #a3abb9; font-size: 11px; letter-spacing: .025em; }
.sidebar-navigation { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; padding: 0 10px 12px; }
.workspace-nav { display: flex; flex-direction: column; gap: 2px; }
body a.workspace-nav-link {
    display: flex; align-items: center; gap: 10px; position: relative; padding: 6px 10px; min-height: 34px;
    border-radius: 8px; color: #dde1e8; font-size: 14px; font-weight: 500; line-height: 20px; text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.workspace-nav-link > fluent-icon, .workspace-nav-link > svg { flex: none; opacity: .85; }
body a.workspace-nav-link:hover { background: #ffffff0f; color: #fff; text-decoration: none; }
body a.workspace-nav-link.active { background: #558cdc29; color: #fff; }
.workspace-nav-link.active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #4d94e8; }
.workspace-nav-link.active > fluent-icon, .workspace-nav-link.active > svg { color: #8cbcf7; opacity: 1; }
.workspace-nav-label {
    display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 10px 4px; line-height: 14px;
    color: #a3abb9; background: none; border: 0; cursor: pointer;
    text-align: left; text-transform: uppercase; font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
}
.workspace-nav-label:hover { color: #fff; }
.nav-caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin-right: 3px; transition: transform .15s ease; }
.nav-caret.collapsed { transform: rotate(-45deg); }
.workspace-nav-group { display: grid; gap: 2px; }
.workspace-nav-group.collapsed { display: none; }
.sidebar-footer { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 9px 16px; line-height: 16px; border-top: 1px solid #ffffff12; }
.sidebar-footer-label { color: #a3abb9; font-size: 11px; }
.sidebar-footer strong { font-size: 12px; font-weight: 500; }
.navigation-toggle, .nav-scrim { display: none; }
.workspace-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.workspace-topbar { flex: none; padding: 6px 24px; background: var(--app-surface); border-bottom: var(--app-border); min-height: 50px; }
.app-header-bar { min-height: 36px; gap: 10px; }
.global-search { position: relative; flex: 1 1 480px; max-width: 620px; }
.search-shortcut { position: absolute; right: 32px; top: 50%; transform: translateY(-50%); padding: 2px 5px; border: var(--app-border); border-radius: 4px; color: var(--app-muted); background: var(--app-surface); font: 10px "Segoe UI", sans-serif; pointer-events: none; }
.user-menu-trigger { display: flex; align-items: center; gap: 9px; flex: none; background: transparent; color: var(--app-text); border: 0; border-radius: 8px; padding: 3px 6px; cursor: pointer; }
.user-menu-trigger:hover { background: var(--app-inset); }
.user-menu-name { font-size: 12px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Suggest a feature: an icon-only button as quiet as the user menu beside it, the same height, lit only on hover. */
.topbar-icon-button { display: grid; place-items: center; flex: none; width: 38px; height: 38px; padding: 0; background: transparent; color: var(--app-text-2); border: 0; border-radius: 8px; cursor: pointer; }
.topbar-icon-button:hover { background: var(--app-inset); color: var(--app-text); }
/* The Feature requests link's count of New (FR-455): after the label in the full sidebar, on the icon's corner on the rail. */
.nav-count {
    flex: none; margin-inline-start: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: #4d94e8; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.app-content { flex: 1; min-height: 0; height: auto; overflow: auto; background: var(--app-canvas); }
.skip-link { position: fixed; left: 12px; top: -70px; z-index: 2000; padding: 12px 18px; background: var(--app-surface); border-radius: 8px; box-shadow: var(--app-shadow); }
.skip-link:focus { top: 12px; }

.workspace-search-field { display: flex; align-items: center; gap: 9px; padding: 0 10px; min-height: 34px; border: var(--app-border); border-radius: 8px; background: var(--app-inset); }
.workspace-search-field > svg { flex: none; color: var(--app-muted); }
.workspace-search-field input { width: 100%; min-width: 0; padding: 7px 0; border: 0; outline: none; background: transparent; color: var(--app-text); }
.workspace-search-field:focus-within { outline: 2px solid var(--app-brand-fill); outline-offset: 1px; }
.workspace-search-field .search-shortcut { position: static; flex: none; transform: none; white-space: nowrap; }
.workspace-search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: min(420px, 65dvh); overflow: auto; padding: 5px; background: var(--app-surface); border: var(--app-border); border-radius: 10px; box-shadow: 0 8px 28px #0003; z-index: 100; }
.global-search:not(:focus-within) .workspace-search-results { display: none; }
body a.workspace-search-hit { display: flex; align-items: center; gap: 10px; padding: 10px; color: var(--app-text); border-radius: 6px; text-decoration: none; }
.workspace-search-hit:hover, .workspace-search-hit:focus { background: var(--app-hover); }
.workspace-search-hit > svg { flex: none; color: var(--app-muted); }
.workspace-search-hit > span { min-width: 0; }
.workspace-search-hit strong, .workspace-search-hit small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-search-hit strong { font-size: 13px; font-weight: 600; }
.workspace-search-hit small { font-size: 11px; color: var(--app-muted); margin-top: 3px; }
.workspace-search-message { padding: 14px 10px; color: var(--app-muted); font-size: 13px; }

/* Shared page and record surfaces */
.page, .record { padding: 28px 32px 36px; max-width: none; margin: 0; }
.page-header { gap: 12px; margin-bottom: 22px; min-height: 40px; }
.page-title { font-size: 27px; line-height: 1.25; font-weight: 650; }
.page-subtitle { font-size: 12px; }
.page-header > .page-subtitle { background: var(--app-surface); border: var(--app-border); border-radius: 6px; padding: 4px 8px; }
.page-eyebrow { color: var(--app-muted); font-size: 11px; font-weight: 600; letter-spacing: .075em; text-transform: uppercase; margin-bottom: 7px; }
.page-intro { color: var(--app-muted); font-size: 14px; margin: 8px 0 0; line-height: 1.6; }
.panel, .kpi, .widget, .grid-host { box-shadow: var(--app-shadow); }
.panel-header { --panel-header-pad-y: 15px; padding: var(--panel-header-pad-y) 18px; min-height: 52px; }
.panel-title { font-size: 14px; font-weight: 650; }
.panel-body { padding: 18px; }
.empty { padding: 32px 20px; font-size: 13px; line-height: 1.7; }
.panel .empty { min-height: 115px; align-content: center; }
.record-header { padding-bottom: 22px; margin-bottom: 22px; }
.record-title { font-size: 27px; font-weight: 650; }
.record-icon { width: 48px; height: 48px; border-radius: 12px; }
.record-grid { gap: 20px; }
.record-grid > .col { gap: 20px; }
.related-item { padding: 13px 18px; }
.section-heading { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin: 26px 0 13px; }
.section-heading h2 { margin: 0; font-size: 17px; font-weight: 650; }
.section-heading > span { font-size: 12px; color: var(--app-muted); }
.kpis { gap: 16px; margin-bottom: 22px; }
.kpi { padding: 20px; }
.kpi-label { font-size: 10.5px; line-height: 1.5; font-weight: 650; letter-spacing: .075em; text-transform: uppercase; }
.kpi-value { font-size: 29px; font-weight: 650; line-height: 1.35; letter-spacing: -.03em; margin: 7px 0 4px; }
.kpi-note { font-size: 12px; line-height: 1.5; }
a.kpi { transition: border-color .15s ease, box-shadow .15s ease; }
a.kpi:hover { border-color: var(--app-brand-fill); box-shadow: 0 4px 18px #2a78d618; }
.home-grid { gap: 20px; }

/* Give the records the remaining viewport height after the title, scope and toolbar. */
.list-page, .list-page.layout-map { padding: 12px 24px 8px; }
.list-page.embedded { padding: 0; }
.list-page > .list-header { gap: 6px 10px; min-height: 36px; margin-bottom: 8px; }
.list-heading { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.list-heading .page-title { font-size: 25px; }
.list-count { font-variant-numeric: tabular-nums; }
.list-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.list-context { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 8px; flex: none; }
.list-context:empty, .list-context .view-tabs:empty { display: none; }
.list-context .company-bar { flex: none; min-width: 0; max-width: min(40%, 320px); margin: 0; padding: 0; border: 0; background: none; }
.list-context .company-bar-now { display: none; }
.list-context .company-buttons { scrollbar-width: thin; }
.list-context .company-buttons::-webkit-scrollbar { display: block; height: 5px; }
.list-context > fluent-menu { flex: none; }
.list-context .filters-choice { margin-inline-start: 0; }
.view-tabs { gap: 3px; border-bottom: 0; padding: 3px; margin-bottom: 8px; border-radius: 8px; width: fit-content; max-width: 100%; }
.list-context .view-tabs { flex: 0 1 auto; min-width: 80px; margin: 0; }
/* When the tabs don't fit they scroll sideways, and a shadow shows at each edge that has more tabs: covers that move with
   the tabs (local) hide shadows that stay at the edges (scroll) until there is something past that edge. */
.view-tabs {
    --tab-shadow: color-mix(in srgb, var(--app-text) 28%, transparent);
    background:
        linear-gradient(to right, var(--app-inset) 40%, transparent) left center / 28px 100% no-repeat local,
        linear-gradient(to left, var(--app-inset) 40%, transparent) right center / 28px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, var(--tab-shadow), transparent) left center / 14px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, var(--tab-shadow), transparent) right center / 14px 100% no-repeat scroll,
        var(--app-inset);
}
.view-tab { border-radius: 6px; padding: 6px 11px; font-size: 12px; }
.view-tab.active::after { display: none; }
/* Layout, scope and view choices mark state with a blue tint and edge. */
:is(.view-tab.active, .company-btn.active, .segmented button[aria-pressed="true"], .rollup-toggle[aria-expanded="true"],
    .layout-choice fluent-button[aria-pressed="true"], .list-options fluent-menu-button[appearance="primary"],
    fluent-toggle-button[pressed]):not([disabled], [disabled-focusable], [aria-disabled="true"]) {
    background: var(--app-brand-tint);
    color: var(--app-brand);
    border-color: var(--app-selection-line);
}
:is(.view-tab.active, .segmented button[aria-pressed="true"]) { box-shadow: inset 0 0 0 1px var(--app-selection-line); }
fluent-tab[aria-selected="true"] { color: var(--app-brand); background: var(--app-brand-tint); }
:is(.view-tab, .company-btn, .segmented button, .layout-choice fluent-button,
    .list-options fluent-menu-button, fluent-toggle-button):focus-visible {
    outline: 2px solid var(--app-brand-fill);
    outline-offset: -2px;
}
.entity-list-toolbar { flex-wrap: nowrap; gap: 8px; margin-bottom: 8px; }
.list-search { flex: 0 1 260px; min-width: 0; }
.list-search fluent-field, .list-search fluent-text-input { min-width: 0; max-width: 100%; }
.entity-list-toolbar > :not(.list-search, .rollup-toggle) { flex: none; }
.list-options { margin-inline-start: auto; }
.entity-list-toolbar .rollup-toggle { flex: 1 1 180px; }
.entity-list-toolbar .rollup-summary { font-size: 12px; }
.list-rollup { gap: 8px; padding: 8px 12px; }
.list-rollup .rollup-row { gap: 6px 12px; }
.entity-list-filters { flex-wrap: nowrap; overflow-x: auto; align-items: center; margin-bottom: 6px; padding: 2px; scrollbar-width: thin; }
.entity-list-filters > * { flex: none; white-space: nowrap; }
.entity-list-filters .filter-chip > button, .list-rollup .filter-chip > button { width: 24px; height: 24px; }
.list-selection { padding: 3px 8px; margin-bottom: 8px; border: var(--app-border); border-radius: 8px; background: var(--app-brand-tint); }
.list-selection .clear-selection { margin-inline-start: auto; }
.list-footer.entity-list-footer { gap: 4px 14px; padding: 5px 2px 0; font-size: 12px; white-space: nowrap; }
.list-page > .board { gap: 8px; min-height: min(240px, 55dvh); padding-bottom: 4px; }
.grid-host { border-radius: 12px; }
.grid-host .fluent-data-grid { background: var(--app-surface); }
.grid-host .fluent-data-grid thead th { background: var(--app-inset); color: var(--app-muted); font-size: 14px; letter-spacing: .065em; text-transform: uppercase; }
body .grid-host .fluent-data-grid tr[row-type="sticky-header"] > th { background: var(--app-inset); }
body .grid-host .fluent-data-grid td[col-pinned] { background: var(--app-surface); }
.table th { background: var(--app-inset); font-size: 10.5px; letter-spacing: .065em; text-transform: uppercase; }
.table td { padding: 11px 14px; }
.chip { font-weight: 500; }

/* Competitor intelligence keeps its result tables above the secondary collection and trade metrics. */
.competitor-page { padding-block: 12px 24px; }
.competitor-page > .page-header { gap: 6px 10px; min-height: 34px; margin-bottom: 8px; }
.competitor-page .page-title { font-size: 25px; overflow-wrap: anywhere; }
.competitor-page .page-subtitle { margin-top: 2px; }
.intel-heading { flex: 1 1 150px; min-width: 0; }
.competitor-page .intel-navigation { margin-bottom: 8px; }
.intel-navigation > .view-tab { white-space: nowrap; display: inline-flex; align-items: center; }
body .intel-navigation > .view-tab { color: var(--app-text-2); }
body .intel-navigation > .view-tab.active { color: var(--app-brand); }
.competitor-page .intel-notice { margin-bottom: 8px; padding: 5px 9px; line-height: 1.35; }
.competitor-page .intel-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 8px; }
.competitor-page .intel-filters > .native-input { flex: 0 1 190px; min-width: 0; width: auto; max-width: 100%; text-overflow: ellipsis; }
.competitor-page .intel-filters > .intel-search { flex-basis: 250px; }
.intel-filter-check { min-height: 32px; align-self: stretch; }
.intel-filter-check input { flex: none; }
.intel-summary { margin: 0 0 8px; border: var(--app-border); border-radius: 8px; background: var(--app-surface); }
.intel-summary > summary { padding: 7px 10px; border-radius: 8px; line-height: 18px; cursor: pointer; }
.intel-summary > summary > span { margin-inline-start: 8px; color: var(--app-muted); font-size: 12px; }
.intel-summary > summary:focus-visible { outline-offset: -2px; }
.intel-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 10px 16px; margin: 0; padding: 8px 12px 12px; border-top: var(--app-border); }
.intel-metrics dt { color: var(--app-muted); font-size: 12px; }
.intel-metrics dd { margin: 3px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.intel-metrics small { display: block; color: var(--app-muted); font-weight: 400; }
.intel-extra-filters { margin: 0; }
.intel-extra-filters[open] { flex: 1 1 100%; }
.competitor-page .intel-extra-filters > .intel-filters { padding: 0 8px 8px; margin: 0; }
.intel-result-count { margin-bottom: 4px; }
.competitor-page > .intel-grid { margin-block: 8px; }
.competitor-page .panel-header { min-height: 36px; padding: 6px 10px; }
.competitor-page .table th, .competitor-page .table td { padding: 7px 10px; }
.competitor-page .table-wrap:focus-visible { outline-offset: -2px; }
.intel-record-link { display: inline; align-self: flex-start; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--app-brand); font: inherit; font-weight: 650; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.intel-record-link:hover { text-decoration: underline; }
.intel-drawer { min-width: 0; }

@media (max-width: 743px) {
    .competitor-page { padding-block: 8px 16px; }
    .competitor-page .page-title { font-size: 22px; }
    .competitor-page .intel-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .competitor-page .intel-filters > .native-input { width: 100%; min-height: 44px; }
    .intel-extra-filters, .intel-filter-check { grid-column: 1 / -1; }
    .intel-filter-check { min-height: 34px; }
    .intel-extra-filters > summary { min-height: 44px; padding-block: 12px; }
    .intel-record-link { min-height: 24px; }
}

@media (max-width: 1199px) {
    .workspace-topbar { padding-inline: 22px; }
    .page, .record { padding: 24px 22px 30px; }
    .user-menu-name { display: none; }
}

/* Tablets: iPads upright or sideways, and laptop windows 744 to 1279 wide. The sidebar is a rail of icons, and its menu
   button opens the full sidebar over the page; opening a page, tapping the scrim or pressing Escape closes it. */
@media (min-width: 744px) and (max-width: 1279px) {
    :root { --app-nav-width: 64px; }
    .workspace-sidebar { grid-column: 1; grid-row: 1; }
    .workspace-main { grid-column: 2; grid-row: 1; }
    .navigation-toggle {
        display: grid; place-items: center; width: 44px; height: 40px; flex: none;
        border: 1px solid #ffffff26; border-radius: 8px; background: #ffffff0d; color: #fff; cursor: pointer;
    }
    .nav-scrim { display: block; position: fixed; inset: 0; z-index: 999; background: rgba(10, 12, 18, .32); }

    /* The rail: icons only, group headings as dividers, every link shown. */
    .workspace-shell:not(.navigation-open) .sidebar-brand-row { padding: 6px 0; justify-content: center; }
    .workspace-shell:not(.navigation-open) a.sidebar-brand,
    .workspace-shell:not(.navigation-open) .workspace-nav-label,
    .workspace-shell:not(.navigation-open) .sidebar-footer { display: none; }
    .workspace-shell:not(.navigation-open) .sidebar-navigation { padding: 0 10px 16px; scrollbar-width: none; }
    .workspace-shell:not(.navigation-open) .sidebar-navigation::-webkit-scrollbar { display: none; }
    .workspace-shell:not(.navigation-open) .workspace-nav-section { margin-top: 6px; padding-top: 6px; border-top: 1px solid #ffffff1a; }
    .workspace-shell:not(.navigation-open) .workspace-nav-group.collapsed { display: grid; }
    .workspace-shell:not(.navigation-open) a.workspace-nav-link { justify-content: center; padding: 8px 0; }
    .workspace-shell:not(.navigation-open) .nav-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
    /* A count sits on the icon's top right corner, ringed in the sidebar's color so it reads against the icon. */
    .workspace-shell:not(.navigation-open) .nav-count {
        position: absolute; top: 2px; left: calc(50% + 3px); margin: 0;
        min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; line-height: 16px;
        box-shadow: 0 0 0 2px #171a21;
    }

    /* The full sidebar, over the page; the main column stays where it is. */
    .navigation-open .workspace-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 1000; width: 236px;
        box-shadow: 0 0 32px rgba(0, 0, 0, .35);
    }
    .navigation-open .sidebar-brand-row { padding: 12px 10px 12px 20px; justify-content: space-between; }

    /* Less room around the page, so lists keep most of the height. */
    .workspace-topbar { padding: 5px 16px; }
    .page, .record { padding: 16px 16px 24px; }
    .list-page, .list-page.layout-map { padding: 10px 16px 8px; }
    .page-header { margin-bottom: 12px; }
    .page-title, .record-title { font-size: 22px; }
    .list-heading .page-title { font-size: 22px; }

    /* Record pages: details with the related lists under them on the left, the timeline on the right. */
    .record-grid {
        grid-template-columns: minmax(240px, 320px) minmax(360px, 1fr);
        grid-template-rows: auto 1fr;
        grid-template-areas: "left center" "right center";
        gap: 16px;
    }
    .record-grid > .col { gap: 16px; }
}
@media (max-width: 1279px) {
    .entity-list-toolbar .reset-button > [slot="start"] { display: revert; }
    .entity-list-toolbar .layout-choice fluent-button, .entity-list-toolbar .list-options fluent-menu-button,
    .entity-list-toolbar .reset-button { min-width: 44px; }
    .entity-list-toolbar .btn-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
}
/* Phones share one header. The navigation drawer sits above the current record or list. */
@media screen and (max-width: 743px) {
    .workspace-shell { display: flex; flex-direction: column; position: relative; }
    .workspace-main { flex: 1; }
    .workspace-sidebar {
        position: absolute; top: 0; left: 0; z-index: 2; border: 0; background: transparent;
        padding: env(safe-area-inset-top) 0 0 env(safe-area-inset-left);
    }
    .sidebar-brand-row { padding: 6px 8px; }
    .workspace-shell:not(.navigation-open) a.sidebar-brand, .sidebar-navigation, .sidebar-footer { display: none; }
    .navigation-toggle {
        display: grid; place-items: center; width: 44px; height: 44px;
        border: 0; border-radius: 10px; color: #fff; background: #742b38; cursor: pointer;
    }
    .navigation-toggle svg { fill: currentColor !important; }
    .navigation-open .workspace-sidebar {
        z-index: 1000; bottom: 0; width: min(320px, 88vw); background: #171a21;
        padding-bottom: env(safe-area-inset-bottom); box-shadow: 4px 0 24px #0004;
    }
    .navigation-open .sidebar-brand-row { justify-content: space-between; padding: 8px 12px 8px 18px; }
    .navigation-open .sidebar-navigation { display: block; overscroll-behavior: contain; }
    .nav-scrim { display: block; position: absolute; inset: 0; z-index: 999; background: #10141c70; }
    .workspace-topbar {
        padding: calc(6px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px calc(60px + env(safe-area-inset-left));
        min-height: 56px;
    }
    .app-header-bar { min-height: 44px; gap: 6px; }
    .app-header-bar > .spacer, .search-shortcut, .user-menu-trigger > svg { display: none; }
    .global-search { flex: 1 1 0; max-width: none; }
    .workspace-search-field { min-height: 44px; gap: 6px; }
    .workspace-search-results { width: min(420px, calc(100vw - 24px)); left: calc(-48px - env(safe-area-inset-left)); }
    .workspace-search-field input, .native-input { font-size: 16px; }
    .user-menu-trigger { margin-inline-start: auto; min-width: 44px; min-height: 44px; padding: 0; justify-content: center; }
    .topbar-icon-button { width: 44px; height: 44px; }
    /* The Create menu has a leading icon on every row. Keep it beside the label even when
       the browser gives Fluent's shared icon column zero width. */
    .app-header-bar fluent-menu-button + fluent-menu-list > fluent-menu-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding-inline: 10px;
        min-height: 44px;
    }
    .app-content { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }

    .page, .record { padding: 14px 12px 24px; }
    .list-page, .list-page.layout-map { padding: 8px 12px 8px; }
    .page-header, .list-page.layout-map .page-header { gap: 6px 8px; margin-bottom: 10px; }
    .page-title, .record-title { font-size: 22px; line-height: 1.2; }
    .list-heading .page-title { font-size: 22px; }
    .list-count-label { display: none; }
    .list-header-actions fluent-button { min-height: 44px; }

    .entity-list-toolbar { gap: 6px; }
    .list-search { flex: 1 1 120px; }
    .list-search fluent-text-input::part(root) { min-height: 44px; }
    .list-search fluent-text-input::part(control) { min-width: 0; font-size: 16px; }
    .entity-list-toolbar .rollup-toggle { flex: 1 1 126px; min-width: 44px; max-width: none; min-height: 44px; padding-inline: 8px; }
    .entity-list-toolbar .rollup-toggle-label { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .entity-list-toolbar .rollup-toggle-label.has-summary { display: none; }
    .entity-list-toolbar .rollup-summary { padding-left: 0; border-left: 0; }
    .entity-list-toolbar .rollup-chevron { margin-inline-start: auto; }
    .entity-list-toolbar .reset-button, .entity-list-toolbar fluent-menu-button { min-height: 44px; }
    .list-selection { gap: 4px 6px; }
    .list-rollup .company-bar { max-width: 100%; }
    .rollup-row.rollup-views { flex-direction: column; align-items: stretch; }
    .phone-rows { min-height: 210px; }
    .phone-rows .fluent-data-grid thead th { height: 44px !important; font-size: 11px; }
    .grid-host:not(.phone-rows) [col-pinned]:not(.tick-cell) { inset-inline-start: auto !important; }
    .phone-rows td:not(.tick-cell) { padding: 0; }
    .phone-rows .row-tick { width: 44px; min-height: 44px; }
    .phone-row {
        display: flex; align-items: center; gap: 8px; width: 100%; height: 65px; padding: 0 12px;
        text-align: start; border: 0; background: transparent; color: var(--app-text); cursor: pointer;
    }
    body a.phone-row { color: var(--app-text); text-decoration: none; }
    .phone-row:focus-visible { outline-offset: -3px; }
    .phone-row-copy { flex: 1; min-width: 0; }
    .phone-row strong, .phone-row small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .phone-row strong { font-size: 15px; font-weight: 600; }
    .phone-row small { color: var(--app-muted); margin-top: 3px; font-size: 13px; }
    .phone-row > svg { flex: none; opacity: .55; }

    .record-header { gap: 10px; margin-bottom: 12px; padding-bottom: 12px; }
    .record-titles { flex: 1 1 calc(100% - 62px); }
    .record-sub { overflow-wrap: anywhere; }
    .record-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "left" "center" "right"; }
    .record-grid, .record-grid > .col { gap: 12px; }
    .record-actions { gap: 6px; }
    .phone-disclosure {
        flex: 1 0 100%; min-width: 0; border: var(--app-border); border-radius: 10px; background: var(--app-surface);
    }
    .phone-disclosure > summary {
        display: flex; align-items: center; justify-content: space-between; min-height: 44px;
        padding: 0 12px; font-weight: 600; cursor: pointer; list-style: none;
    }
    .phone-disclosure > summary::-webkit-details-marker { display: none; }
    .phone-disclosure[open] > summary svg { transform: rotate(180deg); }
    .phone-disclosure > .record-actions, .phone-disclosure > .cal-tools { justify-content: flex-start; padding: 4px 10px 10px; }
    .cal-tools .cal-mode { flex-wrap: wrap; }
    .panel-body, .related-item { padding: 12px; }
    .kpis { gap: 8px; margin-bottom: 12px; }
    .kpi { padding: 12px; }
    .kpi-value { font-size: 23px; }
    .section-heading { gap: 4px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-grid > * { min-width: 0; max-width: 100%; }
}
@media (max-width: 479px) {
    .list-header-actions .list-action-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
    .list-header-actions fluent-button:has(.list-action-label) { min-width: 44px; }
    .entity-list-toolbar .rollup-chevron { display: none; }
}
/* Touch screens: every control is at least 44px tall, the size Apple recommends for a fingertip. Outer rules on a Fluent
   element's host override its own :host size; text inputs also size their inner box (::part(root)). */
@media (pointer: coarse) {
    .workspace-nav-link, .workspace-nav-label, .navigation-toggle, .view-tab, .user-menu-trigger { min-height: 44px; }
    .topbar-icon-button { min-width: 44px; min-height: 44px; }
    body a.workspace-nav-link { min-height: 44px; }
    fluent-button, fluent-toggle-button, fluent-menu-button { min-height: 44px; min-width: 44px; }
    fluent-text-input, fluent-combobox, fluent-dropdown, fluent-menu-item { min-height: 44px; }
    fluent-text-input::part(root), fluent-combobox::part(control), fluent-dropdown::part(control) { min-height: 44px; }
    .list-context .company-btn, .list-context .filters-choice, .list-rollup .company-btn, .entity-list-toolbar .rollup-toggle { min-height: 44px; }
    .entity-list-filters .filter-chip > button, .list-rollup .filter-chip > button { min-width: 44px; min-height: 44px; }
}
/* No keyboard shortcut hints where there is no mouse or trackpad (an iPad on its own, a phone). */
@media (hover: none) {
    .search-shortcut { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .workspace-nav-link, .nav-caret, a.kpi { transition: none; }
}
@media print {
    .workspace-sidebar, .workspace-topbar { display: none; }
    .workspace-shell { display: block; height: auto; overflow: visible; }
    .workspace-main, .app-content { display: block; overflow: visible; height: auto; }
}
