/* Responsive presentation layer: retains the operational workflows while
   adapting navigation, grids and controls to the available screen width. */
:root {
  --violet: #ae8cff;
  --amber: #ffc86b;
  --surface: rgba(11, 31, 54, .82);
  --ink: #f3f8ff;
  --muted: #b6c8dc;
  --line: rgba(206, 231, 255, .22);
}

body {
  background:
    radial-gradient(circle at 92% -8%, rgba(91, 125, 255, .25), transparent 34rem),
    radial-gradient(circle at 14% 108%, rgba(61, 216, 188, .13), transparent 32rem),
    #071324;
}

.sidebar {
  background: linear-gradient(180deg, rgba(4, 16, 33, .96), rgba(6, 22, 43, .92));
}

.brand-mark {
  box-shadow: 0 8px 22px rgba(73, 199, 231, .28);
}

.topbar {
  background: linear-gradient(90deg, rgba(7, 19, 36, .9), rgba(13, 35, 62, .78));
}

.card {
  background:
    linear-gradient(145deg, rgba(30, 64, 101, .8), rgba(10, 27, 47, .84)),
    var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .18);
}

.card:hover {
  border-color: rgba(112, 212, 239, .36);
}

body { font-size: 16px; }
.nav-link { font-size: 15px; font-weight: 600; }
.card-heading h3 { font-size: 16px; }
.metric-label { font-size: 13px; font-weight: 700; }
.metric-note { font-size: 13px; font-weight: 600; }
.mini-row, .data-table td { font-size: 14px; }
.data-table th { color: #c5d8e9; }
.field label { color: #c5d8e9; font-size: 12px; }
.table-sub, .mini-row span { color: #a9bed3; }
.status.ok, .tag.green { color: #8df0b6; background: rgba(120,224,162,.16); }
.status.warn { color: #ffd98e; background: rgba(255,200,107,.16); }
.status.due { color: #e4afff; background: rgba(206,140,255,.18); }
.button-primary { color: #031d32; font-weight: 700; }
.button-secondary { color: #eaf4ff; background: rgba(117, 173, 218, .18); }

:focus-visible {
  outline: 3px solid rgba(96, 225, 219, .76);
  outline-offset: 3px;
}

.metric {
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--cyan);
}

.dashboard-metrics .metric:nth-child(2)::before { background: var(--green); }
.dashboard-metrics .metric:nth-child(3)::before { background: var(--amber); }
.dashboard-metrics .metric:nth-child(4)::before { background: var(--violet); }
.dashboard-metrics .metric:nth-child(5)::before { background: var(--blue); }
.dashboard-metrics .metric:nth-child(6)::before { background: var(--pink); }
.metric-link:hover { background: linear-gradient(145deg, rgba(36, 80, 121, .88), rgba(10, 34, 56, .9)); }

.dashboard-panel .card-heading {
  background: linear-gradient(90deg, rgba(96, 225, 219, .06), transparent 58%);
}

.button-primary {
  box-shadow: 0 8px 18px rgba(65, 175, 230, .18);
}

.button-secondary:hover, .nav-link:hover {
  border-color: rgba(96, 225, 219, .42);
}

.field input, .field select, .field textarea, .search, .date-control input {
  background: rgba(5, 19, 35, .9);
}

.data-table {
  background: rgba(5, 19, 35, .18);
}

.data-table th {
  background: rgba(96, 225, 219, .035);
}

@media (max-width: 1200px) {
  .sidebar { width: 224px; }
  .main-content { width: calc(100% - 224px); margin-left: 224px; }
  .topbar { padding: 0 26px; }
  .page-container { padding: 28px 26px 44px; }
  .dashboard-workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-dashboard-workspace { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar {
    width: min(300px, 84vw);
    transform: translateX(-105%);
    box-shadow: 22px 0 45px rgba(0, 0, 0, .34);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { width: 100%; margin-left: 0; }
  .mobile-only {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(96, 225, 219, .08);
  }
  .topbar { height: 78px; padding: 0 24px; gap: 14px; }
  .page-container { padding: 24px; }
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-primary, .dashboard-metrics:not(.sales-dashboard-metrics) .metric:not(.metric-primary) { grid-column: span 1; }
  .metric-primary { min-height: 142px; padding: 20px; }
}

@media (max-width: 700px) {
  .topbar { height: auto; min-height: 70px; padding: 10px 16px; align-items: center; }
  .page-heading-row { min-width: 0; gap: 8px; }
  .page-heading-row > div { min-width: 0; }
  .eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-title { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { margin-left: auto; gap: 8px; }
  .topbar-actions .button { padding: 9px 11px; font-size: 13px; white-space: nowrap; }
  .avatar { width: 34px; height: 34px; flex: 0 0 auto; }
  .page-container { padding: 20px 16px 36px; }
  .welcome { align-items: stretch; margin-bottom: 20px; }
  .welcome h2 { font-size: 23px; }
  .dashboard-controls, .page-toolbar, .toolbar { gap: 10px; }
  .dashboard-controls { width: 100%; }
  .date-control { justify-content: space-between; }
  .date-control input { flex: 1; max-width: 210px; }
  .digital-clock { min-width: 0; }
  .dashboard-metrics, .sales-dashboard-metrics, .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .dashboard-metrics .metric:first-child { grid-column: 1 / -1; }
  .metric-primary { min-height: 126px; padding: 17px; }
  .metric-primary .metric-value { font-size: clamp(31px, 10vw, 43px); }
  .metric-label { font-size: 11px; }
  .dashboard-workspace, .sales-dashboard-workspace { grid-template-columns: 1fr; grid-auto-rows: 250px; gap: 14px; }
  .nav-link { min-height: 44px; font-size: 16px; }
  .card-heading h3 { font-size: 17px; }
  .metric-note { font-size: 12px; }
  .dashboard-panel .card-heading { padding: 16px 16px 11px; }
  .dashboard-panel .mini-list { padding: 0 16px 10px; }
  .mini-row { padding: 10px 0; }
  .form-layout, .dash-grid, .operations-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-card { padding: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .field input, .field select, .field textarea, .search { font-size: 16px; }
  .vehicle-search-control { flex-direction: column; }
  .ticket-boxes { grid-template-columns: 1fr; gap: 10px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button { flex: 1 1 150px; }
  .table-card, .report-table-wrap { margin-inline: -2px; border-radius: 12px; -webkit-overflow-scrolling: touch; }
  .data-table th, .data-table td { padding: 13px 14px; }
  .modal-backdrop { padding: 12px; }
  .modal { padding: 18px; width: 100%; }
  .report-request-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 430px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .topbar-actions .button { font-size: 0; width: 40px; min-width: 40px; padding: 0; height: 40px; }
  .topbar-actions .button::before { content: "+"; font-size: 22px; line-height: 1; }
  .page-back { padding: 8px; font-size: 0; }
  .page-back::before { content: "←"; font-size: 18px; }
  .dashboard-metrics, .sales-dashboard-metrics, .metrics { grid-template-columns: 1fr; }
  .dashboard-metrics .metric, .dashboard-metrics .metric:first-child { grid-column: 1; }
  .metric-primary { min-height: 118px; }
  .dashboard-workspace, .sales-dashboard-workspace { grid-auto-rows: 240px; }
  .card-heading { align-items: flex-start; }
  .card-heading span { text-align: right; }
}
