/* ============================================================
   GMS — Garage Management System
   Design language: "Workshop Instrument Panel"
   Display: Barlow Condensed (gauge/plate character)
   Body/UI:  Inter
   Data/Mono: JetBrains Mono (VIN, plates, SKUs, money)
   ============================================================ */

:root {
  /* Color tokens */
  --ink:        #12161B;   /* page background */
  --panel:      #1A2027;   /* card / surface */
  --panel-2:    #212933;   /* raised surface / hover */
  --panel-3:    #262f3a;   /* input fields */
  --line:       #2C3742;   /* hairline borders */
  --line-soft:  #232b34;
  --fog:        #8D98A6;   /* muted text */
  --fog-dim:    #626d7a;
  --bone:       #EEF1F5;   /* primary text */
  --white:      #FFFFFF;

  --amber:      #F2A63C;   /* primary accent — active / in-progress */
  --amber-dim:  #4a3a20;
  --teal:       #2FBFA8;   /* success — completed / ready */
  --teal-dim:   #16332e;
  --red:        #E5555B;   /* alert — fault / overdue */
  --red-dim:    #3a2226;
  --blue:       #5B95F5;   /* info — pending / awaiting */
  --blue-dim:   #202c42;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-panel: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.28);
  --shadow-pop: 0 16px 40px rgba(0,0,0,0.45);

  --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(242,166,60,0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(47,191,168,0.05), transparent 60%),
    var(--ink);
  color: var(--bone);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  min-height: 100vh;
}

h1, h2, h3, h4, .display-font {
  font-family: 'Barlow Condensed', 'Inter', sans-serif;
  letter-spacing: 0.01em;
  font-weight: 700;
  color: var(--white);
}

.mono, .plate, .vin, td.mono, .money {
  font-family: 'JetBrains Mono', 'SFMono-Regular', monospace;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: #ffbf5e; }

::selection { background: var(--amber); color: #1a1a1a; }

/* Focus visibility (accessibility floor) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Eyebrow / labels ---------- */
.eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fog-dim);
}

