/* ================================================================
   DETAILERS EMPIRE — App CSS
   Font: Sora (headings), IBM Plex Mono (numbers/codes)
   Theme: Deep charcoal + Electric amber accent
   ================================================================ */

:root {
  --bg-page:     #0d0f12;
  --bg-card:     #151820;
  --bg-sidebar:  #0a0c0f;
  --bg-input:    #1c2029;
  --bg-hover:    #1e2230;
  --accent:      #f5a623;
  --accent-dim:  #c47d0e;
  --accent-glow: rgba(245,166,35,.15);
  --text-1:      #f0f2f5;
  --text-2:      #9199ab;
  --text-3:      #7b8494;
  --border:      rgba(255,255,255,.07);
  --border-light:rgba(255,255,255,.12);
  --success:     #22c55e;
  --danger:      #ef4444;
  --info:        #38bdf8;
  --warning:     #f5a623;
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --radius:      10px;
  --radius-lg:   14px;
  --transition:  .18s ease;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }
h1,h2,h3,h4,h5,h6 { font-weight: 600; }

/* ── Sidebar ── */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: none;
}
#sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
  flex-shrink: 0;
}
.brand-text { font-weight: 700; font-size: 15px; color: var(--text-1); }

.nav-menu { list-style: none; padding: 12px 10px; flex: 1; }
.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  color: var(--text-3); padding: 14px 8px 6px;
}
.nav-menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  transition: all var(--transition);
  position: relative;
}
.nav-menu li a i { font-size: 16px; flex-shrink: 0; }
.nav-menu li a:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-menu li a.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 2px solid var(--accent);
}
.badge-pill {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}

.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}
.user-chip { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 10px; color: var(--text-3); }
.logout-btn {
  color: var(--text-3); font-size: 16px;
  padding: 4px; border-radius: 6px;
  transition: color var(--transition);
}
.logout-btn:hover { color: var(--danger); }

/* ── Top Bar (mobile) ── */
#topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  z-index: 1030;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}
.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  background: transparent; border: none;
  color: var(--text-2); font-size: 20px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-1); }
.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1035;
}

/* ── Main Content ── */
#content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 28px 28px 48px;
}

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header .subtitle { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text-2);
              text-transform: uppercase; letter-spacing: .8px; margin-bottom: 14px; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.amber { background: var(--accent-glow); color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,.12); color: var(--success); }
.stat-icon.blue   { background: rgba(56,189,248,.12); color: var(--info); }
.stat-icon.red    { background: rgba(239,68,68,.12); color: var(--danger); }
.stat-label { font-size: 11.5px; color: var(--text-2); margin-bottom: 4px; }
.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px; font-weight: 600;
  color: var(--text-1); line-height: 1;
}
.stat-delta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── Tables ── */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 10px;
}
.table-header h2 { font-size: 15px; font-weight: 600; }
.de-table { width: 100%; border-collapse: collapse; }
.de-table thead th {
  background: rgba(255,255,255,.03);
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.de-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}
.de-table tbody tr:last-child td { border-bottom: none; }
.de-table tbody tr:hover td { background: var(--bg-hover); }
.de-table .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }

/* ── Forms ── */
.form-label { font-size: 12px; font-weight: 600; color: var(--text-2);
              text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.form-control, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 14px;
  font-family: 'Sora', sans-serif;
  transition: border-color var(--transition);
}
.form-control:focus, .form-select:focus {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--text-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-3); }
.form-select option { background: var(--bg-card); }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #000; }
.btn-outline-primary { border-color: var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); color: #000; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2); border-radius: var(--radius);
  padding: 6px 14px; font-size: 13px; cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-light); }

/* ── Badges (Bootstrap override) ── */
.badge { font-size: 10.5px; font-weight: 600; padding: 4px 9px; border-radius: 6px; }
.bg-purple { background: #7c3aed !important; }

/* ── Status Pipeline ── */
.pipeline {
  display: flex; align-items: center; gap: 0;
  flex-wrap: nowrap; overflow-x: auto;
  padding: 8px 0;
}
.pipeline-step {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px 6px 20px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-3);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  white-space: nowrap;
  transition: all var(--transition);
}
.pipeline-step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); }
.pipeline-step.done  { background: rgba(34,197,94,.15); color: var(--success); border-color: rgba(34,197,94,.3); }
.pipeline-step.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }

