/* Google Fonts removed — using system font stack for offline compatibility */

/* ═══════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Light / Dark themes)
═══════════════════════════════════════════════ */
:root {
  --bg:            linear-gradient(145deg, #f0ecff 0%, #faf8ff 35%, #fff5f0 70%, #fffbf0 100%);
  --bg-solid:      #f5f3ff;
  --surface:       rgba(255,255,255,0.68);
  --surface-solid: #ffffff;
  --surface-hover: rgba(255,255,255,0.88);
  --border:        rgba(255,255,255,0.75);
  --border-muted:  rgba(160,130,220,0.18);
  --text:          #1e1a2e;
  --text-sec:      #5a5080;
  --text-muted:    #9591b0;
  --primary:       #f97316;
  --primary-dk:    #ea580c;
  --primary-grad:  linear-gradient(135deg,#f97316,#ea580c);
  --accent:        #7c3aed;
  --accent-light:  #ede9fe;
  --success:       #10b981;
  --success-bg:    #d1fae5;
  --danger:        #ef4444;
  --danger-bg:     #fee2e2;
  --warning:       #f59e0b;
  --warning-bg:    #fef3c7;
  --shadow-xs:     0 1px 4px rgba(124,58,237,.06);
  --shadow-sm:     0 4px 16px rgba(124,58,237,.09);
  --shadow-md:     0 8px 32px rgba(124,58,237,.12);
  --shadow-lg:     0 20px 60px rgba(124,58,237,.16);
  --shadow-glow:   0 0 20px rgba(249,115,22,.3);
  --radius:        14px;
  --radius-sm:     8px;
  --radius-xs:     6px;
  --blur:          blur(18px);
  --sidebar-w:     248px;
  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:            linear-gradient(145deg,#0c0820 0%,#130d2a 40%,#1a0c1e 100%);
  --bg-solid:      #0c0820;
  --surface:       rgba(255,255,255,0.04);
  --surface-solid: #160f2e;
  --surface-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.07);
  --border-muted:  rgba(124,58,237,0.22);
  --text:          #f0eeff;
  --text-sec:      #a89ece;
  --text-muted:    #6b628e;
  --accent-light:  rgba(124,58,237,0.15);
  --shadow-xs:     0 1px 4px rgba(0,0,0,.3);
  --shadow-sm:     0 4px 16px rgba(0,0,0,.35);
  --shadow-md:     0 8px 32px rgba(0,0,0,.45);
  --shadow-lg:     0 20px 60px rgba(0,0,0,.55);
  --success-bg:    rgba(16,185,129,.12);
  --danger-bg:     rgba(239,68,68,.12);
  --warning-bg:    rgba(245,158,11,.12);
}

/* ═══════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}
body.lang-ur { font-family: 'Noto Nastaliq Urdu', serif; direction: rtl; }
body.lang-ur .sidebar nav { direction: rtl; }
body.lang-ur .topbar { flex-direction: row-reverse; }
a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════════
   LUCIDE ICONS
═══════════════════════════════════════════════ */
.icon, [data-lucide] {
  display: inline-block;
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 28px; height: 28px; }
.nav-icon-svg { width: 17px; height: 17px; opacity: .85; }
.stat-icon-svg { width: 22px; height: 22px; }

/* ═══════════════════════════════════════════════
   CRYSTAL GEM (Rive-style animated logo)
═══════════════════════════════════════════════ */
@keyframes gemGlow {
  0%,100% { filter: drop-shadow(0 0 8px rgba(249,115,22,.6)) drop-shadow(0 0 20px rgba(124,58,237,.2)); }
  50%      { filter: drop-shadow(0 0 14px rgba(124,58,237,.7)) drop-shadow(0 0 30px rgba(249,115,22,.3)); }
}
@keyframes gemPulse {
  0%,100% { transform: scale(1) rotate(0deg); }
  25%     { transform: scale(1.06) rotate(2deg); }
  75%     { transform: scale(.96) rotate(-2deg); }
}
@keyframes gemShimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.crystal-gem {
  width: 46px; height: 46px; margin-bottom: 10px;
  position: relative; cursor: default;
}
.crystal-gem .gem-shape {
  width: 46px; height: 46px;
  background: linear-gradient(135deg,#f97316 0%,#ec4899 45%,#7c3aed 100%);
  background-size: 200% 200%;
  clip-path: polygon(50% 0%,100% 38%,82% 100%,18% 100%,0% 38%);
  animation: gemGlow 2.8s ease-in-out infinite, gemPulse 4s ease-in-out infinite;
}
.crystal-gem .gem-shine {
  position: absolute; top: 6px; left: 14px;
  width: 12px; height: 8px;
  background: rgba(255,255,255,.6);
  border-radius: 50% 50% 0 0;
  clip-path: polygon(30% 0%,70% 0%,100% 100%,0% 100%);
  animation: gemGlow 2.8s ease-in-out infinite reverse;
}

/* ═══════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════ */
.layout { display: flex; min-height: 100vh; position: relative; }
.layout::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% 20%, rgba(124,58,237,.06) 0%, transparent 60%),
    radial-gradient(ellipse 400px 300px at 90% 80%, rgba(249,115,22,.05) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--border-muted);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}
.brand {
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border-muted);
  background: linear-gradient(180deg,rgba(249,115,22,.04) 0%,transparent 100%);
}
.brand-title {
  font-size: 19px; font-weight: 800; color: var(--primary);
  background: var(--primary-grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-sub {
  font-size: 10px; font-weight: 700; color: var(--text-sec);
  letter-spacing: 1px; margin-top: 1px; text-transform: uppercase;
}
.brand-tag {
  font-size: 9px; color: var(--text-muted); letter-spacing: .5px; margin-top: 1px;
}
.sidebar nav {
  flex: 1; overflow-y: auto; padding: 10px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar nav a {
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-sec);
  display: flex; align-items: center; gap: 10px;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.sidebar nav a::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg,rgba(249,115,22,.12),rgba(124,58,237,.06));
  opacity: 0; transition: opacity var(--transition); border-radius: var(--radius-sm);
}
.sidebar nav a:hover { color: var(--primary); transform: translateX(3px); }
.sidebar nav a:hover::before { opacity: 1; }
.sidebar nav a.active {
  color: var(--primary); font-weight: 700;
  background: linear-gradient(135deg,rgba(249,115,22,.14),rgba(124,58,237,.07));
}
.sidebar nav a.active::after {
  content: ''; position: absolute; right: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--primary-grad); border-radius: 3px 0 0 3px;
}
.sidebar-footer {
  padding: 14px 18px; border-top: 1px solid var(--border-muted);
  font-size: 11px; color: var(--text-muted);
  background: rgba(124,58,237,.02);
}

