/* =========================================================================
   Auto Parts Center — Stylesheet
   Theme: "Midnight Indigo" — premium modern dashboard
   ========================================================================= */
:root {
  /* Surfaces & neutrals (warm slate) */
  --bg: #f5f6fa;
  --bg-2: #eef0f6;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #14182b;
  --ink-2: #3a425c;
  --muted: #6b7390;
  --muted-2: #9499ad;
  --line: #e7e9f2;
  --line-2: #f1f3f9;
  --line-3: #e0e3ee;

  /* Brand — Indigo */
  --primary: #4f46e5;
  --primary-d: #4338ca;
  --primary-dd: #3730a3;
  --primary-l: #eef0ff;
  --primary-ll: #f5f6ff;
  --primary-grad: linear-gradient(135deg, #6366f1, #4f46e5 55%, #4338ca);
  --primary-grad-soft: linear-gradient(135deg, rgba(99,102,241,.12), rgba(79,70,229,.12));

  /* Sidebar — deep midnight */
  --sidebar: #14132c;
  --sidebar-2: #1c1b3a;
  --sidebar-3: #252346;
  --sidebar-ink: #b9bdf0;
  --sidebar-ink-dim: #7d83b8;

  /* Semantic */
  --green: #15a34a;
  --green-d: #128a3f;
  --green-l: #e8f7ee;
  --red: #e23838;
  --red-d: #c92d2d;
  --red-l: #fdecec;
  --amber: #d97706;
  --amber-l: #fdf3e3;
  --orange: #ea6c1f;
  --orange-l: #fff1e6;

  /* Vehicle accents */
  --v-rick: #ea6c1f;
  --v-rick-l: #fff1e6;
  --v-moto: #2563eb;
  --v-moto-l: #e8effe;
  --v-truck: #0d9488;
  --v-truck-l: #e6f7f5;

  /* Shape & depth */
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(20, 24, 43, 0.05);
  --shadow-sm: 0 1px 3px rgba(20, 24, 43, 0.06), 0 1px 2px rgba(20, 24, 43, 0.04);
  --shadow: 0 4px 16px -4px rgba(20, 24, 43, 0.10), 0 2px 6px -2px rgba(20, 24, 43, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(20, 24, 43, 0.22), 0 8px 20px -8px rgba(20, 24, 43, 0.12);
  --shadow-glow: 0 8px 24px -6px rgba(79, 70, 229, 0.42);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(99,102,241,.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(13,148,136,.04), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d7e6; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #c2c6da; }

/* ===================== Shell layout ===================== */
#app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.topbar { display: none; }

.sidebar {
  background: linear-gradient(185deg, var(--sidebar) 0%, var(--sidebar-2) 60%, var(--sidebar-3) 100%);
  color: var(--sidebar-ink);
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255,255,255,.04);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 18px;
}
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: var(--primary-grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px; letter-spacing: .02em;
  box-shadow: 0 6px 18px -4px rgba(79,70,229,.7), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-txt strong { display: block; color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brand-txt span { font-size: 11.5px; color: var(--sidebar-ink-dim); }

.nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nav-group {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--sidebar-ink-dim); padding: 14px 12px 7px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--sidebar-ink); font-weight: 500; font-size: 13.5px;
  margin-bottom: 2px; transition: all 0.16s ease;
  width: 100%; text-align: left; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: var(--primary-grad);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px -6px rgba(79,70,229,.6);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 22px; background: #a5b4fc; border-radius: 0 4px 4px 0;
}
.nav-ic { font-size: 16px; width: 20px; text-align: center; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; margin-top: 6px; }
.cash-pill {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 10px;
}
.cp-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 3px 0; color: var(--sidebar-ink); }
.cp-row strong { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.cp-row.good strong { color: #5eead4; }
.cp-row.bad strong { color: #fca5a5; }
.ver { font-size: 10.5px; color: var(--sidebar-ink-dim); text-align: center; }

.main { min-width: 0; }
.content { padding: 30px 34px 70px; max-width: 1340px; }

/* ===================== Page head ===================== */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head.in { margin-bottom: 16px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px; color: var(--ink); }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: 500; }
.vh-ic {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 21px;
  box-shadow: var(--shadow-xs);
}
.vh-ic.orange { background: var(--v-rick-l); }
.vh-ic.blue { background: var(--v-moto-l); }
.vh-ic.green { background: var(--v-truck-l); }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===================== Search / select boxes ===================== */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 0 13px; height: 41px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:hover { border-color: var(--line-3); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.search-box span { font-size: 14px; opacity: 0.45; }
.search-box input { border: none; outline: none; background: none; width: 210px; }
.select-box {
  height: 41px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); padding: 0 13px; outline: none; cursor: pointer;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 41px; padding: 0 17px; border-radius: 11px;
  font-weight: 600; font-size: 13.5px; letter-spacing: -0.003em;
  transition: all 0.16s ease; white-space: nowrap;
}
.btn.sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn.primary { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-glow); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -6px rgba(79,70,229,.55); }
.btn.primary:active { transform: translateY(0); }
.btn.outline { background: var(--surface); border: 1.5px solid var(--line-3); color: var(--ink-2); }
.btn.outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-ll); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.danger { background: var(--red-l); color: var(--red-d); }
.btn.danger:hover { background: var(--red); color: #fff; box-shadow: 0 8px 20px -6px rgba(226,56,56,.5); }
.plus { font-size: 18px; line-height: 1; font-weight: 600; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--muted);
  transition: all 0.15s; font-size: 15px;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
.icon-btn.danger:hover { background: var(--red-l); color: var(--red); }

/* ===================== Stat chips & cards ===================== */
.stat-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-chip {
  flex: 1; min-width: 145px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-chip.warn { border-color: var(--amber); background: var(--amber-l); }
.sc-label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.sc-val { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card.good { border-color: rgba(21,163,74,.3); background: linear-gradient(135deg, var(--green-l), #f3fcf6); }
.stat-card.bad { border-color: rgba(226,56,56,.3); background: linear-gradient(135deg, var(--red-l), #fef5f5); }
.stat-ic {
  width: 48px; height: 48px; border-radius: 13px;
  background: var(--primary-l); color: var(--primary);
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.stat-card.good .stat-ic { background: var(--green-l); color: var(--green-d); }
.stat-card.bad .stat-ic { background: var(--red-l); color: var(--red-d); }
.stat-l { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-v { display: block; font-size: 20px; font-weight: 800; margin-top: 3px; letter-spacing: -0.02em; }

/* ===================== Cards ===================== */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.card-table-wrap { overflow-x: auto; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; }

/* ===================== Tables ===================== */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left; padding: 12px 18px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table.compact thead th, .table.compact tbody td { padding: 9px 14px; }
.table tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover, .table tbody tr:hover { background: var(--primary-ll); }
.table tfoot td { padding: 12px 18px; border-top: 2px solid var(--line); background: var(--surface-2); font-size: 13.5px; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.strong, strong { font-weight: 700; }
.muted { color: var(--muted); }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.row-actions { display: flex; gap: 4px; justify-content: center; }

/* ===================== Badges / tags ===================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
  background: var(--line-2); color: var(--muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.paid { background: var(--green-l); color: var(--green-d); }
.badge.partial { background: var(--amber-l); color: var(--amber); }
.badge.pending { background: var(--red-l); color: var(--red-d); }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 6px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--muted);
}
.tag.blue { background: var(--v-moto-l); color: var(--v-moto); }
.tag.orange { background: var(--v-rick-l); color: var(--v-rick); }
.tag.green { background: var(--v-truck-l); color: var(--v-truck); }

.stock {
  display: inline-block; min-width: 36px; text-align: center;
  padding: 3px 9px; border-radius: 7px; font-weight: 700;
  font-variant-numeric: tabular-nums; font-size: 13px;
}
.stock.ok { background: var(--green-l); color: var(--green-d); }
.stock.low { background: var(--amber-l); color: var(--amber); }
.stock.out { background: var(--red-l); color: var(--red-d); }
.good-txt { color: var(--green-d); }
.bad-txt { color: var(--red-d); }

/* ===================== Empty ===================== */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-ic { font-size: 42px; margin-bottom: 12px; opacity: .9; }
.empty-t { font-size: 15px; font-weight: 700; color: var(--ink); }
.empty-s { font-size: 13px; margin-top: 5px; }

/* ===================== Vehicle summary ===================== */
.vehicle-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.vs-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow-sm); }
.vs-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.vs-ic { font-size: 25px; }
.vs-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.vs-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vs-l { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.vs-v { display: block; font-weight: 800; font-size: 16px; margin-top: 3px; letter-spacing: -0.02em; }
.vs-v.sm { font-size: 13px; }

/* ===================== Forms ===================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.col-2 { grid-column: span 2; }
.field.grow { grid-column: auto; flex: 1; }
.field.grow2 { grid-column: auto; flex: 2; }
.field.sm { max-width: 110px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  height: 41px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 13px; outline: none; background: var(--surface);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.field input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.hint { font-size: 11.5px; color: var(--muted); }
.stock-current { font-size: 13.5px; color: var(--muted); padding: 4px 0; }

.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; height: 39px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all 0.15s;
}
.seg-btn:hover { border-color: var(--primary); color: var(--primary); }
.seg-btn.active { background: var(--primary-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }

.preview-box { background: var(--primary-grad-soft); border: 1px solid var(--primary-l); border-radius: 10px; padding: 13px; display: flex; flex-direction: column; gap: 7px; }
.preview-box div { display: flex; justify-content: space-between; font-size: 13px; }
.preview-box span { color: var(--muted); }
.preview-box .good { color: var(--green-d); }

/* ===================== Modal ===================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 19, 44, 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; z-index: 100;
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 540px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(0.97); transition: transform 0.22s cubic-bezier(.2,.8,.2,1);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 430px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 880px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 19px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ===================== Toast ===================== */
#toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff;
  padding: 12px 16px 12px 14px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  transform: translateX(120%); transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
  max-width: 340px;
}
.toast.show { transform: translateX(0); }
.toast.success { background: linear-gradient(135deg, #16a34a, #128a3f); }
.toast.error { background: linear-gradient(135deg, #e23838, #c92d2d); }
.toast-ic { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.22); display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ===================== Dashboard ===================== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.dash-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 19px;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px;
  transition: transform .18s, box-shadow .18s;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.dash-card.big { grid-row: span 1; }
.dash-card.good-bg { background: linear-gradient(135deg, #0f766e, #15a34a 90%); color: #fff; border-color: transparent; box-shadow: 0 12px 30px -10px rgba(15,118,110,.5); }
.dash-card.bad-bg { background: linear-gradient(135deg, #b91c1c, #e23838 90%); color: #fff; border-color: transparent; box-shadow: 0 12px 30px -10px rgba(185,28,28,.5); }
.dash-card.good-bg .dc-sub, .dash-card.bad-bg .dc-sub { color: rgba(255,255,255,0.85); }
.dc-top { display: flex; align-items: center; gap: 9px; }
.dc-ic { font-size: 21px; }
.dc-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.dc-val { font-size: 25px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.dash-card.big .dc-val { font-size: 31px; }
.dc-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.dash-card.good-bg .btn.ghost, .dash-card.bad-bg .btn.ghost { background: rgba(255,255,255,0.2); color: #fff; }
.dash-card.good-bg .btn.ghost:hover, .dash-card.bad-bg .btn.ghost:hover { background: rgba(255,255,255,0.32); }

.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.vehicle-bars { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.vb-top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.bar { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.6s cubic-bezier(.2,.8,.2,1); min-width: 4px; }
.bar-fill.blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.bar-fill.orange { background: linear-gradient(90deg, #f59e0b, #ea6c1f); }
.bar-fill.green { background: linear-gradient(90deg, #14b8a6, #0d9488); }
.vb-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-align: left;
  box-shadow: var(--shadow-sm); transition: all 0.18s;
}
.quick-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.qc-ic { font-size: 27px; }
.quick-card strong { display: block; font-size: 14px; letter-spacing: -0.01em; }
.quick-card span:not(.qc-ic):not(.qc-arrow) { font-size: 12px; color: var(--muted); }
.qc-arrow { margin-left: auto; color: var(--primary); font-size: 18px; transition: transform .18s; }
.quick-card:hover .qc-arrow { transform: translateX(3px); }

/* ===================== Dashboard tiles (main nav cards) ================= */
.dash-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 8px;
}
.dash-tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
  text-align: left; box-shadow: var(--shadow-sm);
  transition: all 0.2s ease; min-height: 180px;
}
.dash-tile::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  opacity: 0.07; transition: transform 0.3s ease;
}
.dash-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.dash-tile:hover::after { transform: scale(1.3); }
.dash-tile.orange:hover { box-shadow: 0 20px 40px -12px rgba(234,108,31,.35); }
.dash-tile.blue:hover   { box-shadow: 0 20px 40px -12px rgba(37,99,235,.35); }
.dash-tile.green:hover  { box-shadow: 0 20px 40px -12px rgba(13,148,136,.35); }
.dash-tile.indigo:hover { box-shadow: 0 20px 40px -12px rgba(79,70,229,.35); }
.dash-tile.orange::after { background: var(--v-rick); }
.dash-tile.blue::after   { background: var(--v-moto); }
.dash-tile.green::after  { background: var(--v-truck); }
.dash-tile.indigo::after { background: var(--primary); }
.dt-top { display: flex; justify-content: space-between; align-items: flex-start; }
.dt-ic {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 30px;
}
.dash-tile.orange .dt-ic { background: var(--v-rick-l); }
.dash-tile.blue .dt-ic   { background: var(--v-moto-l); }
.dash-tile.green .dt-ic  { background: var(--v-truck-l); }
.dash-tile.indigo .dt-ic { background: var(--primary-l); }
.dt-badge {
  font-size: 11.5px; font-weight: 700; padding: 4px 12px;
  border-radius: 20px; background: var(--line-2); color: var(--muted);
}
.dt-body { display: flex; flex-direction: column; gap: 4px; }
.dt-body strong { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.dt-body span { font-size: 13px; color: var(--muted); }
.dt-arrow {
  position: absolute; bottom: 26px; right: 26px;
  font-size: 20px; color: var(--muted-2);
  transition: all 0.2s;
}
.dash-tile:hover .dt-arrow { transform: translateX(4px); }
.dash-tile.orange:hover .dt-arrow { color: var(--v-rick); }
.dash-tile.blue:hover .dt-arrow   { color: var(--v-moto); }
.dash-tile.green:hover .dt-arrow  { color: var(--v-truck); }
.dash-tile.indigo:hover .dt-arrow { color: var(--primary); }

/* ===================== Section tabs (Parts / Billing switcher) =========== */
.section-tabs {
  display: flex; gap: 5px; background: var(--surface); padding: 6px;
  border-radius: 13px; border: 1px solid var(--line);
  margin-bottom: 20px; width: fit-content; box-shadow: var(--shadow-xs);
}
.section-tab {
  padding: 9px 19px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
  color: var(--muted); transition: all 0.15s;
}
.section-tab:hover { background: var(--line-2); color: var(--ink); }
.section-tab.active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-glow); }
.section-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== POS Billing ===================== */
/* Customer selection bar */
.pos-cust-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm); flex-wrap: wrap;
}
.pcb-label { font-weight: 700; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.cust-chips { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; min-height: 38px; align-items: center; }
.cust-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--line-3); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: all 0.15s; cursor: pointer;
}
.cust-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-ll); }
.cust-chip.selected { background: var(--primary-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-glow); }
.cust-chip.selected .cc-name { color: #fff; }
.cust-empty { font-size: 12.5px; color: var(--muted); font-style: italic; }

/* Two-column POS layout */
.pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; margin-bottom: 18px; align-items: start; }
.pos-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.pos-col-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pos-col-head h3 { font-size: 14.5px; font-weight: 700; }
.pos-hint { font-size: 11.5px; color: var(--muted); }
.pos-search { margin: 12px 18px 0; width: calc(100% - 36px); }

/* Parts grid (click to add) */
.parts-grid {
  padding: 14px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px; max-height: 520px; overflow-y: auto;
}
.part-card {
  display: flex; flex-direction: column; gap: 5px;
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 13px; text-align: left;
  transition: all 0.15s; cursor: pointer;
}
.part-card:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-ll); transform: translateY(-2px); box-shadow: var(--shadow); }
.part-card:disabled { opacity: 0.45; cursor: not-allowed; }
.part-card.added { animation: pulse 0.4s ease; border-color: var(--green); background: var(--green-l); }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(0.96); } 100% { transform: scale(1); } }
.pc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.pc-name { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.pc-stock { font-size: 10.5px; color: var(--muted); background: var(--line-2); padding: 2px 7px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.pc-out { font-size: 10.5px; color: var(--red-d); background: var(--red-l); padding: 2px 7px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; font-weight: 700; }
.pc-meta { font-size: 11px; color: var(--muted); }
.pc-price { font-size: 15px; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }

/* Cart panel */
.pos-cart-col { position: sticky; top: 16px; display: flex; flex-direction: column; }
.cart-items { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.cart-empty { text-align: center; padding: 36px 16px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 9px 11px;
}
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-price { font-size: 10.5px; color: var(--muted); }
.ci-qty { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--line-3);
  font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; line-height: 1;
  display: grid; place-items: center; transition: all 0.12s;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-val { font-size: 14px; font-weight: 700; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.ci-total { font-size: 13px; font-weight: 700; min-width: 64px; text-align: right; }
.ci-remove { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); font-size: 12px; cursor: pointer; display: grid; place-items: center; }
.ci-remove:hover { background: var(--red-l); color: var(--red); }

/* Cart footer (totals + checkout) */
.cart-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.cart-disc-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cart-disc-row label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cart-disc-row input { flex: 1; height: 36px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 10px; outline: none; font-size: 13px; }
.cart-disc-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }
.cart-totals { background: var(--primary-grad-soft); border: 1px solid var(--primary-l); border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; }
.ct-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.ct-row.big { font-size: 17px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 5px; padding-top: 8px; letter-spacing: -0.02em; }
.pos-checkout { width: 100%; justify-content: center; height: 46px; font-size: 15px; }

/* Sale complete modal */
.sc-success { text-align: center; padding: 8px 0 4px; }
.sc-check { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #16a34a, #128a3f); color: #fff; display: grid; place-items: center; font-size: 28px; margin: 0 auto 14px; box-shadow: 0 8px 20px -6px rgba(21,163,74,.5); }
.sc-amt { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.sc-info { font-size: 13px; color: var(--muted); margin-top: 4px; }
.sc-bal { font-size: 13px; font-weight: 600; margin-top: 8px; }
.sc-print-lbl { font-size: 12px; color: var(--muted); margin-top: 16px; margin-bottom: 8px; }
.sc-print-btns { display: flex; gap: 10px; justify-content: center; }

/* ===================== CMS ===================== */
.cms-nav { display: flex; gap: 5px; background: var(--surface); padding: 6px; border-radius: 13px; border: 1px solid var(--line); margin-bottom: 20px; width: fit-content; box-shadow: var(--shadow-xs); }
.cms-tab { padding: 9px 19px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); transition: all 0.15s; }
.cms-tab:hover { background: var(--line-2); color: var(--ink); }
.cms-tab.active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-glow); }
.cms-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.party { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 39px; height: 39px; border-radius: 12px;
  background: var(--primary-grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
  box-shadow: 0 4px 12px -3px rgba(79,70,229,.4);
}
.avatar.orange { background: linear-gradient(135deg, #f59e0b, #ea6c1f); box-shadow: 0 4px 12px -3px rgba(234,108,31,.4); }

.ledger-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.lh-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.lh-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ledger-head .page-actions { margin-left: auto; }
.back { font-size: 13px; }

.ledger-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.ls-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px; }
.ls-l { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.ls-v { display: block; font-size: 18px; font-weight: 800; margin-top: 5px; letter-spacing: -0.02em; }
.ls-card.highlight .ls-v { font-size: 20px; }
.ls-card.good-bg { background: linear-gradient(135deg, var(--green-l), #f3fcf6); border-color: rgba(21,163,74,.3); }
.ls-card.bad-bg { background: linear-gradient(135deg, var(--red-l), #fef5f5); border-color: rgba(226,56,56,.3); }

/* ===================== Bill form ===================== */
.bill-form { display: flex; flex-direction: column; gap: 16px; }
.bill-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.line-add { display: flex; gap: 10px; align-items: flex-end; background: var(--surface-2); border: 1px solid var(--line); padding: 12px; border-radius: 12px; flex-wrap: wrap; }
.line-add .field { margin-bottom: 0; }
.lines-wrap { min-height: 50px; }
.lines-empty { text-align: center; padding: 26px; color: var(--muted); font-size: 13px; background: var(--surface-2); border: 1px dashed var(--line-3); border-radius: 12px; }
.bill-foot { display: flex; gap: 16px; align-items: flex-start; }
.bill-totals { margin-left: auto; min-width: 240px; background: var(--primary-grad-soft); border: 1px solid var(--primary-l); border-radius: 12px; padding: 13px 16px; }
.bt-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.bt-row.big { font-size: 16px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 5px; padding-top: 9px; letter-spacing: -0.01em; }

/* ===================== Bill detail ===================== */
.bill-detail { display: flex; flex-direction: column; gap: 16px; }
.bd-meta { display: flex; gap: 26px; flex-wrap: wrap; }
.bd-meta .lbl { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.bd-totals { margin-left: auto; max-width: 280px; background: var(--primary-grad-soft); border: 1px solid var(--primary-l); border-radius: 12px; padding: 13px 16px; }
.pay-section { border-top: 1px solid var(--line); padding-top: 16px; }
.pay-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pay-head h4 { font-size: 15px; font-weight: 700; }
.bd-notes { border-top: 1px solid var(--line); padding-top: 14px; }
.bd-notes .lbl { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===================== Responsive ===================== */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-card.big { grid-column: span 2; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .ledger-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  #app-shell { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--sidebar); color: #fff;
    padding: 13px 16px; position: sticky; top: 0; z-index: 50;
  }
  .topbar .icon-btn { color: #fff; }
  .sidebar { position: fixed; top: 0; left: 0; width: 274px; transform: translateX(-100%); transition: transform 0.26s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 18px 16px 50px; }
  .dash-row, .cms-cols { grid-template-columns: 1fr; }
  .vehicle-summary { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart-col { position: static; }
  .parts-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .search-box input { width: 100%; }
}
@media (max-width: 600px) {
  .dash-grid, .quick-grid, .stat-grid, .ledger-summary { grid-template-columns: 1fr; }
  .dash-tiles { grid-template-columns: 1fr; }
  .dash-card.big { grid-column: span 1; }
  .form-grid, .bill-meta { grid-template-columns: 1fr; }
  .field.col-2 { grid-column: span 1; }
  .modal-body { padding: 16px; }
}

/* ===================== Boot loader ===================== */
.boot-loader {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(160deg, var(--sidebar), var(--sidebar-2) 60%, var(--sidebar-3));
  display: flex; align-items: center; justify-content: center;
}
.boot-card { text-align: center; color: #fff; }
.boot-logo { font-size: 54px; margin-bottom: 22px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.boot-spin {
  width: 40px; height: 40px;
  border: 3.5px solid rgba(255,255,255,0.18);
  border-top-color: #a5b4fc; border-radius: 50%;
  margin: 0 auto 16px; animation: spin 0.8s linear infinite;
}
.boot-txt { font-size: 14px; color: var(--sidebar-ink-dim); font-weight: 500; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== Boot error ===================== */
.boot-error { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: none; align-items: center; justify-content: center; padding: 20px; }
.be-card { max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 38px 30px; text-align: center; box-shadow: var(--shadow-lg); }
.be-ic { font-size: 46px; margin-bottom: 12px; }
.be-card h2 { font-size: 19px; margin-bottom: 8px; letter-spacing: -0.01em; }
.be-msg { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.be-actions { display: flex; gap: 10px; justify-content: center; }
.be-actions .btn { text-decoration: none; }

/* ===================== Sync badge ===================== */
.sync-badge {
  position: fixed; bottom: 22px; left: 22px; z-index: 90;
  display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff;
  padding: 8px 15px; border-radius: 21px;
  font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.sync-badge.syncing { opacity: 1; transform: translateY(0); }
.sync-spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #a5b4fc; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
