/*
  Accessible Executive theme
  色弱友好高对比主题。作为独立覆盖层加载，便于预览和回滚。
*/
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #111827;
  --text: #111827;
  --muted: #4b5563;
  --line: #9aa4b2;
  --brand: #005f9e;
  --brand-dark: #003b64;
  --danger: #c2410c;
  --warn: #7a4f00;
  --soft: #d8ebf7;
  --brand-soft: #d8ebf7;
  --on-brand: #ffffff;
  --field-bg: #ffffff;
  --field-line: #8792a1;
  --field-placeholder: #64748b;
  --field-focus: rgba(0, 95, 158, 0.24);
  --fee-bg: #fff0c8;
  --upload-bg: #fff0c8;
  --upload-line: #e69f00;
  --upload-text: #5f3f00;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --tabs-bg: rgba(238, 241, 245, 0.96);
  --error-bg: #fee2d5;
  --accessible-accent: #e69f00;
  --accessible-accent-soft: #fff0c8;
  --accessible-purple: #6f4aa6;
  --accessible-purple-soft: #ece5f6;
  --accessible-grid: #8792a1;
  --online-table-grid-line: #1f2937;
  --online-table-row-bg: #ffffff;
  --driver-paid-row-bg: #fff1a6;
  --shadow: 0 18px 46px rgba(17, 24, 39, 0.12);
}

.driver-body.driver-theme-day,
.driver-body:not(.driver-theme-night) {
  color-scheme: light;
  --bg: #f4f1eb;
  --panel: #fffdf8;
  --ink: #10231d;
  --text: #10231d;
  --muted: #4d665c;
  --line: #a7b7ad;
  --brand: #0d4c3c;
  --brand-dark: #083528;
  --danger: #c2410c;
  --warn: #8a5a12;
  --soft: #e7efe4;
  --brand-soft: #dfeadc;
  --field-bg: #fffdf8;
  --field-line: #8fa397;
  --field-placeholder: #66796f;
  --field-focus: rgba(13, 76, 60, 0.24);
  --fee-bg: #eef2df;
  --topbar-bg: rgba(244, 241, 235, 0.96);
  --tabs-bg: rgba(231, 239, 228, 0.96);
  --error-bg: #fde8dd;
  --shadow: 0 18px 42px rgba(13, 76, 60, 0.12);
}

.driver-body.driver-theme-night {
  color-scheme: dark;
  background: linear-gradient(180deg, #001233 0%, #001845 100%);
  --bg: #001233;
  --panel: #071a36;
  --ink: #eef5ff;
  --text: #eef5ff;
  --muted: #c7d3e4;
  --line: #5c677d;
  --brand: #6f9ed8;
  --brand-dark: #d8e8ff;
  --danger: #fb923c;
  --warn: #d8c37a;
  --soft: #0f2f5c;
  --brand-soft: #102b51;
  --field-bg: #0d274c;
  --field-line: #62728d;
  --field-placeholder: #b9c7d8;
  --field-focus: rgba(111, 158, 216, 0.28);
  --fee-bg: #132f55;
  --topbar-bg: rgba(0, 18, 51, 0.96);
  --tabs-bg: rgba(0, 24, 69, 0.96);
  --error-bg: #4b2231;
  --shadow: 0 18px 42px rgba(0, 8, 24, 0.36);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 245, 247, 0.98)),
    var(--bg);
  color: var(--ink);
}

.topbar,
.admin-body .topbar,
.ledger-body .topbar {
  background: var(--topbar-bg);
  border-bottom-color: var(--line);
}

.panel,
.login-card,
.admin-sidebar-card,
.meal-admin-card,
.activity-address-card,
.ledger-status-panel,
.ledger-project-preview-header,
.driver-login-content,
.invoice-info-card,
.qr-panel,
.driver-preview,
.ops-manual-card {
  border-color: var(--line);
  background: var(--panel);
}

.admin-sidebar-action,
.activity-item,
.project-gate-card,
.logged-driver-bar,
.meal-batch-card,
.activity-address-suggestion-btn {
  border: 2px solid rgba(0, 95, 158, 0.36);
  background: #eef6fc;
  color: var(--brand-dark);
}

.admin-sidebar-action.active,
.activity-item.active {
  border-color: var(--brand);
  background: #d8ebf7;
  box-shadow: inset 4px 0 0 var(--brand);
}