/* ── Content area ── */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border-muted);
  padding: 13px 24px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition);
}
.topbar h1 { font-size: 17px; font-weight: 700; color: var(--text); margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-sec); }
.page { padding: 24px; flex: 1; }

/* ═══════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════ */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid transparent;
  animation: fadeInUp .3s ease both;
  backdrop-filter: var(--blur);
}
.alert-success { background: var(--success-bg); color: #065f46; border-color: rgba(16,185,129,.2); }
.alert-error   { background: var(--danger-bg);  color: #991b1b; border-color: rgba(239,68,68,.2);  }
[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-error   { color: #fca5a5; }

/* ═══════════════════════════════════════════════
   CARDS (Glassmorphism)
═══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition), transform var(--transition);
  position: relative; overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.6),transparent);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.card-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* ═══════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; }
th {
  color: var(--text-muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-muted);
}
td { padding: 11px 12px; font-size: 13.5px; border-bottom: 1px solid var(--border-muted); color: var(--text); }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-grad); color: #fff;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: none; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(249,115,22,.25);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(249,115,22,.4); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-secondary {
  background: var(--surface-hover); color: var(--text);
  border: 1px solid var(--border-muted);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface); box-shadow: var(--shadow-sm); }
.btn-danger  { background: linear-gradient(135deg,#ef4444,#dc2626); box-shadow: 0 2px 8px rgba(239,68,68,.25); }
.btn-danger:hover  { box-shadow: 0 6px 20px rgba(239,68,68,.4); }
.btn-green  { background: linear-gradient(135deg,#10b981,#059669); box-shadow: 0 2px 8px rgba(16,185,129,.25); }
.btn-green:hover  { box-shadow: 0 6px 20px rgba(16,185,129,.4); }
.btn-blue   { background: linear-gradient(135deg,#3b82f6,#2563eb); color:#fff; box-shadow: 0 2px 8px rgba(59,130,246,.25); }
.btn-blue:hover   { box-shadow: 0 6px 20px rgba(59,130,246,.4); }
.btn-ghost  { background: transparent; color: var(--text-sec); border: 1px solid var(--border-muted); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-hover); }
.actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.badge-green  { background: var(--success-bg); color: #065f46; }
.badge-yellow { background: var(--warning-bg);  color: #92400e; }
.badge-red    { background: var(--danger-bg);   color: #991b1b; }
.badge-gray   { background: var(--surface-hover); color: var(--text-sec); border: 1px solid var(--border-muted); }
.badge-orange { background: rgba(249,115,22,.1); color: #c2410c; }
.badge-purple { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .badge-green  { color: #6ee7b7; }
[data-theme="dark"] .badge-yellow { color: #fcd34d; }
[data-theme="dark"] .badge-red    { color: #fca5a5; }

@keyframes pulseBadge {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50%      { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}
.badge-red.pulse { animation: pulseBadge 1.8s ease infinite; }

form.inline { display: inline; }

/* ═══════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.full, .form-group.full { grid-column: 1 / -1; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px;
  color: var(--text-sec); text-transform: uppercase; letter-spacing: .3px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 13px;
  background: var(--surface-hover);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm); font-size: 13.5px;
  font-family: inherit; color: var(--text);
  transition: all var(--transition);
  backdrop-filter: var(--blur);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,.14);
  background: var(--surface-solid);
}
.form-group textarea { min-height: 72px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════
   STATS GRID
═══════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: all var(--transition); cursor: default;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.7),transparent);
}
.stat-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg,rgba(249,115,22,.03),rgba(124,58,237,.03));
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
  display: flex; align-items: center; gap: 6px;
}
.stat-card .value {
  font-size: 26px; font-weight: 800; color: var(--text);
  margin-top: 8px; letter-spacing: -.5px;
}

/* ═══════════════════════════════════════════════
   THEME & LANGUAGE TOGGLES
═══════════════════════════════════════════════ */
.topbar-controls { display: flex; align-items: center; gap: 8px; }
.toggle-pill {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface-hover); border: 1px solid var(--border-muted);
  border-radius: 999px; padding: 3px;
}
.toggle-btn {
  padding: 5px 11px; border-radius: 999px; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-muted);
  font-family: inherit; transition: all var(--transition);
  display: flex; align-items: center; gap: 5px;
}
.toggle-btn.active {
  background: var(--primary-grad); color: #fff;
  box-shadow: 0 2px 8px rgba(249,115,22,.35);
}
.theme-toggle-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--border-muted);
  background: var(--surface-hover); cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: var(--text-sec);
  transition: all var(--transition); font-family: inherit;
}
.theme-toggle-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════════
   PARTS E-COMMERCE GRID
