@charset "UTF-8";

/* Loaded after ui.css. The desktop host opts in before the first paint. */
html[data-desktop="true"] {
  --desktop-gutter: 18px;
  --desktop-status-height: 27px;
  --sidebar-width: 216px;
  height: 100%;
  overflow: hidden;
}
html[data-desktop="true"] body {
  height: 100%;
  overflow: hidden;
  background: #eef1f6;
}
html[data-desktop="true"] .app-shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
html[data-desktop="true"] .main-shell {
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
html[data-desktop="true"][data-sidebar-collapsed="1"] .main-shell,
html[data-desktop="true"] body.sidebar-collapsed .main-shell { width: 100%; margin-left: 0; }
html[data-desktop="true"] .topbar {
  flex: 0 0 50px;
  height: 50px;
  padding-inline: var(--desktop-gutter);
  border-bottom-color: #dce3ed;
}
html[data-desktop="true"] main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px var(--desktop-gutter) calc(var(--desktop-status-height) + 16px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-padding-block: 16px;
}
html[data-desktop="true"] body:has(dialog[open]) main { overflow: hidden; }
html[data-desktop="true"] main > :is(section, div) { min-width: 0; }
html[data-desktop="true"] .page-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 4;
  align-items: center;
  height: var(--desktop-status-height);
  padding: 0 var(--desktop-gutter);
  border-top: 1px solid #dce3ed;
  background: #f7f9fc;
  color: #75849a;
  font-size: 11px;
  line-height: 1;
}
html[data-desktop="true"][data-sidebar-collapsed="1"] .page-footer,
html[data-desktop="true"] body.sidebar-collapsed .page-footer { left: 0; }

/* Keep navigation and window controls available while only the workspace scrolls. */
html[data-desktop="true"] .sidebar { width: var(--sidebar-width); padding: 17px 10px 12px; }
html[data-desktop="true"] .sidebar-search { margin: 18px 0 14px; }
html[data-desktop="true"] .sidebar .brand { font-size: 22px; }
html[data-desktop="true"] .sidebar .nav-item,
html[data-desktop="true"] .sidebar .nav-group summary { min-height: 39px; padding-block: 9px; }
html[data-desktop="true"] .sidebar .nav-subitem { min-height: 34px; padding-block: 7px; }
html[data-desktop="true"] .sidebar .sidebar-bottom { margin-top: 12px; padding-top: 12px; }
html[data-desktop="true"] .page-heading,
html[data-desktop="true"] #daily-page .page-heading { margin-bottom: 14px; min-height: 34px; }
html[data-desktop="true"] .page-heading > div:first-child { min-width: 0; }
html[data-desktop="true"] .page-heading h1 { font-size: 22px; }
html[data-desktop="true"] .heading-actions { justify-content: flex-end; }
html[data-desktop="true"] .page-heading p:empty { display: none; }
html[data-desktop="true"] :is(.bs-scope, .funding-scope, .op-scope) {
  padding: 12px 14px;
  margin-bottom: 14px;
  gap: 10px 16px;
}
html[data-desktop="true"] :is(.bs-scope, .funding-scope, .op-scope) > label { gap: 5px; }
html[data-desktop="true"] .bs-scope :is(input, select) { min-width: 128px; }
html[data-desktop="true"] .bs-scope #business-company { min-width: 180px; }
html[data-desktop="true"] .funding-scope .snapshot-select select { max-width: 560px; }

