/* Fourth admin theme: the original single-page layout, rebuilt around the
   current controls and data model. Loaded last so it can safely reshape the
   admin without changing the other three themes. */

.legacy-page-title {
  display: none;
}

#adminChangePasswordBtn[hidden] {
  display: none !important;
}

/* Phase 7 final quick-tool geometry. Keep this at the end so older compact
   overrides cannot collapse the redesigned VIN / Weather / Calendar / Notes /
   Tasks bar. */
body[data-theme="legacy"] #activeQuickTools {
  align-items: stretch;
  gap: 7px;
}

body[data-theme="legacy"] #activeQuickTools .command-card,
body[data-theme="legacy"] #activeQuickTools .weather-compact,
body[data-theme="legacy"] #activeQuickTools .calendar-compact,
body[data-theme="legacy"] #activeQuickTools .note-compact,
body[data-theme="legacy"] #activeQuickTools .task-card {
  min-width: 0;
  min-height: 152px !important;
  height: 152px !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-card {
  width: max-content;
  overflow: visible;
}

body[data-theme="legacy"] #activeQuickTools .vin-card.has-decoded-result {
  height: auto !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-command {
  width: max-content;
  max-width: 100%;
  grid-template-columns: max-content auto 38px;
  gap: 6px;
}

body[data-theme="legacy"] #activeQuickTools #vinInput {
  box-sizing: content-box;
  width: 17ch;
  min-width: 17ch;
  max-width: 17ch;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono",
    monospace;
}

body[data-theme="legacy"] #activeQuickTools .vin-command input,
body[data-theme="legacy"] #activeQuickTools .vin-command button {
  min-height: 38px;
  height: 38px;
}

body[data-theme="legacy"] #activeQuickTools .weather-compact {
  padding: 9px;
}

body[data-theme="legacy"] #activeQuickTools #weatherCompactMount > div,
body[data-theme="legacy"] #activeQuickTools #weatherCompactMount iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: 132px !important;
  min-height: 132px !important;
  overflow: hidden !important;
  transform: none !important;
}

body[data-theme="legacy"] #activeQuickTools .note-compact {
  align-items: stretch;
  justify-content: stretch;
  padding: 10px;
  overflow: hidden;
}

body[data-theme="legacy"] #activeQuickTools #activeNotePreview {
  width: 100%;
  height: 100%;
  display: block;
  padding-right: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.36;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-line-clamp: unset;
  scrollbar-width: thin;
}

body[data-theme="legacy"] #activeQuickTools .task-card {
  padding: 9px;
  overflow: hidden;
  container-type: inline-size;
}

body[data-theme="legacy"] #activeQuickTools #taskPreviewList {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body[data-theme="legacy"] #activeQuickTools .task-preview-row {
  min-height: 0;
  height: auto;
}

body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn {
  padding: 5px 7px;
}

body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn strong {
  font-size: 12px;
  line-height: 1.12;
}

body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn small {
  display: block;
  font-size: 10px;
  line-height: 1.1;
}

body[data-theme="legacy"] #activeQuickTools .task-preview-complete-btn {
  width: 30px;
  min-width: 30px;
}

/* Keep one desktop composition across normal browser zoom levels. Individual
   widgets adapt to their own rendered width below instead of switching the
   whole bar at an arbitrary viewport breakpoint. */
@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns:
      max-content
      minmax(165px, 0.58fr)
      minmax(250px, 0.9fr)
      minmax(130px, 0.48fr)
      minmax(300px, 1.2fr);
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns: 320px minmax(220px, 0.8fr) minmax(285px, 1fr);
  }

  body[data-theme="legacy"] #activeQuickTools .note-compact {
    grid-column: 1;
  }

  body[data-theme="legacy"] #activeQuickTools .task-card {
    grid-column: 2 / -1 !important;
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns: minmax(330px, 0.9fr) minmax(280px, 1.1fr);
  }

  body[data-theme="legacy"] #activeQuickTools .task-card {
    grid-column: 1 / -1 !important;
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns: 1fr;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-card,
  body[data-theme="legacy"] #activeQuickTools .task-card {
    width: 100%;
    grid-column: auto !important;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-command {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto 40px;
  }

  body[data-theme="legacy"] #activeQuickTools #vinInput {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  body[data-theme="legacy"] #activeQuickTools .command-card,
  body[data-theme="legacy"] #activeQuickTools .weather-compact,
  body[data-theme="legacy"] #activeQuickTools .calendar-compact,
  body[data-theme="legacy"] #activeQuickTools .note-compact,
  body[data-theme="legacy"] #activeQuickTools .task-card {
    min-height: 156px !important;
    height: 156px !important;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-card {
    min-height: 104px !important;
    height: auto !important;
  }

  body[data-theme="legacy"] #activeQuickTools #taskPreviewList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
}

.legacy-nav-slot {
  display: none;
}

body[data-theme="legacy"] {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #0b1220;
  --panel-3: #182235;
  --ink: #e5e7eb;
  --muted: #9ca3af;
  --muted-2: #748197;
  --line: #263348;
  --dark: #0b1220;
  --dark-2: #0f172a;
  --dark-3: #1f2937;
  --red: #ef4444;
  --red-dark: #dc2626;
  --yellow: #facc15;
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.14);
  --purple: #a78bfa;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  color: var(--ink);
  color-scheme: dark;
  background:
    radial-gradient(circle at 50% -18%, rgba(96, 165, 250, 0.1), transparent 32%),
    var(--bg);
}

body[data-theme="legacy"] input,
body[data-theme="legacy"] select,
body[data-theme="legacy"] textarea {
  background: #0b1220;
  color: var(--ink);
  border-color: #374151;
}

body[data-theme="legacy"] input::placeholder,
body[data-theme="legacy"] textarea::placeholder {
  color: #748197;
}

body[data-theme="legacy"] input:focus,
body[data-theme="legacy"] select:focus,
body[data-theme="legacy"] textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

body[data-theme="legacy"] .notes-modal-body,
body[data-theme="legacy"] .tasks-modal-body {
  background: var(--panel);
}

body[data-theme="legacy"] .note-editor-card,
body[data-theme="legacy"] .notes-list-panel,
body[data-theme="legacy"] .task-editor-card,
body[data-theme="legacy"] .tasks-list-panel {
  background: #151c2d;
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.16);
}

body[data-theme="legacy"] #sn-text,
body[data-theme="legacy"] .note-list-row,
body[data-theme="legacy"] .task-list-row,
body[data-theme="legacy"] .task-preview-row {
  background: #0e1422;
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.14);
}

/* Keep the dark Original-layout task surface without flattening the urgency
   accent that tells Leon what needs attention at a glance. */
body[data-theme="legacy"] .task-list-row.safe,
body[data-theme="legacy"] .task-preview-row.safe {
  border-left-color: #22c55e;
}

body[data-theme="legacy"] .task-list-row.warning,
body[data-theme="legacy"] .task-preview-row.warning {
  border-left-color: #f59e0b;
}

body[data-theme="legacy"] .task-list-row.urgent,
body[data-theme="legacy"] .task-preview-row.urgent {
  border-left-color: #ef4444;
}

body[data-theme="legacy"] .task-list-row.pinned,
body[data-theme="legacy"] .task-preview-row.pinned {
  border-left-color: #3b82f6;
}

body[data-theme="legacy"] .task-list-row.completed {
  border-left-color: #6b7280;
}

body[data-theme="legacy"] .note-list-row {
  border-left-color: var(--blue);
}

body[data-theme="legacy"] .note-list-row.active {
  background: #111b31;
  border-left-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.2);
}

body[data-theme="legacy"] .note-select-btn,
body[data-theme="legacy"] .note-select-btn span,
body[data-theme="legacy"] .task-row-main strong,
body[data-theme="legacy"] .task-preview-open-btn strong {
  color: var(--ink);
}

body[data-theme="legacy"] .note-select-btn small,
body[data-theme="legacy"] .task-row-main small,
body[data-theme="legacy"] .task-preview-open-btn small {
  color: var(--muted);
}

body[data-theme="legacy"] .note-delete-btn,
body[data-theme="legacy"] .task-pin-btn,
body[data-theme="legacy"] .task-toggle-btn,
body[data-theme="legacy"] .task-delete-btn {
  color: var(--ink);
  border-color: var(--line);
}