.btn,
.toolbar-menu > summary,
.row-action-summary,
.ledger-filter-menu-actions button,
.ledger-cell-tools button,
.ledger-row-tool-buttons button,
.ledger-filter-menu-btn,
.ledger-project-driver-cost-toggle,
.mobile-row-action {
  border-color: rgba(0, 95, 158, 0.48);
  background: #ffffff;
  color: var(--brand);
  font-weight: 850;
}

.btn:hover,
.toolbar-menu > summary:hover,
.row-action-summary:hover,
.ledger-filter-menu-actions button:hover,
.ledger-project-driver-cost-toggle:hover {
  border-color: var(--brand);
  background: #e5f2fb;
  color: var(--brand-dark);
}

.btn:not(.secondary):not(.ghost):not(.danger),
.driver-login-panel .button-row .driver-app-download-btn,
.driver-section-tab.active,
.admin-tab.active,
.ledger-view-tab.active,
.quick-date-btn.active,
.calendar-day.selected,
.add-row-btn,
.ledger-filter-menu-btn.active,
.ledger-filter-menu-btn:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.btn.secondary {
  border-color: rgba(0, 95, 158, 0.48);
  background: #ffffff;
  color: var(--brand);
}

.btn.ghost {
  border-color: var(--line);
  background: transparent;
  color: #374151;
}

.driver-body.driver-theme-night .btn.ghost {
  color: var(--ink);
}

.btn.danger,
.remove-row-btn,
.danger,
.ledger-row-tool-buttons .danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.admin-tabs,
.driver-section-tabs,
.ledger-view-tabs {
  border-color: var(--line);
  background: var(--tabs-bg);
}

.admin-tab,
.driver-section-tab,
.ledger-view-tab,
.language-btn {
  border: 1.5px solid transparent;
  background: transparent;
  color: #374151;
}

.driver-body.driver-theme-night .admin-tab,
.driver-body.driver-theme-night .driver-section-tab,
.driver-body.driver-theme-night .ledger-view-tab,
.driver-body.driver-theme-night .language-btn {
  color: var(--ink);
}

.admin-tab.active,
.driver-section-tab.active,
.ledger-view-tab.active,
.language-btn.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

input,
select,
textarea,
.calendar-input,
.table-head-filter,
.ledger-filter-input,
.ledger-input,
.route-ledger-cell,
.driver-billing-cell,
.customer-billing-cell,
.route-ledger-edit-input,
.driver-billing-edit-input,
.customer-billing-edit-input,
.ledger-project-preview-edit-input {
  border-color: var(--field-line);
  background: var(--field-bg);
  color: var(--ink);
}

body.admin-body.customer-billing-luxury-green .customer-billing-group-select {
  --customer-billing-select-bg: var(--field-bg);
  --customer-billing-select-text: var(--ink);
  --customer-billing-select-line: var(--brand);
  --customer-billing-select-focus: var(--brand);
  --customer-billing-option-bg: var(--field-bg);
  --customer-billing-option-text: var(--ink);
  --customer-billing-option-group-text: var(--brand);
  --customer-billing-option-all-bg: var(--brand-soft);
  --customer-billing-option-all-text: var(--ink);
  --customer-billing-option-porsche-bg: #ffe1e8;
  --customer-billing-option-porsche-text: #7b1235;
  --customer-billing-option-casual-bg: #e7f6ef;
  --customer-billing-option-casual-text: #064c43;
}

input:focus,
select:focus,
textarea:focus,
.calendar-input:focus,
.table-head-filter:focus,
.ledger-filter-input:focus,
.ledger-project-preview-edit-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--field-focus);
}

.notice {
  border: 1px solid rgba(0, 95, 158, 0.34);
  border-left: 6px solid var(--brand);
  background: #e5f2fb;
  color: var(--brand-dark);
}

.errors,
.submit-warning,
.driver-returned-reminder,
.address-match-status[data-address-status-type="warn"],
.ledger-project-preview-warning-badge,
.ledger-project-preview-warning-detail td,
.ledger-project-preview-warning-cell,
.driver-billing-warning-cell {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: #7c2d12;
}

.errors,
.submit-warning,
.driver-returned-reminder {
  border-left-width: 7px;
}

.table-wrap,
.meal-table-wrap,
.ledger-sheet-shell,
.ledger-sheet-scroll {
  border-color: var(--accessible-grid);
}

table {
  background: #ffffff;
}

th,
td,
.ledger-sheet th,
.ledger-sheet td {
  border-color: var(--accessible-grid);
}

th,
.column-filter-row th,
.ledger-sheet th,
.meal-table-wrap th {
  background: #dfe5ec;
  color: #182334;
}