/* Use one horizontal summary strip, followed by the working records. */
html[data-desktop="true"] #business-content:has(> .bs-panel) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
html[data-desktop="true"] #business-content:has(> .bs-panel) > * { min-width: 0; margin-block: 0; }
html[data-desktop="true"] #business-content > .bs-summary-search { order: 1; }
html[data-desktop="true"] #business-content > #bs-summary { order: 2; }
html[data-desktop="true"] #business-content > .bs-panel { order: 3; }
html[data-desktop="true"] #business-content > #bs-group-summary { order: 4; }
html[data-desktop="true"] .bs-summary-search { gap: 10px; }
html[data-desktop="true"] .bs-summary-search input { max-width: 420px; }
html[data-desktop="true"] .bs-summary-heading { margin: 0 0 10px; }
html[data-desktop="true"] .bs-summary-heading h2 { font-size: 14px; }
html[data-desktop="true"] .bs-summary-heading p { margin-top: 3px; font-size: 12px; }
html[data-desktop="true"] .bs-summary-metrics {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
  margin: 0;
}
html[data-desktop="true"] .bs-summary-metrics .bs-metric { padding: 12px 15px; }
html[data-desktop="true"] .bs-summary-metrics .bs-metric > strong { margin: 8px 0 4px; }
html[data-desktop="true"] .bs-summary-metrics .bs-number { font-size: 25px; }
html[data-desktop="true"] .bs-summary-note { margin: 8px 0 0; font-size: 12px; }
html[data-desktop="true"] :is(.panel-heading, .bs-group-heading) { min-height: 47px; padding: 10px 15px; }
html[data-desktop="true"] .bs-table-filter { padding: 9px 15px; }
html[data-desktop="true"] .table-footer { min-height: 47px; padding: 9px 15px; }
html[data-desktop="true"] .table-footer > span { min-width: 0; overflow-wrap: anywhere; }
html[data-desktop="true"] .table-footer .pagination { flex-shrink: 0; }

/* Tables keep their headers, totals and actions within their own scroll area. */
html[data-desktop="true"] main .table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  scrollbar-width: auto;
  scrollbar-color: #acb9ca #f3f5f8;
}
html[data-desktop="true"] :is(.bs-panel, #funding-page .ledger-panel, #trs-page .ledger-panel, #wealth-page .ledger-panel) > .table-scroll,
html[data-desktop="true"] #ledger-detail > .table-scroll {
  max-height: clamp(260px, calc(100dvh - 355px), 1100px);
}
html[data-desktop="true"] .bs-group-summary > .table-scroll { max-height: clamp(240px, 45dvh, 650px); }
html[data-desktop="true"] main .table-scroll:focus-visible { outline: 2px solid #4096ff; outline-offset: -2px; }
html[data-desktop="true"] main .table-scroll thead { position: sticky; top: 0; z-index: 3; }
html[data-desktop="true"] main .table-scroll thead th { background: #f2f5fa; box-shadow: inset 0 -1px #dfe6ef; }
html[data-desktop="true"] main .table-scroll tfoot { position: sticky; bottom: 0; z-index: 2; }
html[data-desktop="true"] main .table-scroll tfoot :is(th, td) { background: #edf4ff; box-shadow: inset 0 1px #d3e1f5; }
html[data-desktop="true"] .bs-table :is(th, td) { padding-inline: 12px; max-width: none; }
/* Contract identifiers and full-precision figures size their own columns. The
   enclosing table-scroll owns horizontal overflow, never adjacent cells. */
html[data-desktop="true"] .bs-table { table-layout: auto; }
html[data-desktop="true"] .bs-table :is(th, td)[data-kind="text"],
html[data-desktop="true"] .bs-table :is(th, td)[data-kind="number"] { white-space: nowrap; }
html[data-desktop="true"] .bs-panel .bs-table td { height: 43px; }
html[data-desktop="true"] .bs-table th { height: 42px; }
html[data-desktop="true"] .ledger-table :is(th, td):first-child { padding-left: 15px; }
html[data-desktop="true"] .bs-table :is(th, td).bs-sticky { min-width: 66px; }
html[data-desktop="true"] .ledger-table td small { line-height: 1.45; }
html[data-desktop="true"] .bs-summary-table :is(th, td) { padding-block: 8px; }

/* The total retains the original statement groups, scaled to the available workspace. */
html[data-desktop="true"] .wb-statement-toolbar { padding: 12px 15px; }
html[data-desktop="true"] .wb-total-summary { padding: 0 15px 14px; }
html[data-desktop="true"] .wb-statement-grid { gap: 16px; padding: 0 15px 15px; }
html[data-desktop="true"] .wb-statement-cell > button { padding-block: 9px; }
html[data-desktop="true"] .wb-statement-label { font-size: 14px; }
html[data-desktop="true"] .wb-statement-amount { font-size: 15px; }
html[data-desktop="true"] .wb-statement-title { font-size: 16px; }
html[data-desktop="true"] .wb-summary-amount,
html[data-desktop="true"] .wb-total-summary .wb-statement-gap > strong { font-size: clamp(24px, 1.6vw, 30px); }
html[data-desktop="true"] .bs-rate-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 370px), 1fr)); }
html[data-desktop="true"] .overview-grid { gap: 14px; }
html[data-desktop="true"] .overview-card { padding: 16px; }
html[data-desktop="true"] #daily-page .overview-metric { min-height: 0; }