/* ============================================================
   APP SHELL — sidebar + topbar
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #161b21, #12161b 65%);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: conic-gradient(from 220deg, var(--amber), #d9860f 40%, var(--amber));
  display: flex; align-items: center; justify-content: center;
  color: #1a1408; font-weight: 800; font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  box-shadow: 0 4px 14px rgba(242,166,60,0.25);
}
.brand-name { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 19px; color: var(--white); line-height: 1; }
.brand-sub { font-size: 10.5px; color: var(--fog-dim); letter-spacing: 0.08em; text-transform: uppercase; }

.side-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.side-section { padding: 10px 10px 4px; }
.side-nav a.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--fog);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s ease, color .12s ease;
  border-left: 2px solid transparent;
}
.side-nav a.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.side-nav a.nav-item i { width: 17px; text-align: center; font-size: 15px; flex-shrink: 0; opacity: .85; }
.side-nav a.nav-item:hover { background: var(--panel-2); color: var(--bone); }
.side-nav a.nav-item.active {
  background: linear-gradient(90deg, rgba(242,166,60,0.14), rgba(242,166,60,0.02));
  color: var(--amber);
  border-left-color: var(--amber);
  font-weight: 600;
}

.side-foot {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px;
}
.avatar-chip {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-3); display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 700; color: var(--amber);
  border: 1px solid var(--line);
  font-size: 13px;
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  border-bottom: 1px solid var(--line);
  background: rgba(18,22,27,0.85);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 21px; margin: 0; }
.topbar .breadcrumb-mini { font-size: 12px; color: var(--fog-dim); }

.search-mini {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--fog-dim);
  font-size: 13px;
  min-width: 240px;
}
.search-mini input { background: transparent; border: 0; outline: 0; color: var(--bone); font-size: 13px; width: 100%; }
.search-mini input::placeholder { color: var(--fog-dim); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--fog);
}
.icon-btn:hover { color: var(--amber); border-color: var(--amber); }

.content { padding: 26px 28px 60px; flex: 1; }

/* Mobile sidebar */
.sidebar-toggle { display: none; }
@media (max-width: 991px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .content { padding: 18px 16px 50px; }
  .search-mini { display: none; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; }
.scrim.show { display: block; }

/* ============================================================
   Panels / cards
   ============================================================ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.panel-body { padding: 20px; }
.panel-title { font-size: 17px; margin: 0; }

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: '';
  position: absolute; right: -30px; top: -30px;
  width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent, var(--amber)) 0%, transparent 70%);
  opacity: .12;
}
.kpi-value { font-family: 'Barlow Condensed', sans-serif; font-size: 34px; font-weight: 700; color: var(--white); line-height: 1; }
.kpi-label { color: var(--fog); font-size: 12.5px; margin-top: 6px; }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.up { color: var(--teal); }
.kpi-delta.down { color: var(--red); }

/* ============================================================
   Status pills
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }

.pill-amber { background: var(--amber-dim); color: var(--amber); border-color: rgba(242,166,60,.25); }
.pill-amber .dot { background: var(--amber); }
.pill-teal { background: var(--teal-dim); color: var(--teal); border-color: rgba(47,191,168,.25); }
.pill-teal .dot { background: var(--teal); }
.pill-blue { background: var(--blue-dim); color: var(--blue); border-color: rgba(91,149,245,.25); }
.pill-blue .dot { background: var(--blue); }
.pill-red { background: var(--red-dim); color: var(--red); border-color: rgba(229,85,91,.25); }
.pill-red .dot { background: var(--red); }
.pill-fog { background: var(--panel-2); color: var(--fog); border-color: var(--line); }
.pill-fog .dot { background: var(--fog-dim); }

/* ============================================================
   Signature element — Torque Gauge status stepper
   Encodes the real 8-state workshop pipeline as a lit dial track.
   ============================================================ */
.gauge-track {
  display: flex; align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 4px;
}
.gauge-step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; min-width: 84px; position: relative;
}
.gauge-step .pin {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--panel-3);
  border: 2px solid var(--line);
  position: relative; z-index: 2;
  transition: all .15s ease;
}
.gauge-step .rail {
  position: absolute; top: 7px; left: 50%; width: 100%; height: 2px;
  background: var(--line); z-index: 1;
}
.gauge-step:first-child .rail { left: 50%; }
.gauge-step:last-child .rail { display: none; }
.gauge-step .g-label {
  margin-top: 8px; font-size: 10.5px; text-align: center; color: var(--fog-dim);
  font-weight: 600; letter-spacing: .01em; line-height: 1.25; padding: 0 2px;
}
.gauge-step.done .pin { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
.gauge-step.done .rail { background: var(--teal); }
.gauge-step.done .g-label { color: var(--teal); }
.gauge-step.now .pin {
  background: var(--amber); border-color: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-dim), 0 0 12px rgba(242,166,60,.5);
  width: 19px; height: 19px; margin-top: -2px;
}
.gauge-step.now .g-label { color: var(--amber); font-weight: 700; }

.gauge-track.compact .gauge-step { min-width: 0; }
.gauge-track.compact .g-label { display: none; }
.gauge-track.compact .pin { width: 9px; height: 9px; }
.gauge-track.compact .gauge-step.now .pin { width: 12px; height: 12px; margin-top: 0; }
.gauge-track.compact .rail { top: 4px; }

/* ============================================================
   Plate / VIN badges
   ============================================================ */
.plate-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #16202b;
  background: linear-gradient(180deg, #ffe9b8, #f2c765);
  border: 1.5px solid #8a6a1e;
  border-radius: 5px;
  padding: 3px 9px 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 2px 4px rgba(0,0,0,.3);
}

/* ============================================================
   Tables
   ============================================================ */
.table-gms { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table-gms thead th {
  text-align: left; font-family: 'Barlow Condensed', sans-serif; font-weight: 600;
  font-size: 11.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--fog-dim); padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table-gms tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); color: var(--bone); vertical-align: middle; }
.table-gms tbody tr { transition: background .12s ease; }
.table-gms tbody tr:hover { background: var(--panel-2); }
.table-gms tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; }

/* ============================================================
   Buttons (Bootstrap overrides)
   ============================================================ */
