/* Complete portal organization pass.
   This file intentionally loads last. It gives every workspace the same
   hierarchy without changing the portal's data or application behavior. */

:root {
  --workspace-gap: 18px;
  --section-gap: 14px;
  --content-width: 1560px;
  --ledger-height: 112px;
}

/* One predictable page rhythm across every primary and secondary view. */
.view.active-view {
  width: 100%;
  max-width: var(--content-width);
  display: grid;
  align-content: start;
  gap: var(--workspace-gap);
}
.view.active-view > * { min-width: 0; margin-top: 0; margin-bottom: 0; }
.panel { min-width: 0; padding: 22px; }
.panel-head { min-width: 0; margin-bottom: 14px; gap: 16px; }
.panel-head h2, .panel > h2 { margin: 0; font-size: 1.12rem; }
.panel-head p { max-width: 72ch; margin: 4px 0 0; }
.panel > .muted { max-width: 76ch; }
.count-badge { flex: 0 0 auto; }

/* The top bar is navigation, not another content card. */
.topbar { min-height: 84px; margin-bottom: 14px; }
.topbar-actions { min-width: 0; }
.page-heading { min-width: 180px; }
.page-heading h1 { margin: 0; }
.global-search { flex: 1 1 250px; min-width: 210px; max-width: 360px; }

/* Summary values read as one financial ledger instead of a wall of cards. */
.alert-center-summary,
.controller-summary,
.fleet-summary,
.analytics-metrics,
.ops-portfolio,
.ops-location-metrics,
.accounting-control-summary,
.planner-summary,
.security-grid {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}
.alert-center-summary > article,
.controller-summary > article,
.fleet-summary > article,
.analytics-metrics > article,
.ops-portfolio > article,
.ops-location-metrics > article,
.accounting-control-summary > article,
.planner-summary > article,
.security-grid > article {
  min-width: 0;
  min-height: var(--ledger-height);
  padding: 18px;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}