.table-head-filter,
.meal-table-wrap .table-head-filter,
.ledger-filter-menu-btn {
  border-color: rgba(17, 24, 39, 0.24);
  background: #ffffff;
  color: #374151;
}

.row-selected td,
.ledger-selected-row td {
  background: #e4f1fb !important;
  box-shadow: inset 0 3px 0 var(--brand), inset 0 -3px 0 var(--brand);
}

.ledger-selected-cell {
  outline-color: var(--accessible-accent);
}

.summary-pill,
.ledger-stat-badges span,
.ledger-stat-badges a,
.billing-total-badge,
.ledger-unsettled-status-chip,
.pill,
.retention-badge,
.badge {
  border: 2px solid rgba(0, 95, 158, 0.28);
  background: #d8ebf7;
  color: var(--brand-dark);
  font-weight: 850;
}

.summary-pill::before,
.ledger-stat-badges span::before,
.ledger-stat-badges a::before,
.billing-total-badge::before {
  content: "#";
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-right: 5px;
  border-radius: 999px;
  background: currentColor;
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
}

.summary-pill.pending,
.summary-pill.warning,
.ledger-unsettled-status-chip.missing,
.badge.pending,
.badge.warning,
.retention-badge.warning {
  border-color: rgba(230, 159, 0, 0.64);
  background: var(--accessible-accent-soft);
  color: var(--warn);
}

.summary-pill.pending::before,
.summary-pill.warning::before {
  content: "!";
}

.summary-pill.selected,
.ledger-stat-badges span.included,
.ledger-unsettled-status-chip.included,
.badge {
  border-color: rgba(0, 95, 158, 0.36);
  background: #d8ebf7;
  color: var(--brand-dark);
}

.summary-pill.selected::before,
.ledger-stat-badges span.included::before {
  content: "✓";
}

.summary-pill.danger-soft,
.retention-badge.expired,
.retention-badge.protected,
.badge.danger,
.badge.rejected {
  border-color: rgba(194, 65, 12, 0.62);
  background: var(--danger-soft);
  color: #7c2d12;
}

.summary-pill.danger-soft::before {
  content: "!";
}

.billing-total-badge {
  border-color: rgba(111, 74, 166, 0.45);
  background: var(--accessible-purple-soft);
  color: #4b247f;
}

.billing-total-badge::before {
  content: "￥";
}

.ledger-filter-menu,
.toolbar-menu-panel,
.row-action-menu-panel,
.summary-detail-list {
  border-color: var(--line);
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(17, 24, 39, 0.16);
}

.ledger-filter-option:hover,
.meal-project-option:has(input:checked) {
  background: #e5f2fb;
}

.ledger-filter-option input[type="checkbox"],
.submission-check,
.compact-check input,
.ledger-row-select-control input,
.meal-project-option input {
  accent-color: var(--brand);
}

.ledger-project-preview-money,
.ledger-project-preview-money-input,
.ledger-row-select-control,
.ledger-preview-row-action,
.activity-address-suggestion-btn strong,
.driver-clock,
.brand-title strong {
  color: var(--brand-dark);
}

.ledger-project-preview-edited-input,
.trip-edit-itinerary-tools span[data-status="warn"],
.trip-edit-itinerary-tools span[data-status="error"],
td.warn {
  border-color: var(--accessible-accent);
  background: var(--accessible-accent-soft) !important;
  color: var(--warn);
  font-weight: 900;
}

.ledger-row-select-head,
.ledger-row-select-cell {
  background: #f8fafc !important;
  color: var(--ink);
}

.online-billing-fee-cell,
.driver-billing-computed-td {
  background: #eef4f8 !important;
  color: var(--ink);
}

.driver-billing-warning-td {
  background: var(--danger-soft) !important;
}

.driver-billing-sheet .driver-billing-cell,
.driver-billing-sheet .driver-billing-computed-cell,
.driver-billing-sheet .driver-billing-warning-cell,
.driver-billing-sheet .driver-billing-edit-input {
  background: transparent !important;
}

.ledger-sheet .ledger-input,
.route-ledger-sheet .route-ledger-cell,
.route-ledger-sheet .route-ledger-edit-input,
.customer-billing-sheet .driver-billing-cell,
.customer-billing-sheet .driver-billing-computed-cell,
.customer-billing-sheet .customer-billing-cell {
  background: transparent !important;
}

.ledger-project-preview-sheet tbody .ledger-project-preview-cell,
.ledger-project-preview-sheet tbody .ledger-project-preview-money-input,
.ledger-project-preview-sheet tbody .ledger-project-preview-edited-input {
  background: transparent !important;
}