/* Editors stay legible at normal and maximized window sizes. */
html[data-desktop="true"] .modal.large { width: min(1120px, 94vw); }
html[data-desktop="true"] .drawer:has(:is(.bs-detail, .op-detail)) { width: min(1100px, 84vw); }
html[data-desktop="true"] .toast-container { bottom: calc(var(--desktop-status-height) + 16px); }

@media (min-width: 1800px) {
  html[data-desktop="true"] { --desktop-gutter: 22px; --sidebar-width: 224px; }
  html[data-desktop="true"] .overview-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html[data-desktop="true"] .composition-body { gap: 10px; flex-wrap: wrap; }
  html[data-desktop="true"] .composition-legend { flex: 1; min-width: 190px; }
  html[data-desktop="true"] .bs-table :is(th, td) { padding-inline: 14px; }
  html[data-desktop="true"] .wb-statement-grid { gap: 20px; }
}
@media (min-width: 2200px) {
  html[data-desktop="true"] #business-content:has(> .bs-panel):has(> #bs-group-summary:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) minmax(540px, 28%);
    column-gap: 16px;
  }
  html[data-desktop="true"] #business-content:has(> .bs-panel) > * { grid-column: 1 / -1; }
  html[data-desktop="true"] #business-content:has(> #bs-group-summary:not([hidden])) > .bs-panel { grid-column: 1; }
  html[data-desktop="true"] #business-content > #bs-group-summary:not([hidden]) { grid-column: 2; }
  html[data-desktop="true"] .bs-group-summary .bs-group-heading { flex-wrap: wrap; gap: 8px; }
  html[data-desktop="true"] .bs-group-summary > .table-scroll { max-height: clamp(280px, calc(100dvh - 355px), 1100px); }
}
@media (max-width: 1199px) {
  html[data-desktop="true"] { --desktop-gutter: 14px; --sidebar-width: 205px; }
  html[data-desktop="true"] .page-heading { flex-wrap: wrap; }
  html[data-desktop="true"] .heading-actions { justify-content: flex-start; }
  html[data-desktop="true"] .bs-scope .bs-mode { margin-left: 0; }
  html[data-desktop="true"] .bs-summary-metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); }
  html[data-desktop="true"] .bs-summary-metrics .bs-number { font-size: 22px; }
}
@media (max-width: 800px) {
  html[data-desktop="true"] { --desktop-gutter: 12px; }
  html[data-desktop="true"] .page-footer { gap: 8px; font-size: 10px; }
  html[data-desktop="true"] .bs-summary-search { align-items: stretch; }
  html[data-desktop="true"] .drawer:has(:is(.bs-detail, .op-detail)) { width: 96vw; max-width: 96vw; }
}
@media print {
  html[data-desktop="true"], html[data-desktop="true"] body,
  html[data-desktop="true"] .app-shell, html[data-desktop="true"] .main-shell,
  html[data-desktop="true"] main { height: auto; overflow: visible; }
  html[data-desktop="true"] .sidebar, html[data-desktop="true"] .topbar,
  html[data-desktop="true"] .page-footer { display: none; }
  html[data-desktop="true"] .main-shell { width: 100%; margin: 0; }
  html[data-desktop="true"] main .table-scroll { max-height: none; overflow: visible; }
}
