/* Local/mobile admin adaptation layer. Keep business logic and Excel output untouched. */
:root {
  --mobile-control-border: rgba(127, 84, 57, 0.48);
  --mobile-control-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 1px 6px rgba(78, 50, 29, 0.08);
  --mobile-panel-pad: 8px;
}

@media (max-width: 920px), (pointer: coarse) and (max-width: 1280px) {
  body.admin-body {
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: contain;
  }

  body.admin-body .topbar {
    position: sticky;
    top: 0;
    z-index: 80;
  }

  body.admin-body .topbar-inner {
    padding: 7px 8px;
    gap: 7px;
  }

  body.admin-body .brand-block {
    min-width: 0;
    gap: 8px;
  }

  body.admin-body .brand-logo {
    width: 118px;
    max-width: 34vw;
    height: auto;
  }

  body.admin-body .brand-title {
    min-width: 0;
    gap: 1px;
  }

  body.admin-body .brand-title strong {
    font-size: 16px;
    line-height: 1.15;
  }

  body.admin-body .brand-title span {
    font-size: 12px;
    line-height: 1.25;
  }

  body.admin-body .btn,
  body.admin-body button,
  body.admin-body input:not([type='checkbox']):not([type='radio']),
  body.admin-body select,
  body.admin-body textarea,
  body.admin-body summary {
    border-color: var(--mobile-control-border);
    box-shadow: var(--mobile-control-shadow);
  }

  body.admin-body .btn,
  body.admin-body button,
  body.admin-body select,
  body.admin-body summary {
    min-height: 40px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.2;
  }

  body.admin-body input:not([type='checkbox']):not([type='radio']),
  body.admin-body textarea {
    min-height: 42px;
    border-radius: 8px;
    font-size: 14px;
  }

  body.admin-body input[type='checkbox'] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
  }

  body.admin-body .btn:focus-visible,
  body.admin-body button:focus-visible,
  body.admin-body input:focus-visible,
  body.admin-body select:focus-visible,
  body.admin-body textarea:focus-visible,
  body.admin-body summary:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent, #0f766e) 34%, transparent);
    outline-offset: 2px;
  }

  body.admin-body:not(.ledger-body) .topbar .button-row,
  body.admin-body.ledger-body .ledger-page-nav-row,
  body.admin-body.ledger-body .ledger-action-row,
  body.admin-body.customer-billing-body .customer-billing-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  body.admin-body:not(.ledger-body) .topbar .button-row > *,
  body.admin-body.ledger-body .ledger-page-nav-row > *,
  body.admin-body.ledger-body .ledger-action-row > *,
  body.admin-body.customer-billing-body .customer-billing-toolbar > * {
    flex: 0 0 auto;
  }

  body.admin-body .admin-page {
    padding: 7px;
  }

  body.admin-body .admin-shell {
    display: block;
  }

  body.admin-body .admin-sidebar {
    position: static;
    margin: 0 0 7px;
  }

  body.admin-body .admin-sidebar-card {
    padding: 7px;
    gap: 7px;
  }

  body.admin-body .admin-sidebar-header {
    display: none;
  }

  body.admin-body .activity-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 55vw);
    overflow-x: auto;
    gap: 7px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body .activity-card {
    min-height: 72px;
    padding: 9px;
  }

  body.admin-body .admin-tabs {
    position: sticky;
    top: var(--admin-mobile-topbar-offset, 58px);
    z-index: 65;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 7px;
    margin-bottom: 7px;
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body .admin-tabs .admin-tab,
  body.admin-body .admin-tabs .tab-btn {
    flex: 0 0 auto;
    min-width: 120px;
    padding: 9px 12px;
    border-color: rgba(15, 118, 110, 0.24);
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
  }

  body.admin-body .admin-tabs .admin-tab:not(.active),
  body.admin-body .admin-tabs .tab-btn:not(.active) {
    background: rgba(255, 255, 255, 0.78);
    color: var(--brand, #244b3b);
  }

  body.admin-body .admin-tabs .admin-tab:focus:not(:focus-visible),
  body.admin-body .admin-tabs .tab-btn:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
  }

  body.admin-body .admin-tabs .admin-tab:focus-visible,
  body.admin-body .admin-tabs .tab-btn:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.34);
    outline-offset: 2px;
  }

  body.admin-body .admin-tabs .admin-tab.active,
  body.admin-body .admin-tabs .tab-btn.active {
    border-color: var(--brand, #244b3b);
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.13);
  }

  body.admin-body #submissionPanel .panel-header,
  body.admin-body #submissionPanel .panel-body {
    padding: 8px;
  }

  body.admin-body #submissionPanel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  body.admin-body #submissionPanel .toolbar,
  body.admin-body #submissionPanel .view-tabs,
  body.admin-body #submissionPanel .submission-filter-grid,
  body.admin-body #submissionPanel .submission-action-bar,
  body.admin-body #submissionPanel .submission-summary {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  body.admin-body #submissionPanel .submission-filter-grid > * {
    flex: 0 0 172px;
  }

  body.admin-body #submissionPanel .submission-action-primary,
  body.admin-body #submissionPanel .submission-action-secondary {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: auto;
  }

  body.admin-body #submissionPanel .submission-action-bar .btn,
  body.admin-body #submissionPanel .view-tab {
    min-height: 36px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  body.admin-body #submissionPanel .summary-pill,
  body.admin-body .ledger-pill {
    min-height: 32px;
    white-space: nowrap;
  }

  body.admin-body #submissionPanel .table-wrap {
    overflow: auto;
    height: var(--submission-table-fit-height, calc(100dvh - 286px));
    min-height: 270px;
    max-height: none;
    border: 1px solid var(--online-table-grid-line, var(--line, #1f2937));
    border-radius: 8px 8px 0 0;
    background: var(--table-bg, #fff);
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body #submissionPanel .table-scrollbar-proxy:not([hidden]) {
    display: block !important;
    position: sticky;
    bottom: 0;
    height: 20px;
    border: 1px solid var(--online-table-grid-line, var(--line, #1f2937));
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: var(--table-bg, #fff);
  }

  body.admin-body #submissionPanel .table-wrap table {
    display: table;
    width: max-content;
    min-width: max(1180px, 100%);
    table-layout: auto;
    border-collapse: collapse;
    background: var(--table-bg, #fff);
  }

  body.admin-body #submissionPanel :where(thead, tbody) {
    display: table-row-group;
  }

  body.admin-body #submissionPanel thead {
    display: table-header-group;
  }

  body.admin-body #submissionPanel tr {
    display: table-row;
  }

  body.admin-body #submissionPanel #submissionTableHead > tr:first-child,
  body.admin-body #submissionPanel .column-filter-row {
    display: table-row;
  }

  body.admin-body #submissionPanel tbody td,
  body.admin-body #submissionPanel thead th,
  body.admin-body #submissionPanel .column-filter-row th {
    display: table-cell;
    border: 1px solid var(--online-table-grid-line, var(--line, #1f2937));
    padding: 6px 8px;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
  }

  body.admin-body #submissionPanel tbody td::before {
    display: none;
    content: none;
  }

  body.admin-body #submissionPanel tbody tr {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }

  body.admin-body #submissionPanel .compact-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 5px;
  }

  body.admin-body #submissionPanel .compact-actions .btn {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
  }

  body.admin-body.ledger-body .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    padding: 7px 8px;
    gap: 6px;
  }

  body.admin-body.ledger-body .brand-block {
    order: 0;
  }

  body.admin-body.ledger-body .brand-title span {
    display: none;
  }

  body.admin-body.ledger-body .ledger-page-nav-row {
    order: 1;
    justify-content: flex-start;
    margin: 0;
    padding: 0 0 2px;
  }

  body.admin-body.ledger-body .ledger-action-row,
  body.admin-body.customer-billing-body .customer-billing-toolbar {
    order: 2;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
  }

  body.admin-body.ledger-body .topbar .btn,
  body.admin-body.customer-billing-body .topbar .btn {
    min-height: 36px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  body.admin-body.ledger-body .ledger-page {
    padding: 7px;
  }

  body.admin-body.ledger-body .ledger-status-panel {
    padding: 7px 8px;
    margin-bottom: 6px;
    gap: 5px;
  }

  body.admin-body.ledger-body .ledger-status-panel h2,
  body.admin-body.ledger-body .ledger-status-panel h3 {
    font-size: 17px;
    line-height: 1.25;
  }

  body.admin-body.ledger-body .ledger-status-panel .hint {
    max-height: 3em;
    overflow: auto;
  }

  body.admin-body.ledger-body .ledger-tabs,
  body.admin-body.ledger-body .ledger-context-tools {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body.ledger-body .ledger-tab,
  body.admin-body.ledger-body .ledger-context-tools .btn,
  body.admin-body.ledger-body .ledger-context-tools button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  body.admin-body.ledger-body .ledger-sheet-shell {
    border-radius: 7px 7px 0 0;
  }

  body.admin-body.ledger-body .ledger-sheet-scroll {
    height: var(--ledger-fit-scroll-height, calc(100dvh - 178px)) !important;
    max-height: none !important;
    min-height: 270px;
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body.customer-billing-body .ledger-sheet-scroll,
  body.admin-body.driver-billing-body .ledger-sheet-scroll,
  body.admin-body.route-ledger-body .ledger-sheet-scroll {
    height: var(--ledger-fit-scroll-height, calc(100dvh - 168px)) !important;
  }

  body.admin-body.ledger-body .ledger-sheet {
    font-size: 13px;
  }

  body.admin-body.ledger-body .ledger-sheet th,
  body.admin-body.ledger-body .ledger-sheet td {
    min-height: 40px;
    padding: 6px 8px;
  }

  body.admin-body.ledger-body .ledger-head-cell {
    gap: 4px;
    justify-content: center;
  }

  body.admin-body.ledger-body .table-head-filter,
  body.admin-body.ledger-body .ledger-filter-input {
    min-height: 36px;
    border-radius: 7px;
    font-size: 12px;
  }

  body.admin-body.ledger-body .ledger-filter-menu {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    transform: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: min(70dvh, 460px);
    z-index: 2400;
    overflow: hidden;
  }

  body.admin-body.ledger-body .ledger-filter-menu::before {
    content: '';
    display: block;
    width: 42px;
    height: 4px;
    margin: 4px auto 8px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 32%, transparent);
  }

  body.admin-body.ledger-body .ledger-filter-options {
    max-height: min(42dvh, 300px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.admin-body.ledger-body .ledger-filter-option {
    min-height: 34px;
    font-size: 13px;
  }

  body.admin-body.ledger-body .trip-preview-modal,
  body.admin-body .modal-backdrop {
    padding: 0;
  }

  body.admin-body.ledger-body .trip-preview-card,
  body.admin-body .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }

  body.admin-body.ledger-body .trip-preview-header,
  body.admin-body .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }
}

@media (max-width: 520px) {
  body.admin-body .topbar-inner {
    padding: 6px;
  }

  body.admin-body .brand-logo {
    width: 96px;
    max-width: 36vw;
  }

  body.admin-body .brand-title strong {
    font-size: 14px;
  }

  body.admin-body .brand-title span {
    display: none;
  }

  body.admin-body .btn,
  body.admin-body button,
  body.admin-body select,
  body.admin-body summary {
    min-height: 38px;
    padding: 7px 9px;
    font-size: 12px;
  }

  body.admin-body input:not([type='checkbox']):not([type='radio']),
  body.admin-body textarea {
    min-height: 40px;
    font-size: 13px;
  }

  body.admin-body .admin-tabs {
    top: var(--admin-mobile-topbar-offset, 52px);
  }

  body.admin-body #submissionPanel .table-wrap {
    height: var(--submission-table-fit-height, calc(100dvh - 258px));
  }

  body.admin-body.ledger-body .ledger-sheet-scroll,
  body.admin-body.customer-billing-body .ledger-sheet-scroll,
  body.admin-body.driver-billing-body .ledger-sheet-scroll,
  body.admin-body.route-ledger-body .ledger-sheet-scroll {
    height: var(--ledger-fit-scroll-height, calc(100dvh - 148px)) !important;
  }
}