body[data-theme="legacy"] .card,
body[data-theme="legacy"] .summary-panel,
body[data-theme="legacy"] .command-card,
body[data-theme="legacy"] .sale-modal,
body[data-theme="legacy"] .review-manager-modal,
body[data-theme="legacy"] .payment-customer-modal,
body[data-theme="legacy"] .notes-modal,
body[data-theme="legacy"] .tasks-modal {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

body[data-theme="legacy"] .primary {
  color: #06130b;
  background: var(--green);
  border-color: var(--green);
}

body[data-theme="legacy"] .primary:hover {
  color: #06130b;
  background: #4ade80;
  border-color: #4ade80;
  box-shadow: 0 8px 18px rgba(34, 197, 94, 0.2);
}

body[data-theme="legacy"] .secondary,
body[data-theme="legacy"] .toolbar-icon-btn.secondary {
  color: var(--ink);
  background: #1f2937;
  border-color: #374151;
}

body[data-theme="legacy"] .secondary:hover,
body[data-theme="legacy"] .toolbar-icon-btn.secondary:hover {
  color: #ffffff;
  background: #273449;
  border-color: var(--blue);
}

body[data-theme="legacy"] .admin-topbar .monthly-report-trigger.active {
  color: #facc15 !important;
  background: #1f2937 !important;
  border-color: #facc15 !important;
  font-weight: 950 !important;
  box-shadow: inset 0 -3px 0 #facc15 !important;
}

.theme-dot-legacy {
  background: linear-gradient(135deg, #0f172a 0 48%, #60a5fa 48% 68%, #22c55e 68% 84%, #facc15 84%);
}

body[data-theme="legacy"] .topbar-theme-dropdown,
body[data-theme="legacy"] .topbar-backup-dropdown {
  color: var(--ink);
  background: var(--panel);
  border-color: var(--line);
}

body[data-theme="legacy"] .theme-menu-btn,
body[data-theme="legacy"] .backup-menu-btn {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
}

body[data-theme="legacy"] .theme-menu-btn:hover,
body[data-theme="legacy"] .backup-menu-btn:hover,
body[data-theme="legacy"] .theme-menu-btn.is-active {
  background: var(--panel-3);
  border-color: var(--blue);
}

body[data-theme="legacy"] .theme-menu-btn.is-active {
  box-shadow: inset 4px 0 0 var(--green);
}

@media all {
  body[data-theme="legacy"] .admin-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    overflow: visible;
  }

  body[data-theme="legacy"] .admin-sidebar,
  body[data-theme="legacy"] .admin-content {
    display: contents;
  }

  body[data-theme="legacy"] .legacy-page-title {
    order: 1;
    min-height: 122px;
    display: grid;
    place-content: center;
    padding: 5px 20px;
    text-align: center;
    background: #0f172a;
  }

  body[data-theme="legacy"] .legacy-brand-logo {
    width: clamp(230px, 15vw, 300px);
    max-height: 112px;
    display: block;
    object-fit: contain;
    mix-blend-mode: lighten;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  }

  body[data-theme="legacy"] .sidebar-brand {
    display: none;
  }

  body[data-theme="legacy"] #activeDocumentsBar {
    order: 2;
    min-width: 0;
    background: #111827;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  body[data-theme="legacy"] .document-bar {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 24px 10px;
    background: #111827;
  }

  body[data-theme="legacy"] .doc-link {
    min-width: 0;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--muted);
    background: transparent;
    font-size: 9px;
    line-height: 1;
  }

  body[data-theme="legacy"] .doc-link img {
    width: clamp(60px, 4.5vw, 82px);
    height: clamp(60px, 4.5vw, 82px);
    object-fit: contain;
    background: transparent;
  }

  body[data-theme="legacy"] .doc-link span {
    display: none;
  }

  body[data-theme="legacy"] .doc-link:hover {
    color: #ffffff;
    background: transparent;
    transform: translateY(-2px) scale(1.04);
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  }

  body[data-theme="legacy"] .admin-topbar {
    order: 3;
    min-width: 0;
    min-height: 48px;
    justify-content: center;
    gap: 8px;
    padding: 5px 18px;
    overflow: visible;
    background: linear-gradient(90deg, #111827, #0f172a);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  body[data-theme="legacy"] .topbar-left,
  body[data-theme="legacy"] .mobile-admin-menu {
    display: none;
  }

  body[data-theme="legacy"] .header-right {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-theme="legacy"] .admin-topbar .theme-trigger,
  body[data-theme="legacy"] .admin-topbar .backup-trigger,
  body[data-theme="legacy"] .admin-topbar .logout-btn,
  body[data-theme="legacy"] .admin-topbar .topbar-btn,
  body[data-theme="legacy"] .admin-topbar .topbar-clock {
    min-width: 0;
    min-height: 36px !important;
    height: 36px;
    padding: 0 11px !important;
    border: 1px solid #374151 !important;
    border-radius: 7px !important;
    color: var(--ink) !important;
    background: #1f2937 !important;
    box-shadow: none !important;
    font-size: 12px;
  }

  body[data-theme="legacy"] .admin-topbar .theme-trigger:hover,
  body[data-theme="legacy"] .admin-topbar .backup-trigger:hover,
  body[data-theme="legacy"] .admin-topbar .logout-btn:hover,
  body[data-theme="legacy"] .admin-topbar .topbar-btn:hover {
    color: #ffffff !important;
    border-color: var(--blue) !important;
    background: #273449 !important;
  }

  body[data-theme="legacy"] .admin-topbar .logout-btn {
    border-color: rgba(239, 68, 68, 0.55) !important;
  }

  body[data-theme="legacy"] .legacy-nav-slot {
    display: block;
    min-width: 0;
    margin: -2px 0 9px;
  }

  body[data-theme="legacy"] .legacy-nav-slot .nav-collapse {
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }

  body[data-theme="legacy"] .legacy-nav-slot .nav-collapse > summary {
    display: none;
  }

  body[data-theme="legacy"] .sidebar-nav {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
  }

  body[data-theme="legacy"] .sidebar-tab {
    width: auto;
    min-width: 0;
    min-height: 28px;
    display: inline-flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid #1f2937;
    border-radius: 6px;
    color: #e5e7eb;
    background: #0b1220;
    font-size: 12px;
    font-weight: 650;
    box-shadow: none;
  }

  body[data-theme="legacy"] .sidebar-tab:hover {
    color: #ffffff;
    background: #172033;
    border-color: var(--blue);
    transform: none;
  }

  body[data-theme="legacy"] .sidebar-tab.active {
    color: #0b1220;
    background: #60a5fa;
    border-color: #60a5fa;
    font-weight: 950 !important;
    box-shadow: none;
  }

  body[data-theme="legacy"] #tabActiveBtn.active {
    color: #e5e7eb;
    background: #064e3b;
    border-color: #052e24;
  }

  body[data-theme="legacy"] #tabSoldBtn.active {
    color: #e5e7eb;
    background: #7c2d12;
    border-color: #6b210d;
  }

  body[data-theme="legacy"] #tabBusinessExpensesBtn.state-green {
    color: #0b1220;
    background: #16a34a;
    border-color: #14532d;
  }

  body[data-theme="legacy"] #tabBusinessExpensesBtn.state-yellow {
    color: #1f1300;
    background: #f59e0b;
    border-color: #b45309;
  }

  body[data-theme="legacy"] #tabBusinessExpensesBtn.state-red {
    color: #220000;
    background: #ef4444;
    border-color: #b91c1c;
  }

  body[data-theme="legacy"] .sidebar-tab.active .count-badge,
  body[data-theme="legacy"] .sidebar-tab.active .count-badge-orange {
    color: currentColor;
    background: rgba(0, 0, 0, 0.18);
    border-color: currentColor;
  }

  body[data-theme="legacy"] #tabActiveBtn.active .count-badge {
    color: #34d399;
    background: #0b1220;
    border-color: #16a34a;
  }

  body[data-theme="legacy"] #tabSoldBtn.active .count-badge-orange {
    color: #fbbf24;
    background: #0b1220;
    border-color: #f59e0b;
  }

  body[data-theme="legacy"] #tabBusinessExpensesBtn .biz-label {
    color: #ffffff;
  }

  body[data-theme="legacy"] main {
    order: 4;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 18px 16px;
    overflow: visible;
  }

  body[data-theme="legacy"] .command-strip {
    grid-template-columns:
      max-content
      clamp(280px, 16vw, 330px)
      clamp(280px, 16vw, 340px)
      minmax(360px, 1fr);
    gap: 8px;
  }

  body[data-theme="legacy"] .command-card {
    min-height: 64px;
    padding: 9px 11px;
    border-radius: 9px;
    background: #111827;
  }

  body[data-theme="legacy"] .vin-card label {
    margin-bottom: 4px;
    color: var(--green);
  }

  body[data-theme="legacy"] .vin-command {
    width: max-content;
    max-width: 100%;
    grid-template-columns: max-content auto 36px;
  }

  body[data-theme="legacy"] #vinInput {
    width: calc(17ch + 22px) !important;
    min-width: calc(17ch + 22px) !important;
    max-width: calc(17ch + 22px) !important;
    box-sizing: border-box;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0;
  }

  body[data-theme="legacy"] .inventory-card {
    min-height: 0;
    padding: 12px;
    border-radius: 12px;
    background: #111827;
  }

  body[data-theme="legacy"] .inventory-header {
    min-height: 48px;
    align-items: center !important;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom-color: var(--line);
  }

  body[data-theme="legacy"] .inventory-header h2 {
    color: #fed7aa;
    font-size: 20px;
  }

  body[data-theme="legacy"][data-admin-section="vehicleExpenses"] .inventory-header h2,
  body[data-theme="legacy"][data-admin-section="businessExpenses"] .inventory-header h2,
  body[data-theme="legacy"][data-admin-section="otherExpenses"] .inventory-header h2,
  body[data-theme="legacy"][data-admin-section="totalExpenses"] .inventory-header h2,
  body[data-theme="legacy"][data-admin-section="itemizedProfits"] .inventory-header h2,
  body[data-theme="legacy"][data-admin-section="totalProfits"] .inventory-header h2 {
    color: #ffff00;
  }

  body[data-theme="legacy"] .inventory-header p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
  }

  body[data-theme="legacy"] .section-toolbar.is-active,
  body[data-theme="legacy"] .section-toolbar-inventory.is-active,
  body[data-theme="legacy"] .section-toolbar-profit.is-active,
  body[data-theme="legacy"] .section-toolbar-payments.is-active {
    grid-template-columns: minmax(280px, 430px) repeat(3, auto) !important;
  }

  body[data-theme="legacy"] .section-toolbar-profit.is-active {
    grid-template-columns: minmax(280px, 430px) repeat(2, auto) !important;
  }

  body[data-theme="legacy"] .section-toolbar-monthly.is-active {
    grid-template-columns: repeat(2, auto) !important;
  }

  body[data-theme="legacy"] .section-toolbar input,
  body[data-theme="legacy"] #inventorySearch {
    min-height: 34px;
    border-radius: 7px;
  }

  body[data-theme="legacy"] .section-toolbar .toolbar-icon-btn {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    font-size: 15px;
  }

  body[data-theme="legacy"] #customerViewToggleBtn {
    color: var(--muted);
    background: #1f2937;
    border-color: var(--line);
  }

  body[data-theme="legacy"] #customerViewToggleBtn[aria-pressed="true"] {
    color: #111827;
    background: #facc15;
    border-color: #fde047;
  }

  body[data-theme="legacy"] .section-toolbar .toolbar-icon-btn i {
    font-size: 20px;
  }

  body[data-theme="legacy"] .topbar-btn[hidden] {
    display: none !important;
  }

  body[data-theme="legacy"] #activeContainer,
  body[data-theme="legacy"] #soldContainer,
  body[data-theme="legacy"] .summary-panel {
    min-height: 0;
    background: #0b1220;
    border-color: var(--line);
    border-radius: 8px;
  }

  body[data-theme="legacy"] .table-scroll {
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
    scrollbar-color: #374151 #0b1220;
  }

  body[data-theme="legacy"] #activeContainer > .table-scroll,
  body[data-theme="legacy"] #soldContainer > .table-scroll {
    box-sizing: border-box;
    padding-right: 18px !important;
    overflow-x: hidden !important;
  }

  body[data-theme="legacy"] .inventory-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: auto;
    border-collapse: collapse;
    border-spacing: 0;
    /*
     * Let the entire table scale with browser zoom. The previous viewport
     * formula counteracted zoom for text while the action buttons continued
     * growing, which made the controls look oversized beside tiny values.
     */
    /*
     * Keep the whole row proportional when browser zoom reduces the CSS
     * viewport. Values, inputs, and action buttons now contract together,
     * instead of the fixed-pixel buttons outgrowing the table.
     */
    font-size: clamp(5px, 1.08vw, 18px);
  }

  body[data-theme="legacy"] .inventory-table colgroup {
    display: none;
  }

  body[data-theme="legacy"] .inventory-table thead,
  body[data-theme="legacy"] .inventory-table tbody {
    display: block;
    width: 100%;
  }

  body[data-theme="legacy"] .inventory-table thead tr,
  body[data-theme="legacy"] .inventory-table tbody tr.data-row {
    width: 100%;
    display: grid;
    grid-template-columns:
      3.2em
      7.2em
      8.6em
      4.2em
      4.2em
      5.1em
      5.2em
      2.8em
      7em
      9.8em
      3.4em
      minmax(170px, 6.4em);
    column-gap: clamp(4px, 0.25em, 8px);
    justify-content: space-between;
    align-items: stretch;
  }

  body[data-theme="legacy"] .inventory-table tbody tr.expenses-row,
  body[data-theme="legacy"] .inventory-table tbody tr.sale-row,
  body[data-theme="legacy"] .inventory-table tbody tr.expenses-row > td,
  body[data-theme="legacy"] .inventory-table tbody tr.sale-row > td {
    width: 100%;
  }

  body[data-theme="legacy"] .inventory-table tbody tr.expenses-row > td,
  body[data-theme="legacy"] .inventory-table tbody tr.sale-row > td {
    min-height: 0;
    display: block;
    padding: 0;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: clamp(12px, 1.45vw, 32px);
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact thead tr,
  body[data-theme="legacy"] #inventoryTableActive.cv-compact tbody tr.data-row {
    grid-template-columns:
      3.8em
      6em
      10em
      4.6em
      4.4em
      7.2em
      10em
      minmax(140px, 7.5em);
    column-gap: 0;
    justify-content: space-between;
  }

  body[data-theme="legacy"] .inventory-table thead th {
    min-width: 0;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px;
    overflow: hidden;
    color: #e5e7eb;
    background: #0b1220;
    border-bottom: 1px solid #1f2937;
    font-size: 0.74em;
    letter-spacing: 0.35px;
    line-height: 1.05;
    text-overflow: clip;
    white-space: normal !important;
    overflow-wrap: normal;
    word-break: keep-all;
  }

  body[data-theme="legacy"] .inventory-table tbody td {
    min-width: 0;
    min-height: clamp(60px, 3.4em, 84px);
    display: flex;
    align-items: center;
    padding: 9px 6px;
    overflow: hidden;
    color: var(--ink);
    background: #0b1220;
    border-right: 0;
    border-bottom: 1px solid #1f2937;
    line-height: 1.2;
    text-overflow: ellipsis;
  }

  body[data-theme="legacy"] .inventory-table tbody tr.data-row {
    background: #0b1220;
  }

  body[data-theme="legacy"] .inventory-table tbody tr.data-row > td {
    background: transparent !important;
  }

  body[data-theme="legacy"] .inventory-table tbody tr.data-row:hover {
    background: #101c2f;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row.selected {
    background: rgba(16, 185, 129, 0.16);
    box-shadow: inset 4px 0 0 #34d399;
  }

  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row.selected {
    background: rgba(245, 158, 11, 0.16);
    box-shadow: inset 4px 0 0 #f59e0b;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(9),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(11),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(9),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(11) {
    padding-right: 2px;
    padding-left: 2px;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(11),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(9),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(11) {
    justify-content: center;
    text-align: center !important;
  }

  body[data-theme="legacy"] .inventory-table tbody tr:hover td {
    background: transparent;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(3),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(3),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(3),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(3) {
    justify-content: center;
    text-align: center !important;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(3) > *,
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(3) > * {
    justify-content: center !important;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(3),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(3) {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
  }

  body[data-theme="legacy"] #inventoryTableActive .model-text,
  body[data-theme="legacy"] #inventoryTableSold .model-text {
    width: 100%;
    display: block;
    overflow: visible;
    line-height: 1.08;
    overflow-wrap: normal;
    text-align: center;
    text-overflow: clip;
    white-space: normal;
    word-break: normal;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10) {
    justify-content: center;
    text-align: center !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(1),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(2),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(1),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(1),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(2),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(1),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(4),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(5),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(6),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(7),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(4),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(5),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(6),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(7),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(4),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(5),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(6),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(7),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(4),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(5),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(6),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(7),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(9) {
    justify-content: center;
    text-align: center !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(1),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(2),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(3),
  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(1),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(3),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10) {
    color: #34d399 !important;
  }

  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(1),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(2),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(3),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(1),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(2),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(3) {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(5),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(5),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(5),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(5),
  body[data-theme="legacy"] #inventoryTableActive .asking-input,
  body[data-theme="legacy"] #inventoryTableSold .asking-input {
    color: #a78bfa !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(7),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(7),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(7),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(7) {
    color: #991b1b !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(6)::first-letter,
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(6)::first-letter {
    color: wheat !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(8) {
    color: wheat !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(12),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(12) {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(11) {
    color: #facc15 !important;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8) * {
    color: #cbd5e1 !important;
  }

  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8) * {
    color: wheat !important;
  }

  body[data-theme="legacy"] .inventory-table .profit-cell {
    font-weight: 800;
  }

  body[data-theme="legacy"] .inventory-table .profit-cell.profit-positive,
  body[data-theme="legacy"] .inventory-table .profit-cell.profit-positive [data-amount] {
    color: #22c55e !important;
  }

  body[data-theme="legacy"] .inventory-table .profit-cell.profit-negative,
  body[data-theme="legacy"] .inventory-table .profit-cell.profit-negative [data-amount] {
    color: #ef4444 !important;
  }

  body[data-theme="legacy"] .inventory-table .profit-cell.profit-zero,
  body[data-theme="legacy"] .inventory-table .profit-cell.profit-zero [data-amount] {
    color: #cbd5e1 !important;
  }

  body[data-theme="legacy"] .inventory-table input,
  body[data-theme="legacy"] .inventory-table select {
    min-width: 0;
    min-height: 38px;
    box-sizing: border-box;
    padding: 3px 4px;
    border-radius: 5px;
    font-size: inherit;
    font-variant-numeric: tabular-nums;
    background: transparent;
    border-color: #273449;
  }

  body[data-theme="legacy"] #inventoryTableActive .miles,
  body[data-theme="legacy"] #inventoryTableSold .miles {
    display: block;
    width: calc(6ch + 10px) !important;
    min-width: calc(6ch + 10px) !important;
    max-width: calc(6ch + 10px) !important;
    padding-right: 3px;
    padding-left: 3px;
    margin: 0 auto;
    text-align: center;
  }

  body[data-theme="legacy"] #inventoryTableActive .asking-input,
  body[data-theme="legacy"] #inventoryTableSold .asking-input {
    display: block;
    width: calc(6ch + 10px) !important;
    min-width: calc(6ch + 10px) !important;
    max-width: calc(6ch + 10px) !important;
    padding-right: 3px;
    padding-left: 3px;
    margin: 0 auto;
    text-align: center;
  }

  body[data-theme="legacy"] #inventoryTableActive .purchase-input,
  body[data-theme="legacy"] #inventoryTableSold .purchase-input {
    display: block;
    width: calc(6ch + 10px) !important;
    min-width: calc(6ch + 10px) !important;
    max-width: calc(6ch + 10px) !important;
    padding-right: 3px;
    padding-left: 3px;
    margin: 0 auto;
    text-align: center;
  }

  body[data-theme="legacy"] #inventoryTableActive .date-input,
  body[data-theme="legacy"] #inventoryTableSold .date-input {
    width: calc(10ch + 28px) !important;
    min-width: calc(10ch + 28px) !important;
    max-width: calc(10ch + 28px) !important;
    padding-right: 2px;
    padding-left: 3px;
    margin: 0;
  }

  body[data-theme="legacy"] #inventoryTableActive .vin-cell,
  body[data-theme="legacy"] #inventoryTableSold .vin-cell {
    max-width: none;
    letter-spacing: 0;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.92em;
    font-variant-numeric: tabular-nums;
  }

  body[data-theme="legacy"] .inventory-table .miles,
  body[data-theme="legacy"] .inventory-table .purchase-input,
  body[data-theme="legacy"] .inventory-table .date-input,
  body[data-theme="legacy"] .inventory-table .purchase-date {
    color: #e5e7eb !important;
  }

  body[data-theme="legacy"] #inventoryTableActive .purchase-input {
    color: #cbd5e1 !important;
  }

  body[data-theme="legacy"] #inventoryTableActive .mark-sold-btn {
    color: #f59e0b;
    border-color: #92400e;
  }

  body[data-theme="legacy"] #inventoryTableActive .expense-pill-btn,
  body[data-theme="legacy"] #inventoryTableSold .expense-pill-btn {
    width: calc(6ch + 10px) !important;
    min-width: calc(6ch + 10px) !important;
    max-width: calc(6ch + 10px) !important;
    color: #b91c1c !important;
    background: transparent !important;
    border-color: #7f1d1d !important;
    font-size: inherit;
  }

  body[data-theme="legacy"] .inventory-table button {
    min-width: 28px;
    min-height: 28px;
    padding: 4px 6px;
    border-radius: 6px;
  }

  body[data-theme="legacy"] #inventoryTableActive .inventory-actions,
  body[data-theme="legacy"] #inventoryTableSold .inventory-actions {
    width: max-content;
    gap: 0.2em !important;
    justify-content: flex-end !important;
    margin-right: 0.2em;
    margin-left: auto;
  }

  body[data-theme="legacy"] #inventoryTableActive th.actions-header,
  body[data-theme="legacy"] #inventoryTableSold th.actions-header {
    padding-right: 0 !important;
    padding-left: 0 !important;
    text-align: center !important;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(12),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(12) {
    padding-right: 0.35em;
    padding-left: 0.15em;
    text-align: center !important;
  }

  body[data-theme="legacy"] .monthly-report-table-wrap {
    box-sizing: border-box;
    overflow-x: hidden;
    scrollbar-gutter: auto;
  }

  body[data-theme="legacy"] .monthly-report-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
    font-size: clamp(14px, 0.9vw, 18px);
  }

  body[data-theme="legacy"] .monthly-report-table th {
    box-sizing: border-box;
    padding: 10px 5px;
    font-size: 0.78em;
    line-height: 1.15;
    overflow-wrap: normal;
    word-break: normal;
  }

  body[data-theme="legacy"] .monthly-report-table td {
    box-sizing: border-box;
    padding: 11px 5px;
    font-size: 0.92em;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-break: normal;
  }

  body[data-theme="legacy"] .monthly-report-table td:nth-child(4) {
    font-size: 0.78em;
    overflow-wrap: anywhere;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(1),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(1) {
    width: 5%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(2),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(2),
  body[data-theme="legacy"] .monthly-report-table th:nth-child(3),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(3),
  body[data-theme="legacy"] .monthly-report-table th:nth-child(5),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(5) {
    width: 8.5%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(4),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(4) {
    width: 11%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(6),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(6),
  body[data-theme="legacy"] .monthly-report-table th:nth-child(7),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(7) {
    width: 8%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(8),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(8) {
    width: 11.5%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(9),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(9) {
    width: 13%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(10),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(10) {
    width: 9%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(11),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(11) {
    width: 4%;
  }

  body[data-theme="legacy"] .monthly-report-table th:nth-child(12),
  body[data-theme="legacy"] .monthly-report-table td:nth-child(12) {
    width: 5%;
  }

  body[data-theme="legacy"] #inventoryTableActive .inventory-actions button,
  body[data-theme="legacy"] #inventoryTableSold .inventory-actions button {
    width: 2.6em !important;
    min-width: 2.6em !important;
    height: 2.6em !important;
    min-height: 2.6em !important;
    padding: 0 !important;
    font-size: 1em;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(1) {
    width: 6% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(2) {
    width: 9% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(3) {
    width: 13% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(4),
  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(5) {
    width: 11% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(9) {
    width: 15% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(10) {
    width: 22% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact col:nth-child(12) {
    width: 13% !important;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact .inventory-actions {
    display: flex !important;
    width: max-content;
    justify-content: flex-end !important;
    margin-right: 12px;
    margin-left: auto;
  }

  body[data-theme="legacy"] #inventoryTableActive.cv-compact th.actions-header {
    justify-content: flex-end;
    padding-right: 48px !important;
    text-align: right !important;
  }

  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(4) input,
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(5) input,
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(6) input,
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(4) input,
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(5) input,
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(6) input,
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(11),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
  body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(11) {
    font-variant-numeric: tabular-nums;
  }

  body[data-theme="legacy"] .summary-panel {
    padding: 12px;
  }

  body[data-theme="legacy"] .summary-panel > .actions {
    padding-bottom: 9px;
    margin-bottom: 8px;
  }

  body[data-theme="legacy"] #vehExpList,
  body[data-theme="legacy"] #bizExpList,
  body[data-theme="legacy"] #othExpList,
  body[data-theme="legacy"] #totExpList,
  body[data-theme="legacy"] #itmProfList,
  body[data-theme="legacy"] #totProfList {
    margin-top: 8px;
    background: #0b1220 !important;
    border-color: var(--line) !important;
    border-radius: 7px;
  }

  body[data-theme="legacy"] .veh-exp-stats > div,
  body[data-theme="legacy"] .biz-exp-stats > div,
  body[data-theme="legacy"] .oth-exp-stats > div,
  body[data-theme="legacy"] .tot-exp-stats > div,
  body[data-theme="legacy"] .itm-prof-stats > div,
  body[data-theme="legacy"] .tot-prof-stats > div,
  body[data-theme="legacy"] .monthly-report-stats > div {
    min-height: 64px;
    color: var(--ink);
    background: #111827;
    border-color: var(--line);
    border-radius: 8px;
  }

  body[data-theme="legacy"] .monthly-report-table-wrap,
  body[data-theme="legacy"] .section-table-shell {
    background: #0b1220 !important;
    border-color: var(--line) !important;
  }

  body[data-theme="legacy"] .monthly-report-table th,
  body[data-theme="legacy"] .section-table-shell th {
    color: #e5e7eb !important;
    background: #050814 !important;
    border-bottom-color: #facc15 !important;
  }

  /* The consolidated ledgers were designed with hard-coded white rows. The
     original-layout theme keeps the current structure but restores the old
     panel's navy surfaces all the way through expanded detail rows. */
  body[data-theme="legacy"] .veh-exp-ledger,
  body[data-theme="legacy"] .biz-exp-ledger,
  body[data-theme="legacy"] .oth-exp-ledger,
  body[data-theme="legacy"] .tot-exp-ledger,
  body[data-theme="legacy"] .itm-prof-ledger,
  body[data-theme="legacy"] .tot-prof-ledger,
  body[data-theme="legacy"] .tot-prof-grouped,
  body[data-theme="legacy"] .tot-exp-month-ledger {
    color: #e5e7eb;
    background: #0b1220 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] .veh-exp-head,
  body[data-theme="legacy"] .biz-exp-head,
  body[data-theme="legacy"] .oth-exp-head,
  body[data-theme="legacy"] .tot-exp-head,
  body[data-theme="legacy"] .itm-prof-head,
  body[data-theme="legacy"] .tot-prof-head,
  body[data-theme="legacy"] .tot-prof-subhead {
    color: #e5e7eb !important;
    background: #050814 !important;
    border-color: #263348 !important;
    border-bottom-color: #facc15 !important;
  }

  body[data-theme="legacy"] .veh-exp-row,
  body[data-theme="legacy"] .biz-exp-row,
  body[data-theme="legacy"] .oth-exp-row,
  body[data-theme="legacy"] .tot-exp-row,
  body[data-theme="legacy"] .itm-prof-row,
  body[data-theme="legacy"] .tot-prof-row,
  body[data-theme="legacy"] .tot-prof-subrow,
  body[data-theme="legacy"] .tot-exp-month,
  body[data-theme="legacy"] .tot-exp-month-item {
    color: #e5e7eb !important;
    background: #111827 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] .veh-exp-row summary,
  body[data-theme="legacy"] .tot-exp-row summary,
  body[data-theme="legacy"] .itm-prof-row summary,
  body[data-theme="legacy"] .tot-prof-row summary {
    color: #e5e7eb !important;
    background: #111827 !important;
  }

  body[data-theme="legacy"] .veh-exp-row summary:hover,
  body[data-theme="legacy"] .biz-exp-row:hover,
  body[data-theme="legacy"] .oth-exp-row:hover,
  body[data-theme="legacy"] .tot-exp-row summary:hover,
  body[data-theme="legacy"] .itm-prof-row summary:hover,
  body[data-theme="legacy"] .tot-prof-row summary:hover,
  body[data-theme="legacy"] .tot-exp-month summary:hover {
    background: #18233a !important;
  }

  body[data-theme="legacy"] .veh-exp-detail,
  body[data-theme="legacy"] .tot-exp-detail,
  body[data-theme="legacy"] .itm-prof-detail,
  body[data-theme="legacy"] .tot-prof-detail,
  body[data-theme="legacy"] .tot-exp-month-items,
  body[data-theme="legacy"] .inventory-search-context,
  body[data-theme="legacy"] .sale-search-context,
  body[data-theme="legacy"] .profit-search-context {
    color: #9ca3af !important;
    background: #0b1220 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] .veh-exp-detail-item {
    color: #e5e7eb !important;
    background: #111827 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] .veh-exp-vehicle,
  body[data-theme="legacy"] .itm-prof-vehicle,
  body[data-theme="legacy"] .tot-prof-vehicle,
  body[data-theme="legacy"] .tot-exp-company,
  body[data-theme="legacy"] .veh-exp-detail-item strong,
  body[data-theme="legacy"] .itm-prof-detail strong,
  body[data-theme="legacy"] .inventory-search-context strong,
  body[data-theme="legacy"] .sale-search-context strong,
  body[data-theme="legacy"] .profit-search-context strong,
  body[data-theme="legacy"] .inventory-search-context b,
  body[data-theme="legacy"] .sale-search-context b,
  body[data-theme="legacy"] .profit-search-context b,
  body[data-theme="legacy"] .tot-prof-subrow span:nth-child(2) {
    color: #e5e7eb !important;
  }

  body[data-theme="legacy"] .veh-exp-date,
  body[data-theme="legacy"] .veh-exp-buyer,
  body[data-theme="legacy"] .veh-exp-count,
  body[data-theme="legacy"] .veh-exp-detail-item span,
  body[data-theme="legacy"] .itm-prof-date,
  body[data-theme="legacy"] .itm-prof-buyer,
  body[data-theme="legacy"] .tot-exp-month summary small {
    color: #9ca3af !important;
  }

  body[data-theme="legacy"] .veh-exp-status.active {
    color: #34d399 !important;
    background: rgba(52, 211, 153, 0.12) !important;
    border-color: rgba(52, 211, 153, 0.28) !important;
  }

  body[data-theme="legacy"] .veh-exp-status.sold {
    color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
  }

  body[data-theme="legacy"] .veh-exp-total,
  body[data-theme="legacy"] .veh-exp-detail-item b,
  body[data-theme="legacy"] #vehExpStats strong.money {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] .veh-exp-row:has(.veh-exp-status.active) .veh-exp-vehicle {
    color: #34d399 !important;
  }

  body[data-theme="legacy"] .veh-exp-row:has(.veh-exp-status.sold) .veh-exp-vehicle {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] .itm-prof-head span:nth-child(2),
  body[data-theme="legacy"] .itm-prof-row summary > span:nth-child(2),
  body[data-theme="legacy"] .tot-prof-subhead span:nth-child(2),
  body[data-theme="legacy"] .tot-prof-subrow > span:nth-child(2) {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] .itm-prof-head span:nth-child(4),
  body[data-theme="legacy"] .itm-prof-row summary > span:nth-child(4),
  body[data-theme="legacy"] .tot-prof-subhead span:nth-child(4),
  body[data-theme="legacy"] .tot-prof-subrow > span:nth-child(4) {
    color: #a78bfa !important;
  }

  body[data-theme="legacy"] .itm-prof-head span:nth-child(5),
  body[data-theme="legacy"] .itm-prof-row summary > span:nth-child(5),
  body[data-theme="legacy"] .tot-prof-subhead span:nth-child(5),
  body[data-theme="legacy"] .tot-prof-subrow > span:nth-child(5) {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] .itm-prof-head span:nth-child(6),
  body[data-theme="legacy"] .tot-prof-subhead span:nth-child(6) {
    color: #991b1b !important;
  }

  body[data-theme="legacy"] .itm-prof-row summary > span:nth-child(6),
  body[data-theme="legacy"] .tot-prof-subrow > span:nth-child(6) {
    color: #ef4444 !important;
  }

  body[data-theme="legacy"] .itm-prof-head span:nth-child(7),
  body[data-theme="legacy"] .itm-prof-row summary > span:nth-child(7),
  body[data-theme="legacy"] .tot-prof-subhead span:nth-child(7),
  body[data-theme="legacy"] .tot-prof-subrow > span:nth-child(7) {
    color: #60a5fa !important;
  }

  body[data-theme="legacy"] .itm-prof-row summary > span.loss,
  body[data-theme="legacy"] .tot-prof-subrow > span.loss {
    color: #ef4444 !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month summary > span:nth-child(2) strong,
  body[data-theme="legacy"] #totExpList .tot-exp-source.vehicle {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month summary > span:nth-child(3) strong,
  body[data-theme="legacy"] #totExpList .tot-exp-source.business {
    color: #60a5fa !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month summary > span:nth-child(4) strong,
  body[data-theme="legacy"] #totExpList .tot-exp-source.personal {
    color: #a78bfa !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month summary > span:nth-child(5) strong {
    color: #22c55e !important;
  }

  body[data-theme="legacy"] #totProfList .tot-prof-month-clean summary > span:nth-child(2) strong {
    color: #a78bfa !important;
  }

  body[data-theme="legacy"] #totProfList .tot-prof-month-clean summary > span:nth-child(3) strong,
  body[data-theme="legacy"] #totProfList .tot-prof-month-clean summary > span:nth-child(4) strong {
    color: #f59e0b !important;
  }

  body[data-theme="legacy"] #totProfList .tot-prof-month-clean summary > span:nth-child(5) strong {
    color: #22c55e !important;
  }

  body[data-theme="legacy"] .biz-exp-row input,
  body[data-theme="legacy"] .biz-exp-row textarea,
  body[data-theme="legacy"] .oth-exp-row input,
  body[data-theme="legacy"] .oth-exp-row textarea {
    color: #e5e7eb !important;
    background: #0b1220 !important;
    border-color: #374151 !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month,
  body[data-theme="legacy"] #totProfList .tot-exp-month {
    color: #e5e7eb !important;
    background: #111827 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month summary,
  body[data-theme="legacy"] #totProfList .tot-exp-month summary,
  body[data-theme="legacy"] #totProfList .tot-prof-month-clean summary {
    color: #e5e7eb !important;
    background: #151c2d !important;
  }

  body[data-theme="legacy"] #totExpList .tot-exp-month[open] summary,
  body[data-theme="legacy"] #totProfList .tot-exp-month[open] summary,
  body[data-theme="legacy"] #totProfList .tot-prof-month-clean[open] summary {
    background: #1a2338 !important;
    border-bottom-color: #263348 !important;
  }

  body[data-theme="legacy"] .tot-exp-month-main strong,
  body[data-theme="legacy"] .tot-prof-month-label {
    color: #ffffff !important;
  }

  body[data-theme="legacy"] .tot-exp-month-item:nth-child(even),
  body[data-theme="legacy"] .tot-prof-subrow:nth-child(even) {
    background: #0d1424 !important;
  }

  body[data-theme="legacy"] .monthly-report-table td {
    color: #cbd5e1 !important;
    background: #111827 !important;
    border-color: #263348 !important;
  }

  body[data-theme="legacy"] .monthly-report-table tbody tr:nth-child(even) td {
    background: #0d1424 !important;
  }

  body[data-theme="legacy"] .monthly-report-table td:nth-child(4) {
    color: #34d399 !important;
  }

  body[data-theme="legacy"] .monthly-report-table tbody tr.is-incomplete td {
    background: #2b1218 !important;
  }

  /* Payments keeps its newer layout; only neutralize the base light-theme
     hover so one row cannot flash white inside the legacy dark palette. */
  body[data-theme="legacy"] .payment-row summary:hover {
    color: #e5e7eb !important;
    background: #18233a !important;
  }
}

body[data-theme="legacy"] mark.kw-hl,
body[data-theme="legacy"] mark.exp-hl {
  padding: 0 0.12em !important;
  border-radius: 0.2em !important;
  outline: 1px solid var(--kw-hl-outline, rgba(0, 0, 0, 0.15)) !important;
  background: var(--kw-hl-bg, #facc15) !important;
  color: var(--kw-hl-fg, #0b1220) !important;
  font-weight: 900;
}

/* Tablet fallback below the stable five-column desktop composition. */
@media not all {
  body[data-theme="legacy"] .legacy-page-title {
    min-height: 62px;
    padding: 3px 12px;
  }

  body[data-theme="legacy"] .legacy-brand-logo {
    width: clamp(168px, 14vw, 205px);
    max-height: 58px;
  }

  body[data-theme="legacy"] #activeDocumentsBar > summary {
    display: none !important;
  }

  body[data-theme="legacy"] .document-bar {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 4px;
    padding: 3px 12px 4px;
  }

  body[data-theme="legacy"] .doc-link {
    min-height: 64px;
  }

  body[data-theme="legacy"] .doc-link img {
    width: clamp(48px, 4.6vw, 62px);
    height: clamp(48px, 4.6vw, 62px);
  }

  body[data-theme="legacy"] .admin-topbar {
    min-height: 38px;
    gap: 5px;
    padding: 3px 10px;
  }

  body[data-theme="legacy"] .admin-topbar .theme-trigger,
  body[data-theme="legacy"] .admin-topbar .backup-trigger,
  body[data-theme="legacy"] .admin-topbar .logout-btn,
  body[data-theme="legacy"] .admin-topbar .topbar-btn,
  body[data-theme="legacy"] .admin-topbar .topbar-clock {
    min-height: 32px !important;
    height: 32px;
    padding: 0 9px !important;
    font-size: 11px;
  }

  body[data-theme="legacy"] main {
    gap: 6px;
    padding: 6px 10px 9px;
  }

  body[data-theme="legacy"] .command-strip {
    grid-template-columns:
      max-content
      clamp(210px, 16vw, 330px)
      clamp(210px, 16vw, 340px)
      minmax(280px, 1fr);
    gap: 6px;
  }

  body[data-theme="legacy"] .vin-card,
  body[data-theme="legacy"] .task-card {
    grid-column: auto !important;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-command {
    width: max-content;
    max-width: 100%;
    grid-template-columns: max-content auto 34px;
  }

  body[data-theme="legacy"] .command-card {
    min-height: 68px !important;
    height: 68px !important;
    padding: 6px 8px;
  }

  body[data-theme="legacy"] .vin-card.has-decoded-result {
    height: auto !important;
  }

  body[data-theme="legacy"] .vin-card {
    height: auto !important;
    overflow: visible;
  }

  body[data-theme="legacy"] .task-card {
    overflow: hidden;
  }

  body[data-theme="legacy"] .notes-modal-body {
    gap: 12px;
    padding: 12px;
  }

  body[data-theme="legacy"] .note-editor-card,
  body[data-theme="legacy"] .notes-list-panel {
    padding: 12px;
  }

  body[data-theme="legacy"] #sn-text {
    min-height: 190px;
    max-height: calc(100vh - 280px);
  }

  body[data-theme="legacy"] .legacy-nav-slot {
    margin: -1px 0 5px;
  }

  body[data-theme="legacy"] .sidebar-nav {
    gap: 4px;
    flex-wrap: nowrap;
  }

  body[data-theme="legacy"] .sidebar-tab {
    min-height: 25px;
    gap: 4px;
    padding: 3px 6px;
    font-size: 10px;
    white-space: nowrap;
  }

  body[data-theme="legacy"] .count-badge,
  body[data-theme="legacy"] .count-badge-orange {
    min-width: 24px;
    height: 19px;
    padding: 0 5px;
    font-size: 10px;
  }

  body[data-theme="legacy"] .inventory-card {
    padding: 7px;
  }

  body[data-theme="legacy"] .inventory-header {
    min-height: 37px;
    margin-bottom: 4px;
    padding-bottom: 4px;
  }

  body[data-theme="legacy"] .inventory-header h2 {
    font-size: 17px;
  }

  body[data-theme="legacy"] .inventory-header p {
    font-size: 9px;
  }

  body[data-theme="legacy"] .summary-panel {
    padding: 7px !important;
  }

  body[data-theme="legacy"] .summary-panel > .actions {
    padding-bottom: 5px !important;
    margin-bottom: 5px !important;
  }

  body[data-theme="legacy"] .veh-exp-stats > div,
  body[data-theme="legacy"] .biz-exp-stats > div,
  body[data-theme="legacy"] .oth-exp-stats > div,
  body[data-theme="legacy"] .tot-exp-stats > div,
  body[data-theme="legacy"] .itm-prof-stats > div,
  body[data-theme="legacy"] .tot-prof-stats > div,
  body[data-theme="legacy"] .monthly-report-stats > div,
  body[data-theme="legacy"] .payment-stat-card {
    min-height: 50px !important;
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    gap: 7px;
  }

  body[data-theme="legacy"] #activeQuickTools .command-card,
  body[data-theme="legacy"] #activeQuickTools .weather-compact,
  body[data-theme="legacy"] #activeQuickTools .calendar-compact,
  body[data-theme="legacy"] #activeQuickTools .note-compact,
  body[data-theme="legacy"] #activeQuickTools .task-card {
    min-height: 152px !important;
    height: 152px !important;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-card {
    width: max-content;
    height: auto !important;
    overflow: visible;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-command {
    width: max-content;
    grid-template-columns: max-content auto 38px;
  }

  body[data-theme="legacy"] #activeQuickTools #vinInput {
    box-sizing: content-box;
    width: 17ch;
    min-width: 17ch;
    max-width: 17ch;
  }

  body[data-theme="legacy"] #activeQuickTools .vin-command input,
  body[data-theme="legacy"] #activeQuickTools .vin-command button {
    min-height: 38px;
    height: 38px;
  }

  body[data-theme="legacy"] #activeQuickTools #weatherCompactMount > div,
  body[data-theme="legacy"] #activeQuickTools #weatherCompactMount iframe {
    width: 100% !important;
    max-width: 100% !important;
    height: 132px !important;
    min-height: 132px !important;
    transform: none !important;
  }

  body[data-theme="legacy"] #activeQuickTools .note-compact {
    align-items: stretch;
    padding: 10px;
  }

  body[data-theme="legacy"] #activeQuickTools #activeNotePreview {
    height: 100%;
    display: block;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.36;
    white-space: pre-wrap;
    -webkit-line-clamp: unset;
  }

  body[data-theme="legacy"] #activeQuickTools .task-card {
    padding: 9px;
  }

  body[data-theme="legacy"] #activeQuickTools #taskPreviewList {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  body[data-theme="legacy"] #activeQuickTools .task-preview-row {
    height: auto;
  }

  body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn {
    padding: 5px 7px;
  }

  body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn strong {
    font-size: 12px;
    line-height: 1.12;
  }

  body[data-theme="legacy"] #activeQuickTools .task-preview-open-btn small {
    display: block;
    font-size: 10px;
  }

  body[data-theme="legacy"] #activeQuickTools .task-preview-complete-btn {
    width: 30px;
    min-width: 30px;
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns:
      max-content
      minmax(165px, 0.58fr)
      minmax(250px, 0.9fr)
      minmax(130px, 0.48fr)
      minmax(300px, 1.2fr);
  }
}

@container (max-width: 420px) {
  body[data-theme="legacy"] #activeQuickTools #taskPreviewList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media not all {
  body[data-theme="legacy"] #activeQuickTools {
    grid-template-columns: 320px minmax(220px, 0.8fr) minmax(285px, 1fr);
  }

  body[data-theme="legacy"] #activeQuickTools .note-compact {
    grid-column: 1;
  }

  body[data-theme="legacy"] #activeQuickTools .task-card {
    grid-column: 2 / -1 !important;
  }
}