/* ── Car Wireframe ── */
.wireframe-wrap {
  position: relative; display: inline-block;
  user-select: none;
}
.wireframe-wrap svg { max-width: 100%; }
.damage-dot {
  cursor: pointer;
  fill: var(--danger);
  opacity: .85;
  transition: r .15s;
}
.damage-dot:hover { r: 10; }

/* ── Media Grid ── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.media-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  background: var(--bg-input);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .media-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.7);
  font-size: 10px; padding: 3px 6px; text-align: center;
}
.upload-slot {
  aspect-ratio: 1; border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; color: var(--text-3); cursor: pointer;
  transition: all var(--transition); font-size: 12px;
}
.upload-slot:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.upload-slot i { font-size: 24px; }

/* ── Inventory progress ── */
.stock-bar { height: 5px; border-radius: 99px; background: var(--bg-input); overflow: hidden; margin-top: 4px; }
.stock-bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.stock-ok   .stock-bar-fill { background: var(--success); }
.stock-low  .stock-bar-fill { background: var(--warning); }
.stock-crit .stock-bar-fill { background: var(--danger); }

/* ── Charts ── */
.chart-wrap { position: relative; }

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar  { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #topbar   { display: flex; }
  #content  { margin-left: 0; padding: 16px 14px 48px; padding-top: calc(var(--topbar-h) + 16px); }
  #sidebar-overlay.show { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header h1 { font-size: 18px; }
  .de-table { font-size: 12px; }
  .de-table thead th, .de-table tbody td { padding: 10px 10px; }
  .pipeline { gap: 2px; }
  .pipeline-step { padding: 5px 10px 5px 16px; font-size: 11px; }
}

/* ── Toasts ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.de-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 260px; max-width: 340px;
  font-size: 13px;
  animation: slideIn .2s ease;
}
.de-toast.success { border-left-color: var(--success); }
.de-toast.danger  { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-page);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
}
.login-logo {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; margin-bottom: 28px; text-align: center;
}
.login-logo .logo-mark {
  width: 52px; height: 52px;
  background: var(--accent);
  color: #000; font-weight: 800; font-size: 18px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p { color: var(--text-2); font-size: 13px; margin: 0; }

/* ═══════════════════════════════════════════════════════
   ADDITIONS — missing utility classes
   ═══════════════════════════════════════════════════════ */

/* Alert banners */
.alert-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-banner.success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #10b981; }
.alert-banner.danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #ef4444; }
.alert-banner.warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #f59e0b; }

/* data-table — alias for de-table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}
.data-table tfoot td {
  padding: 11px 12px;
  border-top: 2px solid var(--border);
}
.data-table tbody tr:hover { background: var(--bg-3); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* table-wrap — scrollable table container */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Badge status pills */
.badge-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.status-inbound    { background: rgba(99,102,241,.15);  color: #818cf8; }
.status-washing    { background: rgba(59,130,246,.15);  color: #60a5fa; }
.status-polishing  { background: rgba(245,158,11,.15);  color: #fbbf24; }
.status-coating    { background: rgba(168,85,247,.15);  color: #c084fc; }
.status-curing     { background: rgba(236,72,153,.15);  color: #f472b6; }
.status-qc         { background: rgba(239,68,68,.15);   color: #f87171; }
.status-ready      { background: rgba(16,185,129,.15);  color: #34d399; }
.status-delivered  { background: rgba(107,114,128,.15); color: #9ca3af; }
.status-cancelled  { background: rgba(239,68,68,.1);    color: #6b7280; }

/* Mono utility */
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }

/* btn-sm */
.btn-sm { padding: 4px 10px !important; font-size: 12px !important; }

/* Stat card - ensure consistent */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--text-1); line-height: 1.1; }

/* Avatar circle utility */
.avatar-circle {
  width: 52px; height: 52px; min-width: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
