@media screen {/* Medici owns placement and its responsive drawer, not Ghostly's sidebar
   width, row geometry, type, palette, appearance or component recipes. */#sidebar-host { display: flex; min-height: 0; }#sidebar-backdrop { display: none; }#sidebar-host .nav-links { display: contents; }#sidebar-host .nav-folded { display: none; }#sidebar-host .nav-section--folded .nav-section__caret { transform: rotate(-90deg); }#sidebar-update:empty { display: none; }@media screen {
    html.shell-narrow #sidebar-host {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 220;
    }
    html.shell-narrow #sidebar-host #sidebar {
        position: relative;
        z-index: 1;
        max-inline-size: calc(84vw / var(--ui-scale));
    }
    html.shell-narrow #sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        width: calc(100vw / var(--ui-scale));
        border: 0;
        padding: 0;
        background: var(--color-scrim);
        cursor: pointer;
    }
}[data-ghostly-icon] { display: inline-flex; align-items: center; justify-content: center; }/* Shell placement and measured folding only. Toolbar, Button, SearchInput,
   menu panels/items and the native-select recipe come from Ghostly. */#topbar { grid-column: 2; grid-row: 1; min-width: 0; }body.sidebar-hidden #topbar,
html.shell-narrow #topbar { grid-column: 1 / -1; }#topbar .topbar-toolbar { display: flex; width: 100%; }/* Fitting may fold controls, never compress their content across neighbours. */#topbar [data-toolbar-control] { flex-shrink: 0; }#topbar .topbar-right { margin-inline-start: auto; flex: 0 0 auto; }#topbar .topbar-brand { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }#topbar .topbar-brand svg { width: auto; height: 24px; }#topbar .topbar-company-slot { min-width: 0; max-width: 20em; flex: 0 1 auto; }#topbar .topbar-company { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }#topbar .topbar-search { position: relative; flex: 1 1 260px; min-width: 120px; max-width: 420px; }#topbar .topbar-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16em; min-width: 0; }#topbar .tb-back { position: relative; z-index: 210; }#topbar .tb-back--under { z-index: auto; }#topbar .tb-compact-icon { display: none; }#topbar .search-dropdown { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; width: 100%; max-height: calc(100vh / var(--ui-scale) - var(--topbar-height) - 16px); overflow: auto; z-index: 190; }#topbar .search-section, #topbar .search-empty { padding: 8px 12px; }#topbar .search-item { text-align: start; white-space: normal; }#ghostly-portals { position: relative; z-index: 250; }#ghostly-portals .shell-menu { max-width: calc(100vw / var(--ui-scale) - 24px); max-height: min(var(--radix-dropdown-menu-content-available-height), calc(100vh / var(--ui-scale) - var(--topbar-height) - 16px)); }#ghostly-portals .shell-menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }#ghostly-portals .shell-menu-list { min-width: 180px; }#ghostly-portals .tb-more-item { width: 100%; text-align: start; }body:not(.sidebar-hidden) #topbar .topbar-brand,
html.shell-narrow #topbar .topbar-brand,
#topbar.tb-fold-1 .topbar-brand span,
#topbar.tb-fold-4 #user-chip,
#topbar.tb-fold-6 .topbar-brand,
#topbar.tb-fold-8 .topbar-company-slot,
#topbar.tb-fold-9 .tb-label,
#topbar.tb-fold-9 .tb-more-arrow { display: none; }#topbar.tb-fold-8 .topbar-search { min-width: 52px; flex-basis: 52px; }#topbar.tb-fold-9 .topbar-toolbar { flex-wrap: wrap; }#topbar.tb-fold-9 .topbar-search { order: 2; flex-basis: 100%; max-width: none; }#topbar.tb-fold-9 .tb-compact-icon { display: block; }#topbar [hidden] { display: none !important; }@media (max-width: 700px) { #ghostly-portals .shell-menu-grid { grid-template-columns: 1fr; } }
/* Floating UI positions portaled menus in viewport coordinates. Neutralize
   document zoom on that coordinate space, then retain the user's text size
   on the content itself. No component geometry or palette is overridden. */
#ghostly-portals { zoom: calc(1 / var(--ui-scale)); }
#ghostly-portals .shell-menu { zoom: var(--ui-scale); }

/* Dialog composition keeps Medici's native focus/history/save lifecycle.
   Card/Toolbar/controls own their visuals; only viewport placement lives here. */
#modal-overlay {
    --form-bg: var(--color-surface-0);
    --panel-bg: var(--color-surface-0);
    --text-primary: var(--color-ink);
    --text-secondary: var(--color-ink2);
    --text-muted: var(--color-ink-muted);
    --input-border: var(--color-hairline);
    background: color-mix(in srgb, var(--color-scrim) 80%, transparent);
    backdrop-filter: blur(4px);
    padding: 24px;
    align-items: flex-start;
}
#modal-overlay #modal { flex: 0 1 auto; width: min(100%, 700px); max-height: 100%; overflow: auto; }
#modal-overlay #modal.modal--wide { width: min(100%, 1280px); max-width: 1280px; }
#modal-overlay .modal-header { flex-shrink: 0; }
#modal-overlay [type=checkbox], #modal-overlay [type=radio] { accent-color: var(--color-accent); }
#modal-overlay [hidden] { display: none !important; }
#modal-overlay .form-actions { background: var(--color-surface-0); }
#modal-overlay #modal { scroll-padding-top: 72px; scroll-padding-bottom: 68px; }
/* Financial line columns are product layout, not control recipes. Preserve
   readable minima and scroll rather than squeezing choices into fragments. */
