:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ec;
  --primary: #1d4f8f;
  --primary-dark: #173f73;
  --accent: #0f172a;
  --good: #16803e;
  --warn: #a16207;
  --bad: #dc2626;
  --info: #2563eb;
  --radius: 12px;
  --shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
summary:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 111, 114, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 160ms ease;
}

body.auth-cleared .app-shell {
  visibility: hidden;
}

body.auth-cleared dialog[open] {
  visibility: visible;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: #0f172a;
  color: #f7fbfc;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 10px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer {
  color: #b9c8ce;
  font-size: 13px;
}

.sidebar-collapse-button {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5edf2;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .brand > div:not(.brand-mark),
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-status-title,
body.sidebar-collapsed .sidebar-status-grid span {
  display: none;
}

body.sidebar-collapsed .nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 8px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 10px;
  color: #d9e7eb;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #c9d8dc;
  font-size: 12px;
  font-weight: 900;
}

.nav-item.is-active .nav-icon {
  background: #dbeafe;
  color: #1d4f8f;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.sidebar-status-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-status-title {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sidebar-status-grid div {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-status-grid strong {
  color: #fff;
  font-size: 18px;
}

.sidebar-status-grid span {
  color: #b9c8ce;
  font-size: 11px;
}

body.sidebar-collapsed .sidebar-status-card {
  padding: 8px;
}

body.sidebar-collapsed .sidebar-status-grid {
  grid-template-columns: 1fr;
}

body.sidebar-collapsed .sidebar-status-grid div {
  place-items: center;
  min-height: 38px;
}

.main {
  min-width: 0;
  width: 100%;
  max-width: 1740px;
  margin: 0 auto 0 0;
  padding: 24px 32px 40px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid rgba(219, 227, 236, 0.92);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions,
.modal-actions,
.row-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-actions {
  justify-content: flex-end;
}

.global-command {
  position: relative;
  min-width: 0;
}

.global-command input {
  min-height: 44px;
  padding-left: 14px;
  border-color: #cbd8de;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 0 rgba(20, 33, 41, 0.03);
}

.global-search-results {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  z-index: 35;
  display: grid;
  gap: 6px;
  max-height: min(520px, 70vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.global-result {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.global-result:hover,
.global-result:focus-visible {
  background: var(--surface-2);
  outline: 0;
}

.global-result-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eaf1f2;
  color: #37505b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.global-result-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.global-result-main strong,
.global-result-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-result-main small,
.global-search-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.global-search-empty {
  padding: 12px;
}

.system-menu {
  position: relative;
}

.system-menu-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: #e7edf1;
  color: #1f3440;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.system-menu-trigger:focus-visible {
  outline: 3px solid rgba(15, 111, 114, 0.18);
  outline-offset: 2px;
}

.system-menu-trigger[aria-expanded="true"] {
  background: var(--primary);
  color: #fff;
}

.system-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 2000;
  display: grid;
  gap: 8px;
  width: min(330px, 88vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.system-menu-panel .storage-pill {
  justify-content: center;
  width: 100%;
}

.system-status-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.system-readiness-item {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.system-readiness-item small,
.system-readiness-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-readiness-item small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.system-readiness-item strong {
  color: var(--ink);
  font-size: 12px;
}

.system-readiness-item.ok {
  border-color: rgba(28, 111, 72, 0.28);
}

.system-readiness-item.warn {
  border-color: rgba(163, 111, 18, 0.38);
  background: #fffaf0;
}

.system-readiness-item.bad {
  border-color: rgba(176, 55, 55, 0.35);
  background: #fff5f5;
}

.form-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-divider::before,
.form-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.storage-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fafb;
  color: #314653;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.storage-pill.is-warning {
  border-color: rgba(154, 107, 18, 0.35);
  background: #fff8e8;
  color: var(--warn);
}

.primary,
.secondary,
.danger,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #e7edf1;
  color: #1f3440;
}

.secondary:hover {
  background: #d9e3e9;
}

.danger {
  background: #ffe4df;
  color: var(--bad);
}

.compact {
  min-height: 44px;
  padding: 0 10px;
  font-size: 13px;
}

.full {
  width: 100%;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  background: #e7edf1;
  color: var(--ink);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 104px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
  position: relative;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.metric:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.075);
}

.metric::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #7c91a1;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.05;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metric.tone-good {
  border-color: rgba(32, 121, 75, 0.28);
}

.metric.tone-warn {
  border-color: rgba(152, 107, 19, 0.34);
  background: #fffdf7;
}

.metric.tone-bad {
  border-color: rgba(179, 38, 30, 0.34);
  background: #fffafa;
}

.metric.tone-neutral {
  border-color: rgba(115, 136, 154, 0.32);
}

.metric.tone-good::before {
  background: var(--good);
}

.metric.tone-warn::before {
  background: var(--warn);
}

.metric.tone-bad::before {
  background: var(--bad);
}

.compact-metrics {
  margin-bottom: 16px;
}

.command-center-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: 18px;
  align-items: start;
}

.command-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "work work"
    "metrics metrics"
    "fleet revenue";
  gap: 18px;
  align-items: start;
}.command-hero .eyebrow {
  color: var(--muted);
}

.command-hero-copy p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
}.command-priority-grid {
  grid-area: metrics;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 0;
}

.command-priority-grid .metric {
  min-height: 116px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.command-priority-grid .metric-missing-receipts-docs,
.command-priority-grid .metric-urgent-service,
.command-priority-grid .metric-net-cash {
  background: #fff9ef;
}

.command-priority-grid .metric:first-child {
  grid-column: auto;
  min-height: 116px;
}

.command-priority-grid .metric:first-child strong {
  font-size: 24px;
}

.command-dashboard-grid,
.command-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 18px;
  align-items: start;
}.command-insight-grid {
  display: contents;
}

.fleet-status-panel {
  grid-area: fleet;
}

.revenue-snapshot-panel {
  grid-area: revenue;
}

.assistant-command-panel {
  grid-area: assistant;
  align-self: stretch;
}.command-queue-item:has(.status.overdue),
.command-queue-item:has(.status.urgent),
.command-queue-item:has(.status.needs_attention) {
  border-left-color: var(--bad);
}

.command-queue-item:has(.status.due_soon),
.command-queue-item:has(.status.scheduled),
.command-queue-item:has(.status.pending_payment) {
  border-left-color: var(--warn);
}

.command-queue-item:has(.status.available),
.command-queue-item:has(.status.completed) {
  border-left-color: var(--good);
}

.command-queue-item .secondary {
  justify-self: end;
}

.operator-assistant-panel {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.operator-assistant-panel .assistant-command-grid {
  grid-template-columns: 1fr;
}

.split-layout,
.manifest-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.manifest-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  align-items: start;
}

@media (max-width: 1320px) {
  .command-dashboard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "work"
      "metrics"
      "fleet"
      "revenue";
  }

  .command-priority-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .brand > div:not(.brand-mark),
  .nav-label,
  .sidebar-status-title,
  .sidebar-status-grid span {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .topbar {
    grid-template-columns: 1fr;
  }
 .command-priority-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.onboarding-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--sidebar-muted, #aebbb5);
  border-radius: 9px;
  text-decoration: none;
  font-weight: 700;
}
.onboarding-nav-link:hover { color: white; background: rgb(255 255 255 / 8%); }