/* Ledger color toolbar final guard: keep the target radios compact on tablet/mobile. */
body.admin-body.ledger-body .ledger-context-tools {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  min-width: 0 !important;
  margin: 4px 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}

body.admin-body.ledger-body .ledger-context-tools.ledger-project-preview-warning-open {
  overflow: visible !important;
}

body.admin-body.ledger-body .ledger-context-tools::-webkit-scrollbar {
  display: none !important;
}

body.admin-body.ledger-body .ledger-unified-color-tools {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 240px !important;
  min-height: 34px !important;
  padding: 4px 6px !important;
  border: 1px solid rgba(15, 118, 110, 0.18) !important;
  border-radius: 8px !important;
  background: #f7fbfa !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
}

body.admin-body.ledger-body .ledger-unified-color-tools::-webkit-scrollbar {
  display: none !important;
}

body.admin-body.ledger-body .ledger-tool-label,
body.admin-body.ledger-body #ledgerColorTargetHint {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

body.admin-body.ledger-body .ledger-color-targets,
body.admin-body.ledger-body .ledger-color-buttons {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 5px !important;
  min-width: 0 !important;
}

body.admin-body.ledger-body .ledger-color-targets label {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 26px !important;
  min-height: 26px !important;
  margin: 0 !important;
  padding: 2px 8px !important;
  border: 1px solid rgba(15, 118, 110, 0.2) !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #0f3d38 !important;
  font-size: 12px !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.admin-body.ledger-body .ledger-color-targets input,
body.admin-body.ledger-body .ledger-color-targets input[type='radio'] {
  display: inline-block !important;
  flex: 0 0 13px !important;
  box-sizing: border-box !important;
  width: 13px !important;
  min-width: 13px !important;
  max-width: 13px !important;
  height: 13px !important;
  min-height: 13px !important;
  max-height: 13px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 999px !important;
  transform: none !important;
  zoom: 1 !important;
  border: 1px solid rgba(71, 85, 105, 0.56) !important;
  background: #fff !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

body.admin-body.ledger-body .ledger-color-targets input[type='radio']:checked {
  border-color: #3b82f6 !important;
  background: radial-gradient(circle, #3b82f6 0 42%, transparent 46%) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.16) !important;
}

/* ledger-preview-warning-toolbar-20260903a: warning menu lives in the compact toolbar, not above the table. */
body.admin-body.ledger-body .ledger-project-preview-warnings-toolbar {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  justify-content: flex-end !important;
  min-width: 126px !important;
  min-height: 34px !important;
  margin-left: auto !important;
  overflow: visible !important;
}

body.admin-body.ledger-body .ledger-project-preview-warning-toggle,
body.admin-body.ledger-body .ledger-project-preview-ok-badge {
  flex: 0 0 auto !important;
  min-height: 24px !important;
  padding: 2px 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
}

body.admin-body.ledger-body .ledger-project-preview-warning-list {
  position: absolute !important;
  top: calc(100% + 5px) !important;
  right: 0 !important;
  z-index: 160 !important;
  width: min(420px, calc(100vw - 32px)) !important;
  max-height: min(360px, calc(100vh - 168px)) !important;
}

/* ledger-ipad-filter-popover-20260903a: keep four-table filters as compact column popovers on Pad. */
@media (pointer: coarse) and (min-width: 700px) and (max-width: 1280px) {
  body.admin-body.ledger-body .ledger-sheet {
    font-size: 12px !important;
  }

  body.admin-body.ledger-body .ledger-sheet th {
    min-height: 28px !important;
    padding: 1px 3px !important;
  }

  body.admin-body.ledger-body .ledger-sheet td {
    min-height: 26px !important;
    padding: 2px 4px !important;
  }

  body.admin-body.ledger-body .ledger-head-cell,
  body.admin-body.ledger-body .ledger-head-control {
    position: relative !important;
    gap: 2px !important;
    justify-content: center !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu-btn {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    width: min(220px, calc(100vw - 28px)) !important;
    min-width: 180px !important;
    max-height: min(300px, 52dvh) !important;
    padding: 8px !important;
    border-radius: 7px !important;
    overflow: hidden !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu::before {
    display: none !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu-title,
  body.admin-body.ledger-body .ledger-filter-menu-summary {
    margin-bottom: 5px !important;
    font-size: 12px !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu-input {
    height: 22px !important;
    min-height: 22px !important;
    padding: 1px 5px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu-actions {
    gap: 6px !important;
    margin-bottom: 5px !important;
  }

  body.admin-body.ledger-body .ledger-filter-menu-actions button {
    min-height: 24px !important;
    padding: 0 7px !important;
    border-radius: 5px !important;
    font-size: 11px !important;
  }

  body.admin-body.ledger-body .ledger-filter-options {
    max-height: min(210px, 36dvh) !important;
  }

  body.admin-body.ledger-body .ledger-filter-option {
    min-height: 26px !important;
    font-size: 12px !important;
  }

  /* driver-billing-row-compact-20260903a */
  body.admin-body.driver-billing-body .ledger-row-select-inline,
  body.admin-body.driver-billing-body .ledger-row-select-control {
    min-height: 22px !important;
    gap: 4px !important;
  }

  body.admin-body.driver-billing-body .ledger-row-select-control input {
    width: 14px !important;
    min-width: 14px !important;
    max-width: 14px !important;
    height: 14px !important;
    min-height: 14px !important;
    max-height: 14px !important;
  }

  body.admin-body.driver-billing-body .ledger-preview-row-action,
  body.admin-body.driver-billing-body .driver-billing-pricing-toggle {
    min-height: 22px !important;
    height: 22px !important;
    padding: 1px 7px !important;
    border-radius: 5px !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  body.admin-body.driver-billing-body .driver-billing-cell,
  body.admin-body.driver-billing-body .driver-billing-edit-input,
  body.admin-body.driver-billing-body .driver-billing-payment-select {
    min-height: 22px !important;
    max-height: 26px !important;
    padding: 1px 4px !important;
    font-size: 11px !important;
    line-height: 1.12 !important;
  }

  body.admin-body.driver-billing-body .driver-billing-edit-input,
  body.admin-body.driver-billing-body .driver-billing-payment-select {
    height: 22px !important;
  }

  body.admin-body.driver-billing-body .billing-date-cell {
    display: inline-flex !important;
    min-height: 22px !important;
    max-height: 24px !important;
    flex-direction: row !important;
    gap: 0 !important;
    font-weight: 400 !important;
    white-space: nowrap !important;
  }

  body.admin-body.driver-billing-body .billing-date-inline,
  body.admin-body.driver-billing-body .billing-date-year,
  body.admin-body.driver-billing-body .billing-date-month-day {
    display: inline !important;
    color: inherit !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
  }
}

/* admin-topbar-pad-size-20260903a: keep backend topbar buttons content-sized on every Pad breakpoint. */
body.admin-body:not(.ledger-body) .topbar .button-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}

body.admin-body:not(.ledger-body) .topbar .button-row > .btn,
body.admin-body:not(.ledger-body) .topbar .button-row > .toolbar-menu,
body.admin-body:not(.ledger-body) .topbar .button-row > .admin-theme-menu {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
}

body.admin-body:not(.ledger-body) .topbar .button-row > .btn,
body.admin-body:not(.ledger-body) .topbar .button-row > .toolbar-menu > summary,
body.admin-body:not(.ledger-body) .topbar .button-row > .admin-theme-menu > summary {
  width: auto !important;
  min-height: 36px !important;
  padding: 7px 12px !important;
  white-space: nowrap !important;
}

/* customer-billing-project-compact-20260903a: keep project list controls one-line and shallow on Pad. */
body.admin-body.customer-billing-body .customer-billing-compact-topbar {
  grid-template-columns: minmax(210px, auto) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 4px 8px !important;
  padding: 4px 10px !important;
}

body.admin-body.customer-billing-body .customer-billing-brand-block {
  min-height: 42px !important;
  max-height: 42px !important;
}

body.admin-body.customer-billing-body .brand-logo {
  width: 128px !important;
  max-width: 24vw !important;
  max-height: 36px !important;
  object-fit: contain !important;
}

body.admin-body.customer-billing-body .brand-title strong {
  font-size: 16px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

body.admin-body.customer-billing-body .ledger-page-nav-row {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-content: flex-end !important;
  gap: 5px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

body.admin-body.customer-billing-body .ledger-page-switcher {
  gap: 5px !important;
}

body.admin-body.customer-billing-body .ledger-page-nav-row > .btn,
body.admin-body.customer-billing-body .ledger-page-switcher .btn {
  min-height: 28px !important;
  height: 28px !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.admin-body.customer-billing-body .customer-billing-toolbar-home:not([hidden]) {
  grid-column: 1 / -1 !important;
  margin: 0 !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-head {
  display: grid !important;
  grid-template-columns: max-content minmax(0, 1fr) max-content !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 8px !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-title,
body.admin-body.customer-billing-body .customer-billing-directory-title strong {
  min-width: max-content !important;
  white-space: nowrap !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot {
  min-width: 0 !important;
  overflow: hidden !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-toolbar {
  display: grid !important;
  grid-template-columns: max-content minmax(220px, 1fr) auto !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-actions {
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  min-width: 0 !important;
  overflow: visible !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-actions .btn,
body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-group-select,
body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-notice {
  min-height: 30px !important;
  height: 30px !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.admin-body.customer-billing-body .customer-billing-directory-toolbar-slot .customer-billing-group-select {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 210px !important;
  max-width: none !important;
}

body.admin-body.customer-billing-body .customer-billing-merge-actions {
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 5px !important;
  min-width: max-content !important;
}

body.admin-body.customer-billing-body .customer-billing-merge-actions span {
  min-height: 26px !important;
  padding: 3px 8px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.admin-body.customer-billing-body .customer-billing-merge-actions .btn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* admin-title-two-line-lock-20260903a: keep backend title/subtitle as exactly two single-line rows. */
body.admin-body.admin-home-body .topbar-inner {
  flex-wrap: nowrap !important;
  align-items: center !important;
}

body.admin-body.admin-home-body .topbar .brand-block {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  max-width: none !important;
  gap: 8px !important;
}

body.admin-body.admin-home-body .topbar .brand-title {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  max-width: none !important;
  overflow: visible !important;
}

body.admin-body.admin-home-body .topbar .brand-title strong,
  body.admin-body.admin-home-body .topbar .brand-title span {
  display: block !important;
  width: max-content !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

body.admin-body.admin-home-body .topbar .button-row {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

@media (max-width: 860px) {
  body.admin-body.admin-home-body .topbar-inner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 6px 8px !important;
  }

  body.admin-body.admin-home-body .topbar .brand-block {
    align-self: flex-start !important;
  }

  body.admin-body.admin-home-body .topbar .button-row {
    width: 100% !important;
    justify-content: flex-start !important;
    margin: 0 !important;
    padding-bottom: 3px !important;
  }

  body.admin-body.admin-home-body .topbar .brand-logo {
    width: 96px !important;
    max-width: 24vw !important;
    height: auto !important;
  }

  body.admin-body.admin-home-body .topbar .brand-title strong {
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  body.admin-body.admin-home-body .topbar .brand-title span {
    display: block !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }
}

@media (max-width: 640px) {
  body.admin-body.admin-home-body .topbar .brand-logo {
    width: 84px !important;
    max-width: 22vw !important;
  }

  body.admin-body.admin-home-body .topbar .brand-title strong {
    font-size: 13px !important;
  }

body.admin-body.admin-home-body .topbar .brand-title span {
    font-size: 10px !important;
  }
}

/* admin-modal-layer-lock-20260903a: trip modals must sit above the sticky backend topbar on Pad. */
body.admin-body.admin-home-body .trip-preview-modal {
  z-index: 2500 !important;
}

body.admin-body.admin-home-body .image-save-modal,
body.admin-body.admin-home-body .qr-scan-modal {
  z-index: 2550 !important;
}

body.admin-body.admin-home-body .image-lightbox-modal {
  z-index: 2600 !important;
}

body.admin-body.admin-home-body .submit-confirm-modal {
  z-index: 2700 !important;
}