/* Final inventory alignment override. */
body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(n + 8):nth-child(-n + 11),
body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(n + 8):nth-child(-n + 11),
body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(n + 8):nth-child(-n + 11),
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(n + 8):nth-child(-n + 11) {
  justify-content: center !important;
  padding-right: 2px;
  padding-left: 2px;
  text-align: center !important;
}

body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10),
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10) {
  justify-content: center !important;
  text-align: center !important;
}

body[data-theme="legacy"] #inventoryTableActive .vin-cell,
body[data-theme="legacy"] #inventoryTableSold .vin-cell {
  width: 100%;
}

/* Leon's table color contract: VIN is blue, PPE is light yellow, and the
   surrounding values step down one size so the VIN remains easiest to scan. */
body[data-theme="legacy"] #inventoryTableActive thead th:nth-child(10),
body[data-theme="legacy"] #inventoryTableSold thead th:nth-child(10) {
  color: #60a5fa !important;
}

body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(10),
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(10),
body[data-theme="legacy"] #inventoryTableActive .vin-cell,
body[data-theme="legacy"] #inventoryTableSold .vin-cell {
  color: #7dd3fc !important;
}

body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8),
body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row td:nth-child(8) *,
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8),
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row td:nth-child(8) * {
  color: wheat !important;
}