═══════════════════════════════════════════════ */
.parts-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.parts-search-wrap { position: relative; flex: 1; min-width: 200px; }
.parts-search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; width:15px;height:15px; }
.parts-search {
  width: 100%; padding: 10px 14px 10px 36px;
  background: var(--surface-hover); border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit;
  color: var(--text); transition: all var(--transition);
}
.parts-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,115,22,.14); }
.parts-filter-sel {
  padding: 10px 14px; background: var(--surface-hover);
  border: 1px solid var(--border-muted); border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit; color: var(--text); cursor: pointer;
}
.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.part-card {
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: all var(--transition); display: flex; flex-direction: column;
}
.part-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(249,115,22,.25); }
.part-card-img {
  width: 100%; height: 158px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,rgba(249,115,22,.07),rgba(124,58,237,.07));
  flex-shrink: 0; overflow: hidden;
}
.part-card-img img { width: 100%; height: 100%; object-fit: cover; }
.part-card-img.placeholder { color: var(--text-muted); }
.part-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.part-card-cat { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.part-card-name { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.part-card-price { font-size: 19px; font-weight: 800; color: var(--primary); letter-spacing: -.3px; }
.part-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-muted); }
.part-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.part-card-sold { font-size: 11px; color: var(--text-muted); }
.part-card-sold strong { color: var(--text-sec); }