.btn {
  font-weight: 600; font-size: 13.5px; border-radius: 8px;
  padding: 8px 16px;
}
.btn-amber {
  background: linear-gradient(180deg, #f5b657, var(--amber));
  border: 1px solid #c9862a;
  color: #211505;
}
.btn-amber:hover { background: linear-gradient(180deg, #ffc369, #f7b34c); color: #211505; }
.btn-ghost {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--bone);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }
.btn-outline-gms {
  background: transparent; border: 1px solid var(--line); color: var(--fog);
}
.btn-outline-gms:hover { border-color: var(--bone); color: var(--bone); }
.btn-sm-gms { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }

/* ============================================================
   Forms
   ============================================================ */
.form-label { font-size: 12px; color: var(--fog); font-weight: 600; letter-spacing: .01em; margin-bottom: 5px; }
.form-control, .form-select {
  background: var(--panel-3); border: 1px solid var(--line); color: var(--bone);
  border-radius: 8px; font-size: 13.5px; padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
  background: var(--panel-3); color: var(--bone); border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(242,166,60,0.15);
}
.form-control::placeholder { color: var(--fog-dim); }
.form-check-input { background-color: var(--panel-3); border-color: var(--line); }
.form-check-input:checked { background-color: var(--amber); border-color: var(--amber); }

/* ============================================================
   Tabs
   ============================================================ */
.gms-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 4px; overflow-x: auto; }
.gms-tabs button {
  background: transparent; border: 0; color: var(--fog);
  padding: 12px 16px; font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.gms-tabs button:hover { color: var(--bone); }
.gms-tabs button.active { color: var(--amber); border-bottom-color: var(--amber); }
.tab-pane-gms { display: none; }
.tab-pane-gms.active { display: block; }

/* ============================================================
   Kanban (Work Order pipeline board)
   ============================================================ */
.kanban-wrap { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col {
  min-width: 260px; max-width: 260px; flex-shrink: 0;
  background: rgba(255,255,255,0.015);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 230px);
}
.kanban-col.drop-hover { border-color: var(--amber); background: rgba(242,166,60,0.04); }
.kanban-col-head {
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: 13px;
  letter-spacing: .03em; text-transform: uppercase; color: var(--fog);
  position: sticky; top: 0; background: var(--ink); border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-count { background: var(--panel-2); border-radius: 20px; padding: 1px 8px; font-size: 11px; color: var(--fog); }
.kanban-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }

.job-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; cursor: grab;
  transition: border-color .12s ease, transform .1s ease;
}
.job-card:hover { border-color: var(--fog-dim); }
.job-card.dragging { opacity: .4; }
.job-card .jc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.job-card .jc-vehicle { font-weight: 700; color: var(--white); font-size: 14px; }
.job-card .jc-issue { color: var(--fog); font-size: 12px; margin: 6px 0 10px; line-height: 1.4; }
.job-card .jc-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--fog-dim); }
.jc-mech { display: flex; align-items: center; gap: 5px; }
.jc-mech .m-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line); font-size: 9px; display: flex; align-items: center; justify-content: center; color: var(--amber); font-weight: 700; }

/* ============================================================
   Misc utility
   ============================================================ */
.divider-v { width: 1px; align-self: stretch; background: var(--line); }
.text-fog { color: var(--fog) !important; }
.text-fog-dim { color: var(--fog-dim) !important; }
.text-amber { color: var(--amber) !important; }
.text-teal { color: var(--teal) !important; }
.text-red { color: var(--red) !important; }
.bg-panel2 { background: var(--panel-2); }
.hairline { border-color: var(--line) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.card-gms { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

.empty-state { text-align: center; padding: 46px 20px; color: var(--fog); }
.empty-state svg { width: 44px; height: 44px; color: var(--fog-dim); margin-bottom: 12px; }

.progress-gms { height: 6px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.progress-gms .bar { height: 100%; border-radius: 4px; }

.stock-bar { height: 5px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }

.rating-stars { color: var(--amber); letter-spacing: 2px; }

.toast-gms {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  background: var(--panel-2); border: 1px solid var(--teal); border-left: 4px solid var(--teal);
  padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow-pop);
  font-size: 13px; display: flex; align-items: center; gap: 10px;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: all .25s ease;
}
.toast-gms.show { transform: translateY(0); opacity: 1; }

/* Driver portal (external, no sidebar) */
.driver-shell { max-width: 760px; margin: 0 auto; padding: 30px 18px 70px; }
.driver-hero {
  background: linear-gradient(160deg, #1c232b, #161b20);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.driver-hero::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(242,166,60,0.035) 0 2px, transparent 2px 26px);
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: white; color: black; }
}