.alert-center-summary > article:last-child,
.controller-summary > article:last-child,
.fleet-summary > article:last-child,
.analytics-metrics > article:last-child,
.ops-portfolio > article:last-child,
.ops-location-metrics > article:last-child,
.accounting-control-summary > article:last-child,
.planner-summary > article:last-child,
.security-grid > article:last-child { border-right: 0; }
.alert-center-summary article.critical { background: #fff7f5; }
.alert-center-summary article.warning { background: #fffaf0; }
.ops-portfolio article.profit,
.fleet-summary article.ready,
.security-grid > article:first-child { background: #f0faf7; }
.analytics-metrics small,
.controller-summary small,
.fleet-summary small,
.security-card > small { letter-spacing: 0; text-transform: none; }
.analytics-metrics strong,
.controller-summary strong,
.fleet-summary strong,
.security-card > strong { margin-top: 10px; color: var(--text); font-family: var(--font-ui); }
.security-card > p { margin-top: 7px; color: var(--text-soft); font-size: .76rem; }

/* Intro panels share one restrained hierarchy. */
.alert-center-head,
.controller-hero,
.fleet-hero,
.analytics-toolbar,
.report-toolbar {
  padding: 20px 22px;
  border-color: var(--border);
  background: #fff;
}
.controller-hero h2, .fleet-hero h2, .analytics-toolbar h2,
.report-toolbar h2, .alert-center-head h2 { margin: 0; }
.controller-hero p, .fleet-hero p, .report-toolbar p,
.alert-center-head p { margin: 5px 0 0; }

/* Dashboard: decisive summary first, then work. */
.dashboard-grid { grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr); gap: var(--workspace-gap); }
.dashboard-grid > .panel { height: 100%; }
.alerts-panel .alert-list { max-height: 360px; overflow: auto; }
.fleet-panel .table-wrap { margin-top: 0; }

/* Alerts: one compact inbox with filters that wrap cleanly. */
.alert-center-head { background: linear-gradient(105deg, #edf6ff, #fff 62%); }
.alert-center-toolbar { align-items: end; gap: 20px; }
.alert-filter-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; }
.alert-filter-grid label { min-width: 0; }
.alert-filter-grid input, .alert-filter-grid select { width: 100%; }
.operation-alert > summary { min-height: 66px; }

/* Collections: the form is the task; the ledger supports it. */
.collections-layout { grid-template-columns: minmax(390px, .82fr) minmax(0, 1.18fr); gap: var(--workspace-gap); }
.closeout-panel, .ledger-panel { align-self: start; }
.closeout-panel h2 { font-size: 1.35rem; }
.closeout-panel .form-grid { margin-top: 20px; gap: 14px; }
.collection-period-preview { border-color: #cfe0f2; background: #f5f9fe; }
.collection-period-preview small { color: var(--text-muted); font-size: .7rem; letter-spacing: 0; }
.collection-period-preview strong { color: var(--text); font-size: .8rem; }
.collection-period-preview em { color: var(--text-muted); font-size: .7rem; }
.collection-calculation { color: #315273; border-color: #cfe0f2; background: #f2f7fd; font-family: var(--font-ui); }
.collection-ledger { max-height: 720px; padding-right: 4px; }

/* Reports: controls are clearly separated from the accounting document. */
#reportsView .report-toolbar { gap: 18px; }
.report-controls { gap: 12px; }
.report-filter-row, .report-custom-dates { gap: 12px; }
.report-action-row { padding-top: 12px; border-top: 1px solid var(--border); }
.report-sheet { margin-top: 0; }
.email-strip { margin-top: 0; }

/* Analytics: continuous totals and fewer competing cards. */
.analytics-toolbar > div:last-child { flex-wrap: wrap; }
.analytics-grid { margin-top: 0; gap: var(--workspace-gap); }
.analytics-grid > .panel { align-self: start; }
.profitability-scorecard .table-wrap { margin-top: 0; }

/* Operations: selected location is primary; diagnostics follow it. */
#operationsView > .ops-command { order: 1; }
#operationsView > .ops-portfolio { order: 2; }
#operationsView > .ops-location-management { order: 3; }
#operationsView > .accounting-control { order: 4; }
#operationsView > .collection-planner { order: 5; }
#operationsView > .ops-system-details { order: 6; }
.ops-command {
  min-height: 50px;
  padding: 11px 16px;
  justify-content: flex-end;
  border-color: #cfe0f2;
  background: #f4f9ff;
}
.ops-command > div:first-child { display: none; }
.ops-command-status { width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.ops-command-status small { color: var(--text-soft); }
.ops-location-management { margin-top: 0; gap: var(--workspace-gap); }
.ops-location-picker { top: 98px; padding: 17px; }
.ops-location-workspace { display: grid; gap: var(--section-gap); }
.ops-location-head { padding: 20px; }
.ops-location-head > div:first-child { min-width: 0; }
.ops-location-actions { margin-top: 13px; flex-wrap: wrap; }
.ops-location-actions button { min-height: 38px; }
.ops-location-profit { min-width: 190px; }
.ops-location-lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: var(--section-gap); }
.ops-location-lower > article:last-child { grid-column: 1 / -1; }
.ops-location-controllers { grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); }
.accounting-control, .collection-planner { padding: 20px; }
.accounting-control-grid { gap: 12px; }
.accounting-control-grid > article { min-width: 0; }
.planner-table-wrap { margin-top: 14px; }
.ops-system-details > summary { min-height: 62px; }

/* Fleet and controller administration: setup steps stay distinct. */
.section-tabs { width: max-content; max-width: 100%; overflow-x: auto; }
.controller-grid { margin-top: 0; gap: var(--workspace-gap); }
.controller-safety { gap: 0; padding: 0; overflow: hidden; }
.controller-safety > div { min-width: 0; padding: 18px; border-right: 1px solid var(--border); }
.controller-safety > div:last-child { border-right: 0; }
.rollout-panel { margin: 0; }
.fleet-layout { margin: 0; gap: var(--workspace-gap); }
.fleet-roster .panel-head { align-items: end; }

/* Imports: upload and history are balanced and easy to scan. */
.import-layout { gap: var(--workspace-gap); }
.drop-zone { min-height: 205px; margin-top: 18px; }
.import-history { max-height: 520px; overflow: auto; }

/* Security: primary protections first, long audit history last. */
.continuity-center, .audit-panel, .owner-security-panel, .alert-delivery-panel { margin-top: 0; }
.owner-security-panel, .alert-delivery-panel { padding: 20px 22px; }
.owner-security-panel > div:first-child, .alert-delivery-panel > div:first-child { max-width: 72ch; }
.audit-panel .table-wrap { margin-top: 0; }

/* Location and machine profile pages use calm, full-width work areas. */
.location-grid { gap: var(--workspace-gap); }
.location-account-panel, .machine-profile-panel { margin-top: 0; }
.location-account-tabs, .machine-profile-tabs { overflow-x: auto; }
.statement-toolbar { flex-wrap: wrap; }
.statement-grid { gap: var(--workspace-gap); }

/* Empty states should feel intentional rather than like missing content. */
.empty, .report-empty, .control-empty, .ops-directory-empty, .ticket-history-empty {
  min-height: 116px;
  padding: 24px;
  display: grid;
  place-content: center;
  color: var(--text-muted);
  border: 1px dashed #cbdbea;
  border-radius: 11px;
  background: #fbfdff;
  text-align: center;
}

@media (max-width: 1280px) {
  .analytics-metrics { grid-template-columns: repeat(3, 1fr); }
  .analytics-metrics > article:nth-child(3n) { border-right: 0; }
  .analytics-metrics > article:nth-child(n+4) { border-top: 1px solid var(--border); }
  .accounting-control-summary { grid-template-columns: repeat(3, 1fr); }
  .accounting-control-summary > article:nth-child(3) { border-right: 0; }
  .accounting-control-summary > article:nth-child(n+4) { border-top: 1px solid var(--border); }
}

@media (max-width: 1100px) {
  .dashboard-grid, .collections-layout { grid-template-columns: 1fr; }
  .alert-filter-grid { grid-template-columns: 1fr 1fr; }
  .security-grid { grid-template-columns: 1fr 1fr; }
  .security-grid > article:nth-child(2) { border-right: 0; }
  .security-grid > article:nth-child(n+3) { border-top: 1px solid var(--border); }
  .controller-safety { display: grid; grid-template-columns: 1fr; }
  .controller-safety > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .controller-safety > div:last-child { border-bottom: 0; }
}

@media (max-width: 760px) {
  :root { --workspace-gap: 14px; --ledger-height: 102px; }
  .view.active-view { gap: var(--workspace-gap); }
  .panel { padding: 17px; }
  .topbar {
    min-height: 76px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .page-heading { min-width: 0; }
  .topbar-actions { margin: 0; flex-wrap: nowrap; gap: 7px; }
  .global-search { order: 4; width: 100%; max-width: none; flex-basis: 100%; }
  .topbar-tool span { display: none; }
  .alert-center-summary,
  .controller-summary,
  .fleet-summary,
  .ops-portfolio,
  .ops-location-metrics,
  .planner-summary,
  .accounting-control-summary,
  .security-grid,
  .analytics-metrics { grid-template-columns: 1fr 1fr; }
  .alert-center-summary > article,
  .controller-summary > article,
  .fleet-summary > article,
  .ops-portfolio > article,
  .ops-location-metrics > article,
  .planner-summary > article,
  .accounting-control-summary > article,
  .security-grid > article,
  .analytics-metrics > article { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .alert-center-summary > article:nth-child(2n),
  .controller-summary > article:nth-child(2n),
  .fleet-summary > article:nth-child(2n),
  .ops-portfolio > article:nth-child(2n),
  .ops-location-metrics > article:nth-child(2n),
  .planner-summary > article:nth-child(2n),
  .accounting-control-summary > article:nth-child(2n),
  .security-grid > article:nth-child(2n),
  .analytics-metrics > article:nth-child(2n) { border-right: 0; }
  .alert-filter-grid { grid-template-columns: 1fr; }
  .ops-command { display: none; }
  .ops-location-lower { grid-template-columns: 1fr; }
  .ops-location-lower > article:last-child { grid-column: auto; }
  .ops-location-head { gap: 16px; }
  .ops-location-actions { display: grid; grid-template-columns: 1fr; }
  .ops-location-actions button { width: 100%; }
  .fleet-roster .panel-head { align-items: stretch; }
  .statement-toolbar > * { width: 100%; }
  #controllersView .section-tabs,
  #fleetView .section-tabs,
  #importsView .section-tabs,
  #securityView .section-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }
  #controllersView .section-tabs button,
  #fleetView .section-tabs button,
  #importsView .section-tabs button,
  #securityView .section-tabs button { width: 100%; }
}

@media (max-width: 480px) {
  .alert-center-summary,
  .controller-summary,
  .fleet-summary,
  .ops-portfolio,
  .ops-location-metrics,
  .planner-summary,
  .accounting-control-summary,
  .security-grid,
  .analytics-metrics { grid-template-columns: 1fr; }
  .alert-center-summary > article,
  .controller-summary > article,
  .fleet-summary > article,
  .ops-portfolio > article,
  .ops-location-metrics > article,
  .planner-summary > article,
  .accounting-control-summary > article,
  .security-grid > article,
  .analytics-metrics > article { min-height: 92px; border-right: 0; }
  .section-tabs { width: 100%; }
  .section-tabs button { flex: 1 0 auto; }
}

@media print {
  .view.active-view { display: block; }
}

/* Fleet-scale density: repeated records are compact directories. Diagnostics
   and secondary commands stay available through the row drawer and menu. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.location-grid,
.controller-grid,
.fleet-controller-roster {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.location-directory-row,
.controller-row,
.fleet-controller-row {
  position: relative;
  min-width: 0;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(230px, 1.45fr) minmax(90px, .48fr) minmax(120px, .7fr) minmax(145px, .86fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 14px 11px 17px;
  border: 0;
  border-top: 1px solid var(--border);
  background: #fff;
}
.location-directory-row:first-child,
.controller-row:first-child,
.fleet-controller-row:first-child { border-top: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.location-directory-row:last-child,
.controller-row:last-child,
.fleet-controller-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.location-directory-row:hover,
.controller-row:hover,
.fleet-controller-row:hover { background: #f8fbff; }
.directory-health { width: 10px; height: 10px; border-radius: 50%; background: #18a48f; box-shadow: 0 0 0 4px #e4f7f3; }
.directory-health.attention { background: #d26855; box-shadow: 0 0 0 4px #fff0ec; }
.directory-identity { min-width: 0; display: grid; gap: 4px; }
.directory-identity strong { overflow: hidden; color: var(--text); font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.directory-identity small { overflow: hidden; color: var(--text-muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.directory-metric { min-width: 0; display: grid; gap: 4px; }
.directory-metric small { color: var(--text-muted); font-size: .66rem; font-weight: 700; }
.directory-metric strong { overflow: hidden; color: #304967; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.controller-row { grid-template-columns: auto auto minmax(230px, 1.4fr) minmax(150px, .9fr) minmax(135px, .76fr) minmax(85px, .45fr) auto auto; }
.fleet-controller-row { grid-template-columns: auto auto minmax(230px, 1.4fr) minmax(80px, .4fr) minmax(135px, .7fr) minmax(155px, .9fr) auto; }
.controller-state { justify-self: start; white-space: nowrap; }
.row-health { padding: 5px 8px; color: #08796e; border-radius: 999px; background: #e7f7f3; font-size: .67rem; font-weight: 800; white-space: nowrap; }
.row-health.attention { color: #a64739; background: #fff0ec; }
.row-wide-note { grid-column: span 3; }
.directory-select { width: 28px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.directory-select input { width: 17px; height: 17px; margin: 0; accent-color: #2563eb; cursor: pointer; }
.controller-row.selected,
.fleet-controller-row.selected { background: #edf5ff; box-shadow: inset 3px 0 #3976d5; }

.directory-commandbar {
  position: sticky;
  top: 92px;
  z-index: 9;
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 12px;
  border: 1px solid #cdddec;
  border-radius: 13px;
  background: rgba(248, 252, 255, .97);
  box-shadow: 0 10px 26px rgba(40, 75, 116, .09);
}
.directory-commandbar.embedded { top: 92px; margin: 0 0 12px; box-shadow: none; }
.directory-commandbar > label:not(.directory-search) { min-width: 150px; display: grid; gap: 4px; color: var(--text-muted); font-size: .66rem; font-weight: 750; }
.directory-commandbar select { width: 100%; min-height: 40px; margin: 0; padding-block: 7px; }
.directory-search { position: relative; flex: 1 1 260px; min-width: 210px; }
.directory-search svg { position: absolute; top: 50%; left: 12px; width: 18px; height: 18px; fill: none; stroke: #68819d; stroke-width: 1.8; transform: translateY(-50%); pointer-events: none; }
.directory-search input { width: 100%; min-height: 40px; padding: 8px 12px 8px 39px; }
.directory-result-count { flex: 0 0 auto; align-self: center; padding: 0 5px; color: var(--text-muted); font-size: .7rem; font-weight: 750; white-space: nowrap; }
.density-button { min-height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; color: #315a86; border: 1px solid #c7d8e9; border-radius: 9px; background: #fff; font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; }
.density-button:hover { background: #edf5ff; }
.density-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.directory-bulk { align-self: center; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #bcd3ee; border-radius: 10px; background: #eaf3ff; }
.directory-bulk.hidden { display: none; }
.directory-bulk strong { padding: 0 7px; color: #234d7c; font-size: .68rem; white-space: nowrap; }
.directory-bulk button { min-height: 31px; padding: 6px 8px; color: #285989; border: 0; border-radius: 7px; background: transparent; font: inherit; font-size: .66rem; font-weight: 800; cursor: pointer; }
.directory-bulk button:hover { background: #fff; }
.column-hidden { display: none !important; }
.directory-column-menu { position: relative; align-self: end; }
.directory-column-menu > summary { min-height: 40px; display: flex; align-items: center; padding: 8px 12px; color: #315a86; border: 1px solid #c7d8e9; border-radius: 9px; background: #fff; font-size: .72rem; font-weight: 800; cursor: pointer; list-style: none; }
.directory-column-menu > summary::-webkit-details-marker { display: none; }
.directory-column-menu > summary:hover,.directory-column-menu[open] > summary { background: #edf5ff; }
.directory-column-menu > div { position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 190px; display: grid; gap: 2px; padding: 8px; border: 1px solid #c7d8e9; border-radius: 11px; background: #fff; box-shadow: 0 14px 32px rgba(35,68,104,.16); }
.directory-column-menu label { min-height: 34px; display: flex; align-items: center; gap: 9px; padding: 6px 8px; color: #304967; border-radius: 7px; font-size: .72rem; font-weight: 750; cursor: pointer; }
.directory-column-menu label:hover { background: #edf5ff; }
.directory-column-menu input { width: 16px; height: 16px; margin: 0; accent-color: #2563eb; }
.rollout-selection { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px 10px; padding: 11px 12px; border: 1px solid #bcd3ee; border-radius: 10px; background: #edf5ff; }
.rollout-selection.hidden { display: none; }
.rollout-selection strong,.rollout-selection span { color: #234d7c; font-size: .75rem; }
.rollout-selection small { grid-column: 1 / -1; overflow: hidden; color: #627993; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.rollout-selection button { color: #285989; border: 0; background: transparent; font: inherit; font-size: .66rem; font-weight: 800; cursor: pointer; }

.directory-compact .location-directory-row,
.directory-compact .controller-row,
.directory-compact .fleet-controller-row { min-height: 52px; padding-block: 6px; }
.directory-compact .directory-identity { gap: 1px; }
.directory-compact .directory-identity strong { font-size: .82rem; }
.directory-compact .directory-identity small,
.directory-compact .directory-metric small { font-size: .62rem; }
.directory-compact .row-action-menu > summary { width: 36px; height: 36px; }

.row-action-menu { position: relative; justify-self: end; z-index: 4; }
.row-action-menu[open] { z-index: 40; }
.row-action-menu > summary {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #385a80;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  list-style: none;
}
.row-action-menu > summary::-webkit-details-marker { display: none; }
.row-action-menu > summary:hover,
.row-action-menu[open] > summary { border-color: #cdddec; background: #edf5ff; }
.row-action-menu > summary:focus-visible { outline: 3px solid rgba(45, 103, 210, .24); outline-offset: 2px; }
.row-action-menu svg { width: 22px; height: 22px; fill: currentColor; }
.row-action-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: max-content;
  min-width: 205px;
  max-width: 280px;
  display: grid;
  gap: 3px;
  padding: 7px;
  border: 1px solid #ccdbea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(27, 52, 82, .18);
}
.row-action-popover button {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  color: #274667;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: .76rem;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.row-action-popover button:hover:not(:disabled) { background: #edf5ff; }
.row-action-popover button:disabled { color: #9aa8b7; cursor: not-allowed; }
.row-action-popover button.danger { color: #ae4339; }
.row-action-popover .menu-note { padding: 7px 10px 4px; color: var(--text-muted); border-top: 1px solid var(--border); font-size: .68rem; line-height: 1.4; }
.row-detail-drawer {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px 4px 6px;
  border-top: 1px solid var(--border);
}
.row-detail-drawer.hidden { display: none; }
.directory-more {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #315f91;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: #f7fbff;
  font: inherit;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}
.directory-more:hover { background: #edf5ff; }
.directory-more span { color: var(--text-muted); font-size: .68rem; font-weight: 650; }
.row-detail-drawer .controller-facts,
.row-detail-drawer .transport-strip,
.row-detail-drawer .controller-checks { margin: 0; }
.controller-detail-footer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 2px; }
.controller-detail-footer span { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: #fbfdff; }
.controller-detail-footer small { color: var(--text-muted); font-size: .65rem; }
.controller-detail-footer strong { color: #304967; font-size: .74rem; }

/* The action queue had space-between on a two-item row, which pushed copy
   into the middle of the card. Keep the status dot next to its text. */
.reliability-actions > article { justify-content: flex-start; }
.reliability-actions > article > span { flex: 1 1 auto; }

/* Advanced administration is progressive disclosure rather than four full
   configuration workspaces competing with the controller roster. */
.admin-disclosure { padding: 0; overflow: visible; }
.admin-disclosure > summary {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  cursor: pointer;
  list-style: none;
}
.admin-disclosure > summary::-webkit-details-marker { display: none; }
.admin-disclosure > summary h2 { margin: 0; font-size: 1rem; }
.admin-disclosure > summary p { margin: 3px 0 0; color: var(--text-muted); font-size: .72rem; }
.admin-disclosure > summary svg { width: 18px; height: 18px; fill: none; stroke: #52708f; stroke-width: 2; transition: transform .18s ease; }
.admin-disclosure[open] > summary svg { transform: rotate(180deg); }
.admin-disclosure-body { padding: 0 20px 20px; border-top: 1px solid var(--border); }
.admin-disclosure-body > .rollout-grid { margin-top: 18px; }

.record-detail-drawer { position: fixed; z-index: 120; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 44vw); }
.record-detail-drawer.hidden { display: none; }
.record-detail-scrim { width: 100%; height: 100%; padding: 0; border: 0; background: rgba(20, 39, 62, .25); cursor: default; }
.record-detail-drawer > section { min-width: 0; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #f8fbff; box-shadow: -18px 0 48px rgba(29, 53, 84, .18); animation: drawer-enter .2s cubic-bezier(.2,.8,.2,1); }
.record-detail-drawer > section > header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: #fff; }
.record-detail-drawer header small { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: .67rem; font-weight: 750; }
.record-detail-drawer header h2 { margin: 0; color: var(--text); font-size: 1.15rem; }
.record-detail-drawer .icon-button { width: 42px; height: 42px; display: grid; place-items: center; }
.record-detail-drawer .icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.record-detail-body { min-width: 0; padding: 18px 20px 30px; overflow: auto; }
.record-detail-body .row-detail-drawer { display: grid; padding: 0; border: 0; }
body.drawer-open { overflow: hidden; }
@keyframes drawer-enter { from { transform: translateX(24px); opacity: .72; } to { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .record-detail-drawer > section { animation: none; } }

@media (max-width: 1050px) {
  .location-directory-row,
  .controller-row,
  .fleet-controller-row { grid-template-columns: auto auto minmax(210px, 1fr) minmax(100px, .55fr) minmax(120px, .7fr) auto; }
  .controller-row > .directory-metric:nth-of-type(5),
  .fleet-controller-row > .directory-metric:nth-of-type(5),
  .location-directory-row > .directory-last-seen { display: none; }
  .row-health { display: none; }
}

@media (max-width: 700px) {
  .directory-commandbar { position: static; align-items: stretch; flex-wrap: wrap; }
  .directory-commandbar > label:not(.directory-search) { flex: 1 1 145px; }
  .directory-search { flex-basis: 100%; }
  .directory-bulk { order: 5; width: 100%; overflow-x: auto; }
  .directory-result-count { margin-left: 2px; }
  .location-directory-row,
  .controller-row,
  .fleet-controller-row { min-height: 64px; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 9px; padding: 10px; }
  .location-directory-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .location-directory-row > .directory-metric,
  .controller-row > .directory-metric,
  .fleet-controller-row > .directory-metric,
  .row-wide-note { display: none; }
  .controller-state { font-size: .57rem; }
  .row-action-popover { position: fixed; top: auto; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); left: 14px; width: auto; max-width: none; }
  .controller-detail-footer { grid-template-columns: 1fr; }
  .admin-disclosure > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-disclosure > summary .readonly-badge { display: none; }
  .record-detail-drawer { grid-template-columns: 1fr; }
  .record-detail-scrim { display: none; }
  .record-detail-drawer > section { width: 100%; }
}

/* Calm workspace refinement.
   One action hierarchy, fewer nested boxes, reliable touch targets, and a
   responsive command bar make the portal easier to operate at fleet scale. */
:root {
  --control-height: 42px;
  --touch-height: 44px;
  --hairline: color-mix(in srgb, var(--border) 86%, transparent);
  --row-hover: #f6faff;
}

.primary-button,
.action-button,
.table-action,
.text-button,
.icon-button,
.topbar-tool,
.logout-button,
.section-tabs button,
.location-account-tabs button,
.machine-profile-tabs button {
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}
.primary-button {
  width: auto;
  margin-top: 0;
  color: #fff;
  border: 1px solid var(--primary);
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(36, 104, 216, .16);
}
.primary-button:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.action-button,
.table-action,
.topbar-tool,
.icon-button {
  color: #315273;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: none;
}
.text-button {
  color: var(--primary-dark);
  border: 1px solid transparent;
  background: transparent;
}
.text-button:hover { border-color: var(--border); background: var(--surface-blue); }
.icon-button { width: var(--control-height); padding: 0; font-size: 1.1rem; }
.logout-button { width: var(--touch-height); height: var(--touch-height); padding: 0; }
.sidebar-toggle { right: -22px; width: var(--touch-height); height: 56px; border-color: var(--border-strong); }
.ops-location-actions,
.fleet-hero-actions,
.location-create-actions,
.statement-toolbar,
.report-action-row { gap: 9px; }

.panel {
  border-radius: 14px;
  border-color: var(--hairline);
  box-shadow: none;
}
.panel-head { align-items: center; }
.panel-head > div:first-child { min-width: 0; }
.panel-head h2,
.panel > h2 { line-height: 1.25; text-wrap: balance; }
.panel-head p,
.panel > .muted { color: var(--text-soft); line-height: 1.5; }
.accounting-control-grid,
.ops-grid,
.continuity-layout,
.statement-grid {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface);
}
.accounting-control-grid > article,
.ops-grid > article,
.continuity-layout > *,
.statement-grid > * {
  min-width: 0;
  padding: 18px;
  border: 0;
  border-right: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.accounting-control-grid > article:last-child,
.ops-grid > article:last-child,
.continuity-layout > *:last-child,
.statement-grid > *:last-child { border-right: 0; }

.table-wrap {
  overflow: auto;
  border-radius: 10px;
  scrollbar-gutter: stable;
  overscroll-behavior-inline: contain;
}
thead { position: sticky; top: 0; z-index: 1; }
th { height: 42px; font-size: .76rem; font-weight: 750; }
td { min-height: 44px; }
tbody tr { transition: background-color 120ms ease; }
tbody tr:hover { background: var(--row-hover); }
.control-list > article,
.ops-mini-ledger > article,
.ops-ticket-history > article,
.ops-upload-list > article,
.ops-timeline > article,
.import-history > article { border-radius: 0; box-shadow: none; }

.section-tabs {
  margin-bottom: 0;
  padding: 4px;
  border-color: var(--hairline);
  border-radius: 11px;
  background: #eaf1f8;
  box-shadow: none;
}
.section-tabs button { min-height: 38px; color: #536b89; border: 0; border-radius: 8px; background: transparent; }
.section-tabs button:hover { color: var(--primary-dark); background: rgba(255,255,255,.72); }
.section-tabs button.active { color: var(--primary-dark); background: #fff; box-shadow: 0 1px 5px rgba(42,73,112,.12); }

canvas { image-rendering: auto; }
svg { shape-rendering: geometricPrecision; text-rendering: geometricPrecision; }
.chart svg path,
.chart svg line,
.chart svg polyline { vector-effect: non-scaling-stroke; }
.brand-logo { max-inline-size: 100%; }

@media (max-width: 1100px) {
  .accounting-control-grid,
  .ops-grid,
  .continuity-layout,
  .statement-grid { grid-template-columns: 1fr; }
  .accounting-control-grid > article,
  .ops-grid > article,
  .continuity-layout > *,
  .statement-grid > * { border-right: 0; border-bottom: 1px solid var(--hairline); }
  .accounting-control-grid > article:last-child,
  .ops-grid > article:last-child,
  .continuity-layout > *:last-child,
  .statement-grid > *:last-child { border-bottom: 0; }
}

@media (max-width: 760px) {
  :root { --control-height: var(--touch-height); }
  main { padding-right: 14px; padding-left: 14px; }
  .topbar {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: auto auto;
    padding-top: 10px;
    padding-bottom: 12px;
  }
  .menu-button { grid-column: 1; grid-row: 1; }
  .page-heading { grid-column: 2; grid-row: 1; }
  .page-heading p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px minmax(104px, auto);
    gap: 8px;
  }
  .global-search { grid-column: 1; order: initial; min-width: 0; width: 100%; display: block; }
  #openQrScanner { grid-column: 2; }
  #installAppButton { grid-column: 3; }
  #rangeSelect { grid-column: 4; width: 100%; min-width: 0; min-height: var(--touch-height); }
  .topbar-tool { width: 44px; padding: 0; }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .global-search > input,
  .section-tabs button { min-height: var(--touch-height); }
  .metric-card { min-height: 110px; padding: 16px; }
  .metric-card strong { font-size: 1.7rem; }
  .panel-head { align-items: flex-start; }
  .panel-head .count-badge { margin-top: 1px; }
  .fleet-hero-actions,
  .location-create-actions,
  .statement-toolbar,
  .report-action-row { display: grid; grid-template-columns: 1fr 1fr; }
  .fleet-hero-actions > *,
  .location-create-actions > *,
  .statement-toolbar > *,
  .report-action-row > * { width: 100%; }
}

@media (max-width: 480px) {
  .topbar-actions { grid-template-columns: minmax(0, 1fr) 44px minmax(104px, auto); }
  #installAppButton { display: none !important; }
  #rangeSelect { grid-column: 3; }
  .fleet-hero-actions,
  .location-create-actions,
  .statement-toolbar,
  .report-action-row { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .panel-head { gap: 10px; }
}

@media (min-resolution: 2dppx) {
  .panel,
  .table-wrap,
  .section-tabs,
  .accounting-control-grid,
  .ops-grid,
  .continuity-layout,
  .statement-grid,
  .primary-button,
  .action-button,
  .table-action,
  .topbar-tool,
  .icon-button { border-width: .5px; }
}

/* Majestic Operations • 2026 workspace.
   Shared tokens and primitives apply to every view, not just the dashboard. */
:root {
  --page: #f3f5f4; --surface: #fff; --surface-subtle: #f7f9f8;
  --surface-blue: #eef5f3; --text: #1a3035; --text-soft: #52666b;
  --text-muted: #61767a; --border: #dce4e1; --border-strong: #bbcfc7;
  --primary: #087b69; --primary-dark: #075d50; --primary-soft: #e7f3ee;
  --success: #087258; --success-soft: #e8f4ed;
  --warning: #815308; --warning-soft: #fff4d7;
  --danger: #b83732; --danger-soft: #fff0ed;
  --radius-sm: 7px; --radius-md: 11px; --radius-lg: 14px;
  --shadow-card: 0 2px 5px #173d2c05; --workspace-gap: 22px;
}
body { background: var(--page); color: var(--text); }
body .hidden { display: none !important; }
::selection { background: #0a7c69; color: white; }
:focus-visible { outline: 3px solid #30a48c !important; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1000; top: -70px; left: 20px; padding: 12px 20px; background: white; color: var(--text); border: 2px solid var(--primary); }
.skip-link:focus { top: 12px; }
.app-shell { grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { padding: 28px 15px 20px; background: #102b30; color: #d4e3de; border: 0; box-shadow: none; backdrop-filter: none; }
.sidebar-brand { padding: 0 13px 24px; }
.brand-logo-sidebar { width: 158px; background: #fff; border-radius: 8px; padding: 7px 10px; }
.sidebar-brand small { padding: 7px 0 0; color: #a9c3ba; letter-spacing: .08em; text-transform: uppercase; font-size: .64rem; }
.sidebar nav { gap: 3px; min-height: 0; overflow-y: auto; flex: 1; align-content: start; padding-bottom: 12px; }
.sidebar-brand, .sidebar-foot { flex-shrink: 0; }
.nav-section { color: #8eafa5; margin: 23px 13px 8px; text-transform: uppercase; font-size: .63rem; letter-spacing: .13em; }
.nav-item { min-height: 39px; min-width: 0; width: 100%; color: #c2d5cf; border-radius: 7px; font-size: .8rem; padding: 8px 10px; font-weight: 500; }
.nav-item b { font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-alert-badge { flex-shrink: 0; }
.nav-item span, .nav-item svg { color: #8fb6a9; }
.nav-item:hover { color: white; background: #203c40; border-color: transparent; }
.nav-item.active { background: #265048; color: #fff; border-color: #40665b; box-shadow: inset 3px 0 #88d6b4; }
.nav-item.active span { color: #a8e5c9; }
.sidebar-foot { border-top: 1px solid #335056; padding-top: 14px; margin-top: 10px; }
.sidebar .user-chip, .sidebar .user-chip strong { color: #eff9f4; background: transparent; }
.sidebar .user-chip small, .sidebar-timezone { color: #aec7bc; }
.sidebar-timezone { display: block; margin: 5px 0 17px; font-size: .67rem; }
.sidebar .user-chip { min-width: 0; padding: 8px 0; }
.sidebar .user-chip strong { font-size: .75rem; }
.sidebar .user-chip small { font-size: .65rem; }
.sidebar .logout-button { width: 32px; min-width: 32px; height: 36px; }
.sidebar .avatar { background: #32564c; color: #c4eedc; border: 1px solid #487668; }
.sidebar .logout-button { color: #c5dbd2; }
.live-pill { color: #bbdbca; font-size: .7rem; letter-spacing: 0; }
.live-pill i { background: #81d5a9; box-shadow: none; }
.live-pill.stale { color: #ffe0a6; }
.live-pill.stale i { background: #e5b263; }
.sidebar-toggle { width: 24px; height: 42px; right: -12px; background: #f7faf8; border-color: #c1d0ca; }
main { min-width: 0; padding: 0 32px 48px; }
.topbar { min-height: 100px; padding: 20px 0; margin-bottom: 12px; background: var(--page); border-bottom: 1px solid var(--border); box-shadow: none; backdrop-filter: none; gap: 18px; }
.page-heading h1 { font-size: 1.48rem; line-height: 1.2; letter-spacing: -.04em; }
.page-heading p { font-size: .76rem; margin-top: 5px; }
.topbar-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.global-search { min-width: 180px; max-width: 235px; }
.global-search input { border-radius: 8px; background: #fff; font-size: .76rem; }
.topbar-tool { min-height: 38px; padding: 8px 10px; background: #fff; border: 1px solid var(--border); border-radius: 8px; color: #45615c; }
.topbar-tool span { font-size: .73rem; }
.freshness { border: 0; min-width: 95px; padding-left: 6px; }
.freshness .pulse { display: none; }
.freshness small { color: var(--text-soft); letter-spacing: .08em; font-size: .6rem; }
.freshness strong { font-size: .75rem; color: var(--text); }
#rangeSelect { min-height: 38px; max-width: 135px; }
.eyebrow, .workspace-intro .eyebrow { display: block; font-size: .63rem; letter-spacing: .17em; color: var(--primary); font-weight: 750; }
.workspace-welcome { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 0 8px; }
.workspace-welcome h2 { font-size: clamp(1.8rem,2.5vw,2.45rem); font-weight: 600; letter-spacing: -.055em; margin: 8px 0 6px; line-height: 1.13; }
.workspace-welcome p { margin: 0; font-size: .85rem; color: var(--text-soft); }
.workspace-shortcuts { display: flex; gap: 8px; flex-wrap: wrap; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 22px; background: white; }
.panel-head h2, .panel > h2 { font-size: 1rem; letter-spacing: -.025em; font-weight: 650; }
.panel-head h3 { font-size: .9rem; }
.panel-head p { font-size: .76rem; max-width: 75ch; }
.metric-grid { gap: 14px; }
.metric-card, .metric-card.featured { padding: 22px; border: 1px solid var(--border); border-radius: 12px; background: white; box-shadow: none; min-height: 152px; }
.metric-card::before, .metric-card::after { content: none; }
.metric-card.featured { border-top: 3px solid #338770; padding-top: 20px; }
.metric-card p { color: var(--text-soft); font-size: .78rem; font-weight: 550; margin: 0; }
.metric-card strong { font-size: clamp(1.8rem,2.5vw,2.5rem); color: var(--text); font-weight: 650; margin: 12px 0 5px; letter-spacing: -.045em; }
.metric-card > span { color: var(--text-muted); font-size: .71rem; }
.dashboard-grid { grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr); gap: 20px; }
.chart { min-height: 220px; }
.chart-panel, .alerts-panel { min-height: 300px; }
table { font-size: .8rem; }
th { background: #f6f8f7; color: #5e706d; font-size: .65rem; letter-spacing: .045em; font-weight: 650; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--border); }
td { padding: 15px 14px; border-bottom-color: #edf0ee; }
td strong { color: var(--text); font-weight: 600; }
td small { display: block; color: var(--text-soft); margin-top: 4px; }
tbody tr:hover { background: #f7fbf9; }
.table-wrap { overflow: auto; max-width: 100%; border: 1px solid #e4eae7; border-radius: 9px; }
.table-wrap table { min-width: 620px; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.primary-button, .action-button.primary { background: var(--primary); border-color: var(--primary); color: white; border-radius: 8px; box-shadow: none; }
.primary-button:hover { background: var(--primary-dark); }
.action-button, .secondary-button { background: white; border: 1px solid #cbdad3; border-radius: 8px; color: #29594b; box-shadow: none; font-weight: 600; font-size: .77rem; }
.action-button:hover { background: #edf6f1; border-color: #90b6a5; }
.text-button, .machine-profile-link, .location-link { color: var(--primary); }
input, select, textarea { background: #fff; border: 1px solid #cbd7d2; border-radius: 7px; color: var(--text); min-height: 42px; }
input::placeholder, textarea::placeholder { color: #6a7e78; }
label { color: #425c53; font-size: .77rem; font-weight: 550; }
.count-badge, .readonly-badge { background: #edf5f0; border-color: #d2e6da; color: #326149; border-radius: 6px; box-shadow: none; }
.ops-status, .status { font-size: .7rem; border-radius: 5px; font-weight: 600; text-transform: capitalize; }
.ops-status.online, .ops-status.balanced, .status.online { background: #e6f3ea; color: #246541; border-color: #c6e3d0; }
.ops-status.offline, .status.offline { background: #eff1f2; color: #59656b; border-color: #dbe0e3; }
.ops-status.checking, .ops-status.review, .ops-status.suspect { background: #fff4da; color: #855b0b; border-color: #eddcb3; }
.ops-status.error, .ops-status.protocol_fault, .status.error { background: #fff0ed; color: #a9342b; border-color: #efcec7; }
.alert-center-head, .controller-hero, .fleet-hero, .report-toolbar, .analytics-toolbar, .ops-command, .ops-location-head { background: #fff; }
.alert-center-head p, .controller-hero p, .fleet-hero p { max-width: 75ch; }
.ops-location-management { grid-template-columns: minmax(235px, .29fr) minmax(0,1fr); align-items: start; gap: 20px; }
.ops-location-picker { position: sticky; top: 116px; padding: 18px; }
.ops-location-filters { grid-template-columns: 1fr; }
.ops-location-tabs { max-height: 440px; overflow: auto; }
.ops-location-tab { padding: 14px 10px; background: white; border: 1px solid #e3eae5; border-radius: 8px; gap: 8px; margin-top: 8px; }
.ops-location-tab.active { background: #edf6f0; border-color: #87b39b; box-shadow: inset 3px 0 #35835c; }
.ops-location-tab > b { display: none; }
.ops-location-tab strong { font-size: .82rem; }
.ops-location-tab small { font-size: .69rem; }
.ops-location-workspace { gap: 16px; min-width: 0; }
.ops-location-head { align-items: flex-start; }
.ops-location-profit strong { color: var(--primary); }
.ops-location-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
.ops-location-metrics > article { min-height: 96px; border-bottom: 1px solid var(--border); padding: 16px; }
.ops-location-metrics strong { font-size: 1.25rem; }
.workspace-segments, .section-tabs { display: flex; flex-wrap: wrap; gap: 5px; border-bottom: 1px solid var(--border); padding: 0 0 8px; background: transparent; }
.workspace-segments button, .section-tabs button { border: 0; border-radius: 6px; background: transparent; color: var(--text-soft); font-size: .78rem; padding: 10px 14px; min-height: 40px; }
.workspace-segments button[aria-pressed="true"], .section-tabs button.active { color: #075d41; background: #e0eee5; font-weight: 700; }
.ops-location-lower { grid-template-columns: 1fr; }
.workspace-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px; }
.workspace-intro h2 { font-size: 1.5rem; margin: 5px 0; font-weight: 600; }
.workspace-intro p { margin: 5px 0 0; max-width: 75ch; font-size: .84rem; }
.voucher-toolbar { display: grid; grid-template-columns: minmax(220px,1fr) minmax(190px,.55fr); gap: 14px; margin: 16px 0; }
.voucher-toolbar label { display: grid; gap: 6px; }
#vouchersView .ops-record-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(220px,.45fr); gap: 30px; align-items: start; }
#protectedReprintForm { order: 0; }
.pin-settings { order: 1; padding: 17px; border: 1px solid var(--border); border-radius: 9px; background: #f7f9f8; }
.pin-settings summary { font-size: .85rem; font-weight: 650; cursor: pointer; min-height: 32px; }
.pin-settings form { margin-top: 14px; }
.reliability-ledger, .accounting-control-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
.reliability-ledger article, .accounting-control-summary article { border-bottom: 1px solid var(--border); background: white; }
.reliability-workbench, .accounting-control-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.reliability-actions, .control-list { max-height: 440px; overflow: auto; }
.collections-layout { grid-template-columns: minmax(320px,.9fr) minmax(0,1.1fr); }
.reset-panel { border-color: #efd3c8; background: #fffdfa; }
.reset-panel .panel-head h2 { color: #9b432f; }
.danger-confirm-button { background: #a93931; border-radius: 7px; }
.empty, .ticket-history-empty { padding: 32px 20px; background: #fafcfb; color: #5e756a; text-align: center; }
.login-shell { background: #f5f7f4; }
.login-art { background: #102b30; color: white; }
.login-copy h1 span { color: #b4cdc1; }
.login-copy h1 strong { color: #f2faf5; }
.login-card { box-shadow: none; border: 0; }
.login-route-mark { opacity: .25; }
.login-security div span { background: #eef4ef; color: #395d4a; }
.record-detail-drawer > section { background: #f7f9f7; }
@media (min-width: 1600px) { main { padding-right: 48px; padding-left: 48px; } }
@media (max-width: 1280px) {
 .app-shell { grid-template-columns: 222px minmax(0,1fr); }
 main { padding-left: 24px; padding-right: 24px; }
 .topbar { flex-wrap: wrap; }
 .topbar-actions { flex: 1 1 100%; justify-content: flex-start; }
 .global-search { max-width: none; }
 .ops-location-management { grid-template-columns: 1fr; }
 .ops-location-picker { position: static; }
 .ops-location-filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
 .ops-location-tabs { display: flex; gap: 10px; max-height: 240px; }
 .ops-location-tab { flex: 0 0 230px; }
}
@media (max-width: 1000px) {
 .app-shell { grid-template-columns: 80px minmax(0,1fr); }
 .sidebar-brand .brand-logo-sidebar { width: 150px; }
 .sidebar-brand { padding-left: 0; width: 48px; }
 .sidebar-brand small, .nav-item b, .nav-section, .sidebar-timezone, .sidebar-foot .user-chip > span:not(.avatar), .sidebar-foot .live-pill { display: none; }
 .sidebar nav .nav-item { justify-content: center; padding: 10px; }
 .sidebar.open .nav-item b, .sidebar.open .nav-section, .sidebar.open .sidebar-timezone { display: block; }
 .dashboard-grid, .collections-layout, .reliability-workbench, .accounting-control-grid { grid-template-columns: 1fr; }
 .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .workspace-welcome { align-items: flex-start; flex-direction: column; }
 .workspace-shortcuts { width: 100%; }
}
@media (min-width: 1101px) {
 .topbar { flex-wrap: nowrap; min-height: 90px; }
 .page-heading { min-width: 145px; }
 .topbar-actions { flex: 1 1 auto; flex-wrap: nowrap; justify-content: flex-end; }
 .topbar-tool { width: 38px; justify-content: center; padding: 8px; flex-shrink: 0; }
 .topbar-tool span { display: none; }
 .global-search { min-width: 155px; max-width: 235px; }
}
@media (max-height: 800px) and (min-width: 761px) {
 .sidebar { padding-top: 18px; padding-bottom: 12px; }
 .sidebar-brand { padding-bottom: 14px; }
 .brand-logo-sidebar { width: 138px; }
 .nav-section { margin: 9px 12px 4px; font-size: .6rem; }
 .nav-item { min-height: 36px; padding: 6px 10px; }
 .nav-item > span { width: 20px; height: 20px; }
 .sidebar-foot { padding-top: 10px; }
 .sidebar-timezone { margin-bottom: 9px; }
}
@media (max-width: 760px) {
 .app-shell, .app-shell.sidebar-collapsed { display: block; }
 .sidebar { width: 264px; }
 .sidebar.open .sidebar-brand { width: auto; }
 .sidebar.open .sidebar-brand small, .sidebar.open .sidebar-foot .live-pill { display: block; }
 .sidebar.open .sidebar-foot .user-chip > span { display: block; }
 .sidebar.open .sidebar nav .nav-item { justify-content: flex-start; }
 .sidebar-toggle { display: none; }
 main { padding: 0 16px 32px; }
 .topbar { position: relative; gap: 10px; min-height: 80px; padding: 18px 0; }
 .menu-button { background: #fff; border: 1px solid var(--border); border-radius: 7px; }
 .page-heading { min-width: 0; flex: 1; }
 .page-heading h1 { font-size: 1.3rem; }
 .page-heading p { font-size: .72rem; }
 .topbar-actions { gap: 7px; }
 .global-search { flex: 1 1 calc(100% - 70px); min-width: 160px; }
 #openQrScanner, #installAppButton { display: none; }
 #refreshWorkspace span { display: none; }
 #refreshWorkspace { width: 42px; justify-content: center; }
 .freshness { margin-left: 0; }
 .panel { padding: 16px; }
 .workspace-intro { align-items: flex-start; flex-direction: column; }
 .workspace-welcome h2 { font-size: 1.9rem; }
 .workspace-welcome p { font-size: .8rem; }
 .workspace-shortcuts .action-button { flex: 1; }
 .metric-grid { gap: 10px; }
 .metric-card, .metric-card.featured { padding: 16px; min-height: 132px; }
 .metric-card.featured { padding-top: 14px; }
 .metric-card strong { font-size: 1.75rem; }
 .metric-card p { font-size: .73rem; }
 .metric-card > span { font-size: .65rem; }
 .panel-head { flex-wrap: wrap; }
 .voucher-toolbar, #vouchersView .ops-record-grid { grid-template-columns: 1fr; }
 .ops-location-filters { grid-template-columns: 1fr; }
 .ops-location-metrics, .reliability-ledger, .accounting-control-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .workspace-segments button { padding: 10px 8px; font-size: .73rem; }
 .ops-location-head { flex-direction: column; }
 .ops-location-actions { flex-wrap: wrap; }
 input, select, textarea { font-size: 16px; }
 .table-wrap { margin-left: 0; margin-right: 0; }
 .section-tabs { overflow: auto; flex-wrap: nowrap; }
 .section-tabs button { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}
@media print {
 .skip-link, .workspace-segments, .workspace-shortcuts, #portalConnection { display: none; }
 body, main { background: white; }
}

/* Final cross-workspace polish: shared colors and compact task surfaces. */
#reportsView .report-toolbar, #reportsView .email-strip,
.staging-panel, .directory-commandbar { background: #fff; border-color: var(--border); box-shadow: none; }
#reportsView .report-controls .action-button:first-of-type,
.login-card .primary-button, .planner-stop { background: var(--primary); border-color: var(--primary); box-shadow: none; color: #fff; }
#reportsView .report-controls .action-button:first-of-type:hover,
.login-card .primary-button:hover { background: var(--primary-dark); }
.fleet-progress i { background: var(--primary); }
.ops-location-actions .action-button:first-child, .primary-action,
.pending-clear-icon, .fleet-guide li > b, .analytics-bar i,
.analytics-trend-point i, .ops-capacity i { background: var(--primary); border-color: var(--primary); }
.topbar-tool:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.report-heading .eyebrow, .report-subhead .eyebrow, .report-period-stamps > i,
.fleet-controller-card header > strong { color: var(--primary); }
.accounting-control, .pending-clear-panel { background: #fff; border-color: var(--border); }
.collection-calculation, .collection-period-preview { background: #f3f8f5; border-color: #d3e4da; color: #315748; }
.report-collection-card { border-left-color: var(--primary); }
.report-collection-card header, .period-line { background: #f4f8f5; }
.readonly-badge { font-family: inherit; letter-spacing: .02em; font-size: .72rem; white-space: normal; }
.workspace-utility { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text-soft); font-size: .8rem; }
.voucher-actions { min-width: 124px; }
.voucher-actions summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 7px; color: var(--primary); background: #fff; font-weight: 600; }
.voucher-actions summary::-webkit-details-marker { display: none; }
.voucher-actions summary span { font-size: 1.4rem; line-height: 1; }
.voucher-actions[open] summary { background: #edf6f1; }
.voucher-actions button { margin-top: 6px; width: 100%; }
.voucher-actions summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#vouchersView .workspace-utility { order: 0; }
#vouchersView .table-wrap { max-height: 430px; overscroll-behavior: contain; }
#vouchersView thead { position: sticky; top: 0; z-index: 1; }
#vouchersView .workspace-intro { display: none; }
.ops-command.panel { min-height: 0; padding: 8px 0; border: 0; background: transparent; box-shadow: none; }
.ops-command-status { justify-content: flex-start; }
.ops-command-status .readonly-badge { background: transparent; padding: 0; border: 0; }
.workspace-intro, .controller-hero, .fleet-hero { padding: 20px 22px; }
.controller-hero p, .fleet-hero p { font-size: .84rem; line-height: 1.6; }
.form-status:not(:empty) { padding: 10px 12px; border-radius: 6px; background: #f2f6f3; overflow-wrap: anywhere; }
.form-status:empty { margin: 0; }
.dashboard-context { margin: 0; color: #52665e; font-size: .76rem; line-height: 1.65; max-width: 110ch; }
#overviewView .metric-card { background: #fff; border-color: var(--border); }
#overviewView .metric-card strong { color: var(--text); }
#overviewView .metric-card:nth-child(3) { background: #edf6f1; border-color: #bdd6c8; }
#overviewView .metric-card:nth-child(3) strong { color: #24634c; }
#overviewView .metric-card.featured { border-top-width: 1px; padding-top: 22px; }
@media (min-width: 1101px) {
 .ops-location-management { grid-template-columns: 250px minmax(0,1fr); }
 .ops-location-picker { position: sticky; top: 110px; }
 .ops-location-filters { grid-template-columns: 1fr; }
 .ops-location-tabs { display: block; max-height: 350px; }
 .ops-location-tab { width: 100%; }
 .ops-location-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
 #vouchersView .table-wrap { max-height: 390px; }
 #vouchersView .table-wrap table { min-width: 0; width: 100%; }
 #vouchersView thead { display: none; }
 #vouchersView tbody, #vouchersView tr { display: block; }
 #vouchersView tr { padding: 10px; border-bottom: 1px solid var(--border); }
 #vouchersView td { display: block; padding: 6px; border: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; }
 #vouchersView td:nth-child(3)::before { content: "Value · "; font-size: .75rem; color: var(--text-soft); }
 #vouchersView td:nth-child(4)::before { content: "Issued · "; font-size: .75rem; color: var(--text-soft); }
 #vouchersView .voucher-actions summary { justify-content: space-between; min-height: 44px; }
}
@media (max-width: 760px) {
 .workspace-utility { align-items: stretch; flex-direction: column; gap: 8px; }
 .workspace-utility .action-button { min-height: 44px; }
 .action-button, .primary-button, .section-tabs button, .workspace-segments button, .nav-item { min-height: 44px; }
 .ops-location-tab { min-width: 0; }
 .readonly-badge { font-size: .7rem; }
 #overviewView .metric-grid { grid-template-columns: 1fr; }
 #overviewView .metric-card { min-height: 112px; }
 #overviewView .metric-card:nth-child(2) { order: 4; min-height: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
 #overviewView .metric-card:nth-child(2) strong { font-size: 1rem; margin: 0; }
 #overviewView .metric-card:nth-child(2) > span { display: none; }
}
@media print {
 #vouchersView .table-wrap { max-height: none; overflow: visible; }
 .workspace-utility { display: none; }
}