body[data-theme="legacy"] #inventoryTableActive tbody tr.data-row > td:not(:nth-child(10)):not(:nth-child(12)),
body[data-theme="legacy"] #inventoryTableSold tbody tr.data-row > td:not(:nth-child(10)):not(:nth-child(12)) {
  font-size: 0.8em;
}

body[data-theme="legacy"] #inventoryTableActive .displayed-toggle-btn:not(.is-displayed)::after {
  content: "";
  position: absolute;
  width: 72%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-43deg);
  pointer-events: none;
}

/* Keep one desktop composition, but let that composition contract with browser
   zoom instead of forcing a 1220px canvas and creating page-level overflow. */
html {
  min-width: 0;
}

body[data-theme="legacy"],
body[data-theme="legacy"] .admin-shell {
  min-width: 0;
  max-width: 100%;
}

body[data-theme="legacy"] .admin-topbar,
body[data-theme="legacy"] .header-right {
  flex-wrap: nowrap !important;
}

body[data-theme="legacy"] .admin-topbar .topbar-btn,
body[data-theme="legacy"] .admin-topbar .topbar-control,
body[data-theme="legacy"] .admin-topbar .logout-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-collapsed {
  display: none !important;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open {
  position: relative !important;
  inset: auto !important;
  z-index: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  max-height: clamp(170px, 42dvh, 330px);
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns:
    minmax(300px, 1.05fr)
    minmax(170px, 0.75fr)
    minmax(240px, 0.9fr)
    minmax(130px, 0.55fr)
    minmax(300px, 1.3fr) !important;
  align-content: flex-start;
  align-items: stretch;
  gap: 7px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  scrollbar-width: thin;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .vin-card {
  min-width: 0;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .weather-compact {
  min-width: 0;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .calendar-compact {
  min-width: 0;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .note-compact {
  min-width: 0;
}

/* Leon's compact admin brand: the former full-width logo row is removed and
   the same logo sits between the three left and three right toolbar controls. */
body[data-theme="legacy"] .admin-shell {
  grid-template-rows: auto auto minmax(0, 1fr) !important;
}

body[data-theme="legacy"] .legacy-page-title {
  display: none !important;
}

body[data-theme="legacy"] .admin-topbar .header-right {
  display: grid !important;
  grid-template-columns:
    repeat(3, max-content)
    minmax(132px, 160px)
    repeat(3, max-content);
  align-items: center;
  justify-content: center;
  gap: 6px;
}

body[data-theme="legacy"] .admin-topbar-brand {
  box-sizing: border-box;
  width: 100%;
  min-width: 132px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 2px 8px;
  overflow: hidden;
}

body[data-theme="legacy"] .admin-topbar-brand img {
  width: 100%;
  max-width: 146px;
  height: 32px;
  display: block;
  object-fit: contain;
  mix-blend-mode: lighten;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .task-card {
  min-width: 0;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .vin-card,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open .weather-compact,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open .calendar-compact,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open .note-compact,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open .task-card {
  width: auto !important;
  grid-column: auto !important;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open .quick-tools-close {
  display: none !important;
}

body[data-theme="legacy"] .quick-tools-backdrop {
  display: none !important;
}

body[data-theme="legacy"] .quick-tools-toggle.is-active {
  border-color: rgba(74, 222, 128, 0.72) !important;
  box-shadow:
    inset 0 0 0 1px rgba(74, 222, 128, 0.18),
    0 0 0 2px rgba(74, 222, 128, 0.08) !important;
}

/* Compact dashboard strip: VIN, weather, calendar with two tasks, then notes. */
body[data-theme="legacy"] #activeQuickTools.quick-tools-open {
  grid-template-columns:
    minmax(280px, 0.9fr)
    minmax(125px, 0.48fr)
    minmax(250px, 1.05fr)
    minmax(0, 1.5fr) !important;
  max-height: none !important;
  align-items: stretch !important;
  overflow: hidden !important;
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open > .vin-card,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open > .weather-compact,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open > .calendar-compact,
body[data-theme="legacy"] #activeQuickTools.quick-tools-open > .note-compact {
  box-sizing: border-box;
  min-height: 86px !important;
  height: 86px !important;
  max-height: 86px !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-card {
  padding: 8px 10px !important;
  overflow: hidden !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-card > label {
  margin: 0 0 5px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-command {
  width: 100% !important;
  grid-template-columns: minmax(17ch, 1fr) auto 36px !important;
  gap: 6px !important;
}

body[data-theme="legacy"] #activeQuickTools #vinInput {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 17ch !important;
  max-width: none !important;
  padding: 0 9px !important;
  font-size: 14px !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-command input,
body[data-theme="legacy"] #activeQuickTools .vin-command button {
  min-height: 40px !important;
  height: 40px !important;
}

body[data-theme="legacy"] #activeQuickTools .vin-card #status,
body[data-theme="legacy"] #activeQuickTools .vin-card #decodedContainer {
  display: none !important;
}

body[data-theme="legacy"] #weatherCompactCard.weather-compact {
  padding: 8px 10px !important;
}

body[data-theme="legacy"] #weatherCompactCard .weather-compact-place {
  inset: 8px auto auto 10px !important;
  font-size: 12px !important;
}

body[data-theme="legacy"] #weatherCompactCard .weather-compact-temp {
  inset: 50% auto auto 10px !important;
  font-size: 28px !important;
}

body[data-theme="legacy"] #weatherCompactCard .weather-compact-icon {
  inset: 50% 12px auto auto !important;
  font-size: 28px !important;
}

body[data-theme="legacy"] #weatherCompactCard .weather-compact-condition {
  inset: auto 30px 8px 10px !important;
  font-size: 10px !important;
}

body[data-theme="legacy"] #weatherCompactCard .weather-compact-open {
  inset: auto 9px 10px auto !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact {
  display: grid !important;
  grid-template-rows: 43px 33px !important;
  gap: 3px !important;
  padding: 4px 5px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-button {
  grid-row: 1;
  grid-template-columns: 38px minmax(0, 1fr) auto !important;
  gap: 7px !important;
  min-height: 43px !important;
  height: 43px !important;
  padding: 0 38px 0 2px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-icon {
  width: 38px !important;
  height: 41px !important;
  grid-template-rows: 15px minmax(0, 1fr) !important;
  border-radius: 7px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-icon small {
  font-size: 8px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-icon strong {
  font-size: 19px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-copy {
  gap: 1px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-copy > small,
body[data-theme="legacy"] #activeQuickTools .calendar-today-copy > span {
  font-size: 8px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-today-copy > strong {
  font-size: 11px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-export {
  inset: 5px 5px auto auto !important;
  min-width: 31px !important;
  min-height: 25px !important;
  padding: 0 5px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks {
  grid-row: 2;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 33px !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks #taskPreviewList {
  height: 33px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: 33px !important;
  gap: 5px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-row {
  box-sizing: border-box;
  height: 33px !important;
  min-height: 33px !important;
  gap: 2px !important;
  padding: 0 !important;
  border-left-width: 3px !important;
  border-radius: 6px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-open-btn {
  min-width: 0;
  padding: 3px 5px !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-open-btn strong {
  font-size: 9px !important;
  line-height: 1.05 !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-open-btn small {
  display: block !important;
  font-size: 7px !important;
  line-height: 1 !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-complete-btn {
  width: 25px !important;
  min-width: 25px !important;
  height: 31px !important;
  padding: 0 !important;
}

body[data-theme="legacy"] #activeQuickTools .calendar-compact-tasks .task-preview-empty {
  min-height: 31px !important;
  height: 31px !important;
  font-size: 9px !important;
}

body[data-theme="legacy"] #activeQuickTools .note-compact {
  padding: 8px 10px !important;
}

body[data-theme="legacy"] #activeQuickTools #activeNotePreview {
  height: 100% !important;
  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  font-size: 11px !important;
  line-height: 1.28 !important;
  white-space: pre-wrap !important;
  -webkit-line-clamp: unset !important;
  scrollbar-width: thin;
}

/* The center toolbar slot is a clock; the dealership logo now anchors the
   taller inventory/search row directly beneath the calendar. */
body[data-theme="legacy"] .admin-topbar-clock {
  box-sizing: border-box;
  min-width: 150px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body[data-theme="legacy"] .admin-topbar-clock i {
  color: var(--yellow);
}

body[data-theme="legacy"] .admin-topbar .header-right {
  grid-template-columns:
    repeat(3, max-content)
    minmax(150px, 180px)
    repeat(3, max-content) !important;
}

body[data-theme="legacy"] .inventory-header {
  position: relative;
  min-height: 62px;
  grid-template-columns:
    minmax(300px, 1fr)
    max-content !important;
  align-items: center !important;
  gap: 14px !important;
}

body[data-theme="legacy"] .inventory-header-brand {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 0;
  width: min(205px, 18vw);
  height: 50px;
  display: grid;
  place-items: center;
  padding: 2px 8px;
  overflow: hidden;
  pointer-events: none;
}

body[data-theme="legacy"] .inventory-header-brand img {
  width: 100%;
  max-width: 205px;
  height: 48px;
  display: block;
  object-fit: contain;
  opacity: 1;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
}

body[data-theme="legacy"] .inventory-toolbar {
  width: auto !important;
  justify-self: end !important;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active {
  width: auto !important;
  grid-template-columns:
    clamp(178px, 14vw, 190px)
    auto auto auto !important;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active .search-wrap,
body[data-theme="legacy"] .section-toolbar-inventory.is-active #inventorySearch {
  width: clamp(178px, 14vw, 190px) !important;
  min-width: 178px !important;
  max-width: 190px !important;
}

/* Zoom-safe admin autofit. Browser zoom changes the available CSS viewport;
   every major row contracts within that viewport without switching to a
   separate mobile layout or introducing a horizontal page scrollbar. */
html,
body[data-theme="legacy"],
body[data-theme="legacy"] .admin-shell,
body[data-theme="legacy"] main,
body[data-theme="legacy"] .inventory-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
}

html,
body[data-theme="legacy"] {
  overflow-x: hidden;
}

body[data-theme="legacy"] .admin-topbar {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-right: clamp(6px, 1.25vw, 18px);
  padding-left: clamp(6px, 1.25vw, 18px);
}

body[data-theme="legacy"] .admin-topbar .header-right {
  min-width: 0;
  max-width: 100%;
  grid-template-columns:
    repeat(3, max-content)
    clamp(108px, 10.4vw, 150px)
    repeat(3, max-content) !important;
  gap: clamp(3px, 0.42vw, 6px);
}

body[data-theme="legacy"] .admin-topbar .topbar-btn,
body[data-theme="legacy"] .admin-topbar .topbar-control,
body[data-theme="legacy"] .admin-topbar .logout-btn,
body[data-theme="legacy"] .admin-topbar .topbar-clock {
  min-width: 0;
  padding-right: clamp(5px, 0.65vw, 11px) !important;
  padding-left: clamp(5px, 0.65vw, 11px) !important;
  font-size: clamp(9px, 0.84vw, 12px);
}

body[data-theme="legacy"] .admin-topbar-clock {
  min-width: clamp(108px, 10.4vw, 150px);
}

body[data-theme="legacy"] #activeQuickTools.quick-tools-open {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  grid-template-columns:
    minmax(280px, 0.9fr)
    minmax(125px, 0.48fr)
    minmax(250px, 1.05fr)
    minmax(0, 1.5fr) !important;
}

body[data-theme="legacy"] .inventory-header {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) max-content !important;
}

body[data-theme="legacy"] .inventory-header > div:first-child {
  min-width: 0;
}

body[data-theme="legacy"] .inventory-header-brand {
  width: clamp(105px, 14vw, 205px);
}

body[data-theme="legacy"] .section-toolbar.is-active:not(.section-toolbar-monthly) {
  width: auto !important;
  grid-template-columns: clamp(150px, 14vw, 190px) !important;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  column-gap: clamp(10px, 0.7vw, 14px) !important;
}

body[data-theme="legacy"] .section-toolbar.is-active:not(.section-toolbar-monthly) .search-wrap,
body[data-theme="legacy"] .section-toolbar.is-active:not(.section-toolbar-monthly) input {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  padding-right: clamp(8px, 0.7vw, 12px);
  padding-left: clamp(8px, 0.7vw, 12px);
  overflow: visible;
  font-size: clamp(10px, 0.85vw, 12px);
  text-overflow: clip;
}

body[data-theme="legacy"] .section-toolbar.is-active:not(.section-toolbar-monthly) .search-wrap {
  margin-right: 0;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: clamp(10px, 0.7vw, 12px) !important;
  max-width: 100%;
  overflow: visible !important;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active .search-wrap {
  position: relative;
  z-index: 1;
  flex: 0 1 190px !important;
  width: clamp(150px, 14vw, 190px) !important;
  min-width: 150px !important;
  max-width: 190px !important;
  margin-right: 12px !important;
  grid-column: auto !important;
  grid-row: auto !important;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active #inventorySearch {
  display: block;
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

body[data-theme="legacy"] .section-toolbar-inventory.is-active .toolbar-icon-btn {
  position: relative;
  z-index: 2;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 clamp(34px, 3.1vw, 44px) !important;
  box-sizing: border-box;
  width: clamp(34px, 3.1vw, 44px) !important;
  min-width: clamp(34px, 3.1vw, 44px) !important;
  height: clamp(34px, 3.1vw, 44px) !important;
  min-height: clamp(34px, 3.1vw, 44px) !important;
  grid-column: auto !important;
  grid-row: auto !important;
}

body[data-theme="legacy"] .inventory-table thead tr,
body[data-theme="legacy"] .inventory-table tbody tr.data-row {
  grid-template-columns:
    3.2em
    7.2em
    8.6em
    4.2em
    4.2em
    5.1em
    5.2em
    2.8em
    7em
    9.8em
    3.4em
    9em;
  column-gap: clamp(2px, 0.2em, 6px);
}