/* Stock bar */
.stock-bar-wrap { margin-top: 4px; }
.stock-bar-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; display: flex; justify-content: space-between; }
.stock-bar { height: 4px; background: var(--border-muted); border-radius: 3px; overflow: hidden; }
.stock-bar-fill { height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.4,0,.2,1); }
.stock-bar-fill.high { background: linear-gradient(90deg,#10b981,#059669); }
.stock-bar-fill.med  { background: linear-gradient(90deg,#f59e0b,#d97706); }
.stock-bar-fill.low  { background: linear-gradient(90deg,#ef4444,#dc2626); }

.parts-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.parts-empty .empty-icon { font-size: 52px; margin-bottom: 12px; opacity: .5; }

/* ═══════════════════════════════════════════════
   IMAGE UPLOAD
═══════════════════════════════════════════════ */
.img-upload-area {
  border: 2px dashed var(--border-muted);
  border-radius: var(--radius-sm); padding: 28px;
  text-align: center; cursor: pointer;
  transition: all var(--transition); position: relative;
  background: rgba(124,58,237,.02);
}
.img-upload-area:hover, .img-upload-area.drag { border-color: var(--primary); background: rgba(249,115,22,.04); }
.img-upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.img-upload-icon { color: var(--text-muted); margin-bottom: 8px; }
.img-upload-text { font-size: 13px; color: var(--text-muted); }
.img-upload-text strong { color: var(--primary); }
.img-preview { width: 100%; max-height: 160px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 10px; display: none; }

/* ═══════════════════════════════════════════════
   INVOICE / PARTS PICKER
═══════════════════════════════════════════════ */
.parts-picker {
  border: 1px solid var(--border-muted); border-radius: var(--radius-sm);
  padding: 14px; background: rgba(124,58,237,.02); margin-bottom: 14px;
}
.parts-picker-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text-sec); display: flex; align-items: center; gap: 6px; }
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(155px,1fr));
  gap: 8px; max-height: 220px; overflow-y: auto; padding: 2px;
}
.picker-item {
  border: 1px solid var(--border-muted); border-radius: var(--radius-sm);
  padding: 10px; background: var(--surface-hover); cursor: pointer;
  transition: all var(--transition); display: flex; flex-direction: column; gap: 3px;
}
.picker-item:hover  { border-color: var(--primary); background: rgba(249,115,22,.06); }
.picker-item.selected { border-color: var(--primary); background: rgba(249,115,22,.08); }
.pi-name  { font-size: 12.5px; font-weight: 600; color: var(--text); }
.pi-price { font-size: 12px; color: var(--primary); font-weight: 700; }
.pi-stock { font-size: 11px; color: var(--text-muted); }
.pi-oos   { color: var(--danger); font-weight: 600; }

/* ═══════════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════════ */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: var(--bg); background-attachment: fixed;
}
.login-card {
  background: var(--surface);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  padding: 40px 36px; border-radius: 20px;
  width: 360px; box-shadow: var(--shadow-lg);
  animation: popIn .5s cubic-bezier(.4,0,.2,1) both;
}
.login-card h2 {
  text-align: center; font-size: 22px; font-weight: 800;
  background: var(--primary-grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 4px;
}
.login-card p.sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-gem { display: flex; justify-content: center; margin-bottom: 8px; }

/* ═══════════════════════════════════════════════
   MISC
═══════════════════════════════════════════════ */
.text-muted  { color: var(--text-muted); }
.link-btn    { color: var(--primary); font-weight: 600; transition: color var(--transition); }
.link-btn:hover { color: var(--primary-dk); }
.empty { color: var(--text-muted); padding: 32px 0; text-align: center; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.section-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; }
.section-divider span { font-size: 13px; font-weight: 700; color: var(--text-sec); white-space: nowrap; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-muted); }
.invoice-print-btn { background: linear-gradient(135deg,#1e1a2e,#0f0820); }

/* ═══════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.88); }
  70%  { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes countUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.page > * { animation: fadeInUp .4s ease both; }
.page > *:nth-child(2) { animation-delay: .07s; }
.page > *:nth-child(3) { animation-delay: .13s; }
.page > *:nth-child(4) { animation-delay: .18s; }

.stats-grid .stat-card { animation: popIn .42s cubic-bezier(.4,0,.2,1) both; }
.stats-grid .stat-card:nth-child(1) { animation-delay: .00s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: .06s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: .12s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: .18s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: .24s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: .30s; }
.stats-grid .stat-card:nth-child(7) { animation-delay: .36s; }
.stats-grid .stat-card:nth-child(8) { animation-delay: .42s; }

.sidebar nav a { animation: slideInLeft .32s ease both; }
.sidebar nav a:nth-child(1)  { animation-delay: .00s; }
.sidebar nav a:nth-child(2)  { animation-delay: .04s; }
.sidebar nav a:nth-child(3)  { animation-delay: .07s; }
.sidebar nav a:nth-child(4)  { animation-delay: .10s; }
.sidebar nav a:nth-child(5)  { animation-delay: .13s; }
.sidebar nav a:nth-child(6)  { animation-delay: .16s; }
.sidebar nav a:nth-child(7)  { animation-delay: .19s; }
.sidebar nav a:nth-child(8)  { animation-delay: .22s; }
.sidebar nav a:nth-child(9)  { animation-delay: .25s; }
.sidebar nav a:nth-child(10) { animation-delay: .28s; }

.part-card { animation: fadeInUp .38s ease both; }
.part-card:nth-child(1)  { animation-delay: .00s; }
.part-card:nth-child(2)  { animation-delay: .05s; }
.part-card:nth-child(3)  { animation-delay: .09s; }
.part-card:nth-child(4)  { animation-delay: .13s; }
.part-card:nth-child(5)  { animation-delay: .17s; }
.part-card:nth-child(6)  { animation-delay: .21s; }

/* ═══════════════════════════════════════════════
   MENU TOGGLE
═══════════════════════════════════════════════ */
.menu-toggle {
  display: none; background: var(--surface-hover); border: 1px solid var(--border-muted);
  border-radius: var(--radius-sm); width: 38px; height: 38px;
  align-items: center; justify-content: center; cursor: pointer; color: var(--text-sec);
  flex-shrink: 0;
}
.menu-toggle:hover { background: var(--accent-light); color: var(--accent); }
.sidebar-overlay { display: none; }

/* ═══════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .no-print, .form-actions { display: none !important; }
  .page { padding: 0; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; background: #fff; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet wide (≤1100px)
═══════════════════════════════════════════════ */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet / Mobile (≤860px)
═══════════════════════════════════════════════ */
@media (max-width: 860px) {
  /* Layout */
  .layout { flex-direction: column; }
  .content { min-width: 0; overflow-x: hidden; }

  /* Topbar */
  .topbar { padding: 10px 14px; gap: 8px; flex-wrap: nowrap; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
  .menu-toggle { display: flex; }

  /* Sidebar drawer */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    width: 265px; max-width: 86vw; z-index: 1000;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 999;
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  }
  .sidebar-overlay.open { display: block; }

  /* Page padding */
  .page { padding: 12px; }

  /* Cards */
  .card { padding: 14px; border-radius: 12px; overflow-x: auto; }

  /* Tables — horizontal scroll inside card */
  table { width: 100%; min-width: 520px; border-collapse: collapse; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid.cols3 { grid-template-columns: 1fr; }

  /* Stats — 2 columns on tablet */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px 16px; }
  .stat-card .value { font-size: 22px; }

  /* Parts grid */
  .parts-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }

  /* Login */
  .login-card { width: calc(100vw - 32px); max-width: 400px; padding: 28px 22px; }

  /* Actions bar */
  .actions-bar { gap: 8px; }
  .topbar-controls { gap: 5px; }

  /* Picker */
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Small mobile (≤540px)
═══════════════════════════════════════════════ */
@media (max-width: 540px) {
  .topbar { padding: 9px 10px; }
  .topbar h1 { font-size: 14px; max-width: 34vw; }
  .topbar-user > span { display: none; }
  .brand { padding: 16px 14px; }
  .page { padding: 10px; }
  .card { padding: 12px; }

  /* Stats — still 2 cols, smaller */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card .value { font-size: 20px; }

  /* Buttons */
  .btn { padding: 8px 13px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 11.5px; }

  /* Actions bar stacks */
  .actions-bar { flex-direction: column; align-items: stretch; }
  .actions-bar .btn, .actions-bar form .btn { width: 100%; justify-content: center; }
  .actions-bar .parts-search-wrap { min-width: unset; width: 100%; }

  /* Form actions */
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* Parts */
  .parts-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .part-card-img { height: 110px; }
  .parts-toolbar { flex-direction: column; align-items: stretch; }
  .parts-search-wrap { min-width: unset; }
  .parts-filter-sel { width: 100%; }

  /* Language toggle hidden — save space */
  .toggle-pill { display: none; }

  /* Topbar user */
  .topbar-user { gap: 6px; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Very small (≤380px)
═══════════════════════════════════════════════ */
@media (max-width: 380px) {
  .topbar h1 { font-size: 13px; max-width: 28vw; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .stat-card { padding: 12px; }
  .stat-card .value { font-size: 18px; }
  .parts-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .page { padding: 8px; }
  .card { padding: 10px; }
}