#modal-overlay td > select:is([class$="-fund"], [class*="-fund "]) { min-width: 124px; }
#modal-overlay .bill-lines-table .cbx--line-item { min-width: 110px; }
#modal-overlay .bill-lines-table .cbx--line-account { min-width: 200px; }
#modal-overlay .bill-lines-table .cbx--line-cost-code { min-width: 110px; }
#modal-overlay .line-items-table .line-cost-type { width: 84px; min-width: 84px; max-width: 84px; }
#modal-overlay .bill-lines-table .line-desc { min-width: 140px; }
#modal-overlay .bill-lines-table .line-qty { min-width: 64px; }
#modal-overlay .bill-lines-table .line-rate { min-width: 84px; }
#modal-overlay.modal-overlay--wide { padding-inline: 6px; }
#modal-overlay .table-container--scroll { margin-bottom: 20px; }

/* Shared native feedback composition; all visual recipes are package output. */
#ghostly-choice { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--color-scrim) 80%, transparent); backdrop-filter: blur(4px); }
.choice-overlay > [role=alertdialog] { max-width: 440px; width: 100%; }
#ghostly-combobox, #qmath { background: none; border: 0; box-shadow: none; padding: 0; }
#ghostly-combobox > [data-ghostly-surface] { max-height: inherit; min-width: 0; }
#ghostly-combobox #cbx-listbox { overflow-y: auto; min-height: 0; }
#ghostly-combobox .cbx-opt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ghostly-combobox [hidden] { display: none !important; }
#qmath > [data-ghostly-surface] { min-width: 0; }
/* Package document defaults must not turn floating hosts into full-height pages. */
#ghostly-combobox, #qmath, #toast-container { height: auto; overflow: visible; }

/* The shared list renderer: package slots on native, app-owned row nodes. */
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) {
    height: auto; overflow: visible;
    --panel-bg: var(--color-surface-0);
    --form-bg: var(--color-surface-0);
    --text-primary: var(--color-ink);
    --text-secondary: var(--color-ink2);
    --text-muted: var(--color-ink-muted);
    --text-link: var(--color-ink);
    --panel-border: var(--color-hairline);
    --input-border: var(--color-hairline);
}
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .toolbar { display: flex; gap: 8px; margin-block: 12px; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .table-container { overflow-x: auto; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) td.amount, #page-content:is([data-ghostly-list], [data-ghostly-workspace]) th.amount { text-align: right; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) [hidden] { display: none !important; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) [type=checkbox], #page-content:is([data-ghostly-list], [data-ghostly-workspace]) [type=radio] { accent-color: var(--color-accent); }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .toolbar > input { width: auto; flex: 1 1 240px; min-width: 120px; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .toolbar > select { width: auto; flex: 0 1 auto; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .toolbar label { display: inline-flex; align-items: center; gap: 8px; }
#page-content:is([data-ghostly-list], [data-ghostly-workspace]) .toolbar label select { width: auto; }

/* Frozen financial cells need opaque package surfaces as they scroll over rows. */
:is(#modal-overlay, #page-content) :is(.table--frozen, .pivot-grid, .pay-run-table) thead th { background: var(--color-surface-fog); }
:is(#modal-overlay, #page-content) :is(.table--frozen, .pivot-grid, .pay-run-table) tbody tr { background: var(--color-surface-0); }
:is(#modal-overlay, #page-content) :is(.table--frozen, .pivot-grid, .pay-run-table) tbody tr:hover { background: color-mix(in srgb, var(--color-surface-fog) 30%, var(--color-surface-0)); }
:is(#modal-overlay, #page-content) :is(.table--frozen, .pivot-grid, .pay-run-table) tbody :is(td, th):first-child { background: inherit; }
#modal-overlay #modal-body .line-items-table td { padding: 2px; }
#modal-overlay #modal-body .line-items-table td:first-child { padding-inline-start: 4px; }
#modal-overlay #modal-body .line-items-table td:last-child { padding-inline-end: 4px; }
:is(#modal-overlay, #page-content) :is(.table--frozen, .pivot-grid) { width: max-content; min-width: 100%; }
:is(#modal-overlay, #page-content) .table-container--frozen { overflow: auto; } }@media print { #topbar, #ghostly-portals { display: none !important; } }
@media print { #sidebar { display: none !important; } }

@media screen {
#modal-overlay #report-custom-range { flex-wrap: wrap; }
#modal-overlay .report-date-field { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; }
#modal-overlay .report-date-field label { flex: 0 0 auto; white-space: nowrap; }
#modal-overlay .report-date-field input { width: auto; flex: 1 1 140px; min-width: 0; }
}

@media screen {
/* Stage visibility is not a permission mark: App retains hidden/kind/role state. */
#sidebar-host .sidebar-area-inactive { display: none !important; }
#sidebar-host .nav-section { list-style: none; }
#sidebar-host [hidden] { display: none !important; }
/* Desktop collapse puts away the inner panel, never the shared primary rail. */
html:not(.shell-narrow) body.sidebar-hidden #sidebar-host { display: flex; }
html:not(.shell-narrow) body.sidebar-hidden :is(#content, #topbar) { grid-column: 2; }
}

@media screen { html.shell-narrow #sidebar #app-version { display: none; } }

@media screen {
/* Scroll owners need physical room for focus indicators at every edge.
   This is financial-table composition, not a second control recipe. */
:is(#modal-overlay, #page-content) .table-container { padding: 8px; }
:is(#modal-overlay, #page-content) .pivot-grid thead th { padding-block: 10px; }
}
