/* ─────────────────────────────────────────
   TyreShop Pro — Master Stylesheet
   ───────────────────────────────────────── */

/* ── Variables ── */
:root {
  --sidebar-w: 240px;
  --topbar-h: 60px;

  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active-bg: rgba(249,115,22,.12);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f97316;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;

  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-light: rgba(249,115,22,.1);

  --success: #22c55e;
  --success-bg: #dcfce7;
  --success-text: #166534;

  --warning: #f59e0b;
  --warning-bg: #fef9c3;
  --warning-text: #854d0e;

  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;

  --info: #3b82f6;
  --info-bg: #dbeafe;
  --info-text: #1e40af;

  --purple: #a855f7;
  --purple-bg: #f3e8ff;
  --purple-text: #6b21a8;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);

  --transition: .18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Layout ── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.mobile-hidden { transform: translateX(-100%); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--topbar-h);
  white-space: nowrap;
  overflow: hidden;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  flex-shrink: 0;
}
.brand-name { font-size: 16px; font-weight: 700; color: #fff; }
.brand-sub {
  font-size: 11px; font-weight: 500;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px; border-radius: 4px;
  margin-left: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(148,163,184,.5);
  padding: 12px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .nav-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); }
.nav-item i { font-size: 15px; width: 18px; flex-shrink: 0; text-align: center; }
.nav-item span { font-size: 13.5px; font-weight: 500; }
.sidebar.collapsed .nav-item span { display: none; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.ver-badge { font-size: 11px; color: rgba(148,163,184,.4); }

/* ── Main Wrapper ── */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-wrapper { margin-left: 64px; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.page-title { font-size: 17px; font-weight: 600; color: var(--text); }
.topbar-date { font-size: 12.5px; color: var(--text-muted); }
.biz-badge {
  font-size: 12px; font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px; border-radius: 20px;
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.loading-screen {
  display: flex; align-items: center; justify-content: center;
  height: 200px; font-size: 24px; color: var(--text-light);
}

/* ── Page Headers ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── KPI Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}
.stat-icon-wrap {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon-orange { background: var(--primary-light); color: var(--primary); }
.stat-icon-green  { background: var(--success-bg);    color: var(--success); }
.stat-icon-red    { background: var(--danger-bg);     color: var(--danger); }
.stat-icon-blue   { background: var(--info-bg);       color: var(--info); }
.stat-icon-purple { background: var(--purple-bg);     color: var(--purple); }
.stat-icon-amber  { background: var(--warning-bg);    color: var(--warning); }

.stat-info { flex: 1; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-sub { font-size: 11.5px; color: var(--text-light); margin-top: 6px; }

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }

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

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.data-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(249,115,22,.03); }
.empty-row td { text-align: center; color: var(--text-muted); padding: 40px; font-size: 13px; }

/* ── Filters / Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 200px; max-width: 320px;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  position: relative;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 13px; }
.search-wrap .search-input { width: 100%; }
.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  padding: 6px 8px; font-size: 13px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

.icon-btn {
  width: 36px; height: 36px;
  background: transparent; border: none;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 15px;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ── Badges / Status ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge-paid     { background: var(--success-bg); color: var(--success-text); }
.badge-pending  { background: var(--warning-bg); color: var(--warning-text); }
.badge-partial  { background: var(--info-bg);    color: var(--info-text); }
.badge-overdue  { background: var(--danger-bg);  color: var(--danger-text); }
.badge-draft    { background: var(--bg);          color: var(--text-muted); }
.badge-active   { background: var(--success-bg); color: var(--success-text); }
.badge-inactive { background: var(--bg);          color: var(--text-muted); }
.badge-low      { background: var(--warning-bg); color: var(--warning-text); }
.badge-critical { background: var(--danger-bg);  color: var(--danger-text); }
.badge-tyre     { background: #fef3c7; color: #92400e; }
.badge-rim      { background: #ede9fe; color: #4c1d95; }
.badge-service  { background: var(--info-bg);    color: var(--info-text); }
.badge-accessory{ background: #f0fdf4; color: #14532d; }

/* ── Plate Badge ── */
.plate-badge {
  display: inline-block;
  background: #fde047;
  color: #111827;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  font-size: 14px;
  padding: 2px 11px;
  border-radius: 4px;
  border: 2px solid #1e293b;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.required::after { content: ' *'; color: var(--danger); }
.form-control {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: 11.5px; color: var(--text-light); }
.form-error { font-size: 11.5px; color: var(--danger); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 76px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-addon {
  padding: 8px 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex; align-items: center;
}

/* ── Search Select / Combobox ── */
.ss-wrap { position: relative; }
.ss-dropdown {
  display: none;
  position: fixed;
  z-index: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
}
.ss-dropdown.open { display: block; }
.ss-item { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.ss-item:hover, .ss-item.active { background: var(--primary-light); }
.ss-item-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ss-item-action { border-top: 1px solid var(--border); color: var(--primary); font-weight: 600; }
.ss-item-action i { margin-right: 6px; }
.ss-empty { padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); }

/* ── Sections / Dividers ── */
.section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(2px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .18s ease;
}
.modal.modal-lg { max-width: 780px; }
.modal.modal-xl { max-width: 1000px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}

/* ── Inline Items Table (Invoice Builder) ── */
.items-table-wrap { overflow-x: auto; }
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.items-table th {
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.items-table td {
  padding: 6px 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
}
.items-table .form-control { padding: 5px 8px; font-size: 12.5px; }

/* ── Totals Block ── */
.totals-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.total-row { display: flex; gap: 24px; justify-content: flex-end; font-size: 13px; }
.total-row.grand { font-size: 16px; font-weight: 700; color: var(--primary); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; width: 100%; }
.total-label { color: var(--text-muted); min-width: 100px; text-align: right; }
.total-val { min-width: 100px; text-align: right; font-weight: 500; }

/* ── Toast ── */
#toastContainer {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 260px; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn .2s ease;
}
.toast.removing { animation: toastOut .2s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform:none; } }
@keyframes toastOut { to   { opacity:0; transform: translateX(20px); } }
.toast-icon { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--info); }
.toast-msg { font-size: 13px; line-height: 1.4; }

/* ── Tabs ── */
.tab-bar {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 16px;
  font-size: 13px; font-weight: 500;
  background: none; border: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--text); }

/* ── Alert / Info Boxes ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.alert-info    { background: var(--info-bg);    color: var(--info-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.alert-success { background: var(--success-bg); color: var(--success-text); }

/* ── Detail View ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item {}
.detail-item .label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-light); margin-bottom: 3px; }
.detail-item .value { font-size: 14px; color: var(--text); }

/* ── Low Stock Highlight ── */
tr.low-stock td { background: rgba(245,158,11,.06); }
tr.critical-stock td { background: rgba(239,68,68,.06); }

/* ── Confirm Dialog ── */
.confirm-body { text-align: center; padding: 24px; }
.confirm-icon { font-size: 48px; margin-bottom: 12px; }
.confirm-msg { font-size: 15px; color: var(--text); }
.confirm-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ── Print Styles ── */
@media print {
  body * { visibility: hidden; }
  #printContent, #printContent * { visibility: visible; }
  #printContent {
    position: fixed;
    inset: 0;
    background: #fff;
    padding: 24px 32px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #000;
  }
  .no-print { display: none !important; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: none; }
  .main-wrapper { margin-left: 0 !important; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-span-2 { grid-column: span 1; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ── Utility ── */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.text-sm { font-size: 12px; }

/* ── Customer Detail Tabs ── */
.history-section { margin-top: 24px; }

/* ── E-Invoice badges ── */
.ei-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ei-badge--none      { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.ei-badge--generated { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.ei-badge--submitted { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
.ei-badge--valid     { background: var(--success-bg); color: var(--success-text); border: 1px solid #86efac; }
.ei-badge--rejected  { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid #fca5a5; }
.ei-badge--cancelled { background: var(--surface2);   color: var(--text-muted);   border: 1px solid var(--border); }

/* ── Reports ── */
.report-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.report-card {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.report-card .val { font-size: 20px; font-weight: 700; margin-top: 4px; }
.report-card .lbl { font-size: 12px; color: var(--text-muted); }

/* ── AI Rim Visualiser ── */
.vis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) { .vis-grid { grid-template-columns: 1fr; } }

.vis-action-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition);
  padding: 16px;
  text-align: center;
}
.drop-zone:hover        { border-color: var(--primary); }
.drop-zone--filled      { border-style: solid; border-color: var(--border); padding: 8px; }
.drop-zone__img         { max-width: 100%; max-height: 240px; border-radius: 8px; object-fit: contain; }
.drop-zone__hint        { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
}

.rim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.rim-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  text-align: center;
}
.rim-card:hover           { border-color: var(--primary); }
.rim-card--selected       { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.18); }
.rim-card__img            { width: 100%; height: 88px; object-fit: cover; border-radius: 4px; }
.rim-card__placeholder    {
  width: 100%; height: 88px;
  background: var(--surface2);
  border-radius: 4px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted); gap: 4px; font-size: 20px;
}
.rim-card__label          { margin-top: 6px; }
.rim-card__check {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px;
  background: var(--primary); color: #fff;
  border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  font-size: 10px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ── Auth Screen ── */
.auth-screen {
  display: none;
  position: fixed; inset: 0;
  z-index: 1000;
  align-items: center; justify-content: center;
  background: var(--sidebar-bg);
  padding: 16px;
}
.auth-screen.open { display: flex; }
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 360px;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}
.auth-brand-text { font-size: 18px; font-weight: 700; color: var(--text); }
.auth-brand-text span { color: var(--primary); }
.auth-title { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 20px; }
.auth-screen form { display: flex; flex-direction: column; gap: 14px; }
.auth-error { font-size: 12.5px; color: var(--danger); min-height: 16px; }
.auth-submit { justify-content: center; width: 100%; }

/* ── User Badge (topbar) ── */
.user-badge {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px; border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.user-badge .role-root  { color: var(--primary); }
.user-badge .role-staff { color: var(--info); }