.ledger-sheet tbody .ledger-input,
.ledger-sheet tbody .route-ledger-edit-input,
.ledger-sheet tbody .driver-billing-edit-input,
.ledger-project-preview-sheet tbody .ledger-project-preview-edit-input {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.ledger-sheet tbody .ledger-input:focus,
.ledger-sheet tbody .route-ledger-edit-input:focus,
.ledger-sheet tbody .driver-billing-edit-input:focus,
.ledger-project-preview-sheet tbody .ledger-project-preview-edit-input:focus {
  background: transparent !important;
  box-shadow: inset 0 -2px 0 rgba(0, 95, 158, 0.45) !important;
}

.customer-billing-table-summary {
  border-color: rgba(0, 95, 158, 0.32);
  background: #e5f2fb;
  color: var(--brand-dark);
}

body.admin-body .ledger-sheet-shell,
body.admin-body .ledger-sheet-scroll,
body.admin-body .customer-billing-sheet-shell {
  border-color: var(--online-table-grid-line) !important;
}

body.admin-body .ledger-sheet {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

body.admin-body .ledger-sheet th,
body.admin-body .ledger-sheet td {
  border: 0 !important;
  border-right: 1px solid var(--online-table-grid-line) !important;
  border-bottom: 1px solid var(--online-table-grid-line) !important;
  background-clip: border-box;
  box-shadow: none !important;
}

body.admin-body .ledger-sheet tr > :first-child {
  border-left: 1px solid var(--online-table-grid-line) !important;
}

body.admin-body .ledger-sheet thead tr:first-child > * {
  border-top: 1px solid var(--online-table-grid-line) !important;
}

body.admin-body .ledger-sheet tbody tr:not(.row-selected):not(.ledger-selected-row):not(.ledger-project-preview-warning-detail):not(.driver-billing-paid-row) > td:not(.ledger-colored-cell):not(.ledger-ops-cell):not(.ledger-row-select-cell):not(.online-billing-fee-cell):not(.driver-billing-computed-td):not(.driver-billing-warning-td):not([style*="background"]) {
  background-color: var(--online-table-row-bg) !important;
}

.customer-billing-group-section > h2,
.customer-billing-group-section h3 {
  color: var(--brand-dark);
}

.driver-login-panel {
  background: #111827;
}

.driver-login-panel .button-row .driver-ios-download-btn {
  border-color: rgba(111, 74, 166, 0.46);
  background: var(--accessible-purple);
  color: #ffffff;
}

.driver-kind-option,
.quick-date-btn,
.calendar-day,
.activity-address-driver-actions .btn,
.my-trips-filters select {
  border-color: var(--line);
}

.calendar-day.selected {
  box-shadow: inset 0 0 0 2px #ffffff;
}

.address-match-status {
  border-left-width: 6px;
}

.address-match-status[data-address-status-type="hint"] {
  border-color: rgba(111, 74, 166, 0.42);
  background: var(--accessible-purple-soft);
  color: #4b247f;
}

input.address-match-ok {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
}

.driver-tab-badge {
  background: var(--accessible-accent);
  color: #111827;
  box-shadow: 0 0 0 2px rgba(230, 159, 0, 0.26);
}

.driver-section-tab.attention:not(.active) {
  border-color: var(--accessible-accent);
  background: var(--accessible-accent-soft);
  color: var(--warn);
}

.driver-returned-reminder .btn {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.ops-manual-hero,
.driver-login-content {
  background: linear-gradient(135deg, #ffffff 0%, #eef4f8 100%);
}

.ops-command-grid code {
  border-color: rgba(0, 95, 158, 0.32);
  background: #f8fafc;
  color: var(--brand-dark);
}

@media (max-width: 860px) {
  .admin-body .topbar .button-row .btn,
  .driver-body .topbar .button-row .btn {
    border-width: 1.5px;
  }

  .row-selected td,
  .ledger-selected-row td {
    box-shadow: inset 5px 0 0 var(--brand);
  }
}

body.admin-body .driver-billing-sheet tbody tr.driver-billing-paid-row > td,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td.online-billing-fee-cell,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td.driver-billing-computed-td,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td.driver-billing-warning-td {
  background: #fff1a6 !important;
  background-color: #fff1a6 !important;
  color: #3f2f00 !important;
}

body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td *,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td .driver-billing-edit-input,
body.admin-body[data-admin-theme] .driver-billing-sheet tbody tr.driver-billing-paid-row > td .driver-billing-payment-select {
  background: transparent !important;
  color: inherit !important;
}
