/* ============================================================
   Euro Parts Pro - Professional Parts Catalog
   Dark Theme with Gold Accents
   ============================================================ */

:root {
  /* Core Colors */
  --bg-primary: #0d0d0d;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --bg-card: #141414;
  --bg-hover: #1e1e1e;
  --bg-input: #1a1a1a;

  /* Gold Accent */
  --gold: #D4A843;
  --gold-light: #E8C56D;
  --gold-dark: #B89038;
  --gold-bg: rgba(212, 168, 67, 0.12);
  --gold-border: rgba(212, 168, 67, 0.35);

  /* Text */
  --text-primary: #f5f5f5;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --text-on-gold: #0d0d0d;

  /* Borders */
  --border-subtle: #2a2a2a;
  --border-default: #333333;
  --border-focus: var(--gold);

  /* Status Colors */
  --success: #2ecc71;
  --success-bg: rgba(46, 204, 113, 0.12);
  --warning: #f39c12;
  --warning-bg: rgba(243, 156, 18, 0.12);
  --danger: #e74c3c;
  --danger-bg: rgba(231, 76, 60, 0.12);
  --info: #3498db;
  --info-bg: rgba(52, 152, 219, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.6);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-sidebar: 300;
  --z-header: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-image-viewer: 700;

  /* Layout */
  --header-height: 56px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --mobile-nav-height: 64px;
}

/* ============================================================
   Reset & Base
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--gold-bg);
}

input::placeholder {
  color: var(--text-muted);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

::selection {
  background: var(--gold);
  color: var(--text-on-gold);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* ============================================================
   Typography
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.page-title { font-size: 1.5rem; font-weight: 600; }
.page-sub { color: var(--text-secondary); font-size: 0.875rem; margin-top: 2px; }

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }

/* ============================================================
   Layout Containers
   ============================================================ */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
.screen.active { display: flex; }

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================================================
   Header
   ============================================================ */

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-lg);
  max-width: 100%;
  margin: 0 auto;
  gap: var(--space-md);
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-center { flex: 1; max-width: 600px; }

.brand-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.logo-mini {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: var(--text-on-gold);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.brand-sub { font-size: 0.625rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Search */
.search-container { position: relative; width: 100%; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted); pointer-events: none;
}
#global-search-input {
  width: 100%; padding: 10px 12px 10px 44px;
  background: var(--bg-input); border: 1px solid var(--border-default);
  border-radius: var(--radius-pill); font-size: 0.875rem;
  transition: all var(--transition-fast);
}
#global-search-input:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--space-sm); z-index: var(--z-dropdown);
  max-height: 300px; overflow-y: auto;
}
.search-results.hidden { display: none; }

/* Header Actions */
.btn-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 20px; height: 20px; }

/* Notifications */
.notification-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  background: var(--danger); color: white;
  font-size: 0.625rem; font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 0 5px; display: flex; align-items: center; justify-content: center;
}
.notification-badge.hidden { display: none; }

/* User Menu */
.user-menu { position: relative; }
.user-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 50%; color: var(--text-on-gold);
  font-weight: 700; font-size: 0.75rem;
  transition: transform var(--transition-fast);
}
.user-avatar:hover { transform: scale(1.05); }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--space-sm); z-index: var(--z-dropdown);
}
.user-dropdown.hidden { display: none; }

.user-info { padding: var(--space-sm) 0; }
.user-name { font-weight: 600; font-size: 0.875rem; }
.user-role { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }

.dropdown-divider { height: 1px; background: var(--border-subtle); margin: var(--space-sm) 0; }

.dropdown-item {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 10px 12px; border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 0.875rem;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { width: 18px; height: 18px; }

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: fixed; top: var(--header-height); left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-sidebar);
  display: flex; flex-direction: column;
  transition: transform var(--transition-normal);
  overflow-y: auto;
}

.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-nav { padding: var(--space-md); flex: 1; overflow-y: auto; }

.nav-section { margin-bottom: var(--space-lg); }
.nav-section-title {
  font-size: 0.625rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  padding: 0 var(--space-sm); margin-bottom: var(--space-sm);
}

.nav-item {
  display: flex; align-items: center; gap: var(--space-md);
  padding: 10px 12px; border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition-fast);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--gold-bg); color: var(--gold); border-left: 3px solid var(--gold); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.category-nav-list { display: flex; flex-direction: column; gap: 2px; }
.category-nav-item {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.8125rem;
  transition: all var(--transition-fast);
}
.category-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.category-nav-item .icon { font-size: 1rem; width: 20px; text-align: center; }

/* ============================================================
   Mobile Navigation
   ============================================================ */

.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-height);
  background: rgba(20, 20, 20, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-subtle);
  z-index: var(--z-header);
}

.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; padding: var(--space-xs) 0; gap: 2px;
  color: var(--text-muted); font-size: 0.625rem; font-weight: 500;
  transition: color var(--transition-fast);
}
.mobile-nav-item.active { color: var(--gold); }
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.more-btn { color: var(--text-secondary); }

@media (max-width: 768px) {
  .mobile-nav { display: flex; }
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .app-header { padding-left: var(--space-sm); padding-right: var(--space-sm); }
  .header-center { display: none; }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none; position: fixed; top: var(--header-height); left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: calc(var(--z-sidebar) - 1); opacity: 0;
  transition: opacity var(--transition-normal);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* ============================================================
   Main Content
   ============================================================ */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: var(--space-lg);
  min-height: calc(100vh - var(--header-height));
  transition: margin-left var(--transition-normal);
}

@media (max-width: 768px) {
  .main-content { margin-left: 0; padding: var(--space-md); padding-bottom: calc(var(--mobile-nav-height) + var(--space-md)); }
}

.container { max-width: 1400px; margin: 0 auto; width: 100%; }

/* ============================================================
   Cards & Stats
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover { border-color: var(--border-default); box-shadow: var(--shadow-md); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}
.stat-card:hover { border-color: var(--gold); box-shadow: var(--shadow-md); }
.stat-card.stat-gold .stat-value { color: var(--gold); }
.stat-card.stat-green .stat-value { color: var(--success); }
.stat-card.stat-red .stat-value { color: var(--danger); }

/* ============================================================
   Forms
   ============================================================ */

.field { margin-bottom: var(--space-md); }

.label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: var(--space-xs);
}

.input { width: 100%; }

.input-group { display: flex; gap: var(--space-sm); }
.input-group .input { flex: 1; }

textarea.input { min-height: 100px; resize: vertical; }

.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23808080' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-sm); padding: 10px 20px;
  font-size: 0.875rem; font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--text-on-gold); border: none;
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 16px var(--gold-bg); transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-hover); color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-tertiary); border-color: var(--gold); }

.btn-danger {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: white; }

.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--text-on-gold); }
.btn-dark { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-default); }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; }

/* ============================================================
   Tables
   ============================================================ */

.table-container { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-subtle); }
.data-table th { background: var(--bg-tertiary); font-weight: 600; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table td { color: var(--text-primary); }

.drow { cursor: pointer; }
.drow.sel { outline: 2px solid var(--gold); outline-offset: -2px; background: var(--gold-bg); }

.dthead { display: none; }
@media (min-width: 769px) { .dthead { display: table-header-group; } }

.dth { font-weight: 600; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 16px; background: var(--bg-tertiary); border-bottom: 1px solid var(--border-default); }

.dtc { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.dtc:last-child { border-right: none; }
.dtc[data-label]::before { content: attr(data-label); display: none; font-weight: 600; font-size: 0.625rem; color: var(--text-muted); margin-bottom: 4px; }
@media (max-width: 768px) {
  .dtc[data-label]::before { display: block; }
  .dthead { display: none; }
  .dtc { padding: 16px; border-bottom: 1px solid var(--border-subtle); }
  .drow { display: block; }
}

/* Stock Badges */
.pl-stock { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; }
.pl-stock-available { background: var(--success-bg); color: var(--success); }
.pl-stock-unavailable { background: var(--danger-bg); color: var(--danger); }
.pl-stock-on-order { background: var(--warning-bg); color: var(--warning); }

.pl-qty { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg-tertiary); border: 1px solid var(--border-default); font-size: 0.6875rem; font-weight: 700; color: var(--text-secondary); }

/* Part Name Display */
.p-name { font-weight: 500; color: var(--text-primary); }
.p-meta { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); }

/* Price Display */
.price-stack { display: flex; flex-direction: column; gap: 2px; }
.p-lkr { font-weight: 700; color: var(--text-primary); font-size: 0.875rem; }
.p-gbp { font-size: 0.6875rem; color: var(--text-muted); }

/* Actions */
.actions { white-space: nowrap; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--text-muted); background: transparent; transition: all var(--transition-fast); margin-right: 4px; }
.action-btn:hover { background: var(--bg-hover); color: var(--gold); }
.action-btn svg { width: 16px; height: 16px; }
.action-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }

/* Filter Chips */
.chip-rail { display: flex; flex-wrap: wrap; gap: 6px; padding: var(--space-sm) 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: var(--bg-tertiary); border: 1px solid var(--border-default);
  font-size: 0.75rem; color: var(--text-secondary); font-weight: 500;
  transition: all var(--transition-fast); cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.active { background: var(--gold-bg); border-color: var(--gold); color: var(--gold); }
.chip .icon { font-size: 0.75rem; }

.seg { display: flex; background: var(--bg-tertiary); border-radius: var(--radius-md); padding: 3px; }
.seg-btn { flex: 1; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 500; color: var(--text-secondary); background: transparent; transition: all var(--transition-fast); }
.seg-btn.active { background: var(--gold); color: var(--text-on-gold); }
.seg-btn:hover:not(.active) { color: var(--text-primary); }

/* Search */
.search-wrap { position: relative; }
.search-input { padding-left: 44px; }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); padding: 4px; display: flex; }
.search-clear:hover { color: var(--danger); }
.typeahead-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--space-xs); z-index: var(--z-dropdown); max-height: 250px; overflow-y: auto; }
.typeahead-results.hidden { display: none; }
.ta-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.8125rem; background: transparent; text-align: left; transition: background var(--transition-fast); }
.ta-item:hover { background: var(--bg-hover); }
.ta-kind { font-size: 0.625rem; color: var(--text-muted); text-transform: uppercase; }

/* Filter Summary */
.filter-summary { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) 0; font-size: 0.8125rem; color: var(--text-secondary); }
.summary-label { font-weight: 500; }
.clear-filters { padding: 6px 12px; border-radius: var(--radius-sm); background: var(--bg-tertiary); border: 1px solid var(--border-default); color: var(--text-secondary); font-size: 0.75rem; font-weight: 500; transition: all var(--transition-fast); }
.clear-filters:hover { border-color: var(--gold); color: var(--gold); }

/* ============================================================
   Modals
   ============================================================ */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--space-lg);
  opacity: 0; visibility: hidden; transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
.modal-overlay.visible { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); max-width: 500px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.95); transition: transform var(--transition-normal);
}
.modal-overlay.visible .modal { transform: scale(1); }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-lg); border-bottom: 1px solid var(--border-subtle); }
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close { color: var(--text-muted); transition: color var(--transition-fast); }
.modal-close:hover { color: var(--danger); }

.modal-body { padding: var(--space-lg); }
.modal-footer { display: flex; justify-content: flex-end; gap: var(--space-sm); padding: var(--space-lg); border-top: 1px solid var(--border-subtle); }

/* Image Viewer */
.image-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: var(--z-image-viewer);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
.image-viewer.visible { opacity: 1; visibility: visible; }
.image-viewer img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius-md); box-shadow: var(--shadow-xl); }
.image-viewer-close, .image-viewer-prev, .image-viewer-next {
  position: absolute; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: 50%;
  color: var(--text-primary); transition: all var(--transition-fast);
}
.image-viewer-close:hover, .image-viewer-prev:hover, .image-viewer-next:hover { background: var(--gold); color: var(--text-on-gold); border-color: var(--gold); }
.image-viewer-close { top: var(--space-lg); right: var(--space-lg); }
.image-viewer-prev { left: var(--space-lg); top: 50%; transform: translateY(-50%); }
.image-viewer-next { right: var(--space-lg); top: 50%; transform: translateY(-50%); }
.image-viewer-counter { position: absolute; bottom: var(--space-lg); left: 50%; transform: translateX(-50%); background: var(--bg-card); padding: 8px 16px; border-radius: var(--radius-pill); border: 1px solid var(--border-default); font-size: 0.75rem; color: var(--text-secondary); }

@media (max-width: 768px) {
  .image-viewer-close { top: 12px; right: 12px; width: 40px; height: 40px; }
  .image-viewer-prev, .image-viewer-next { display: none; }
  .image-viewer-counter { bottom: 12px; font-size: 0.6875rem; padding: 6px 12px; }
}

/* ============================================================
   Toast Notifications
   ============================================================ */

.toast-container { position: fixed; bottom: var(--space-lg); right: var(--space-lg); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-sm); }
.toast { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) var(--space-lg); background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 280px; max-width: 400px; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }
.toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.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-message { flex: 1; font-size: 0.8125rem; }

/* ============================================================
   Loading States
   ============================================================ */

.page-loading { display: flex; align-items: center; justify-content: center; padding: var(--space-2xl); color: var(--text-muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-subtle); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loading { display: none; }
.btn:disabled .btn-loading { display: inline; }
.btn:disabled .btn-text { display: none; }

.skeleton { background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   Empty States
   ============================================================ */

.empty-state { text-align: center; padding: var(--space-2xl); color: var(--text-secondary); }
.es-icon { width: 64px; height: 64px; margin: 0 auto var(--space-md); color: var(--text-muted); opacity: 0.5; }
.es-icon svg { width: 100%; height: 100%; }
.empty-state h3 { margin-bottom: var(--space-sm); color: var(--text-primary); }
.empty-state p { margin-bottom: var(--space-lg); max-width: 300px; margin-left: auto; margin-right: auto; }

/* ============================================================
   Login Page
   ============================================================ */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-lg); }
.login-card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-xl); padding: var(--space-xl); }
.login-logo { width: 64px; height: 64px; margin: 0 auto var(--space-lg); background: linear-gradient(135deg, var(--gold), var(--gold-light)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.login-logo svg { width: 32px; height: 32px; color: var(--text-on-gold); }
.login-title { text-align: center; margin-bottom: var(--space-xs); }
.login-sub { text-align: center; color: var(--text-secondary); margin-bottom: var(--space-xl); font-size: 0.875rem; }

.login-form { display: flex; flex-direction: column; gap: var(--space-md); }
#login-fields, #otp-fields { display: flex; flex-direction: column; gap: var(--space-md); }
#otp-fields.hidden { display: none; }
.form-error { color: var(--danger); font-size: 0.8125rem; text-align: center; min-height: 1.25rem; }
.form-error.hidden { display: none; }
.otp-hint { text-align: center; color: var(--text-secondary); font-size: 0.8125rem; margin-bottom: var(--space-md); }
.login-foot { text-align: center; margin-top: var(--space-lg); font-size: 0.75rem; color: var(--text-muted); }

/* ============================================================
   Page Headers
   ============================================================ */

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-lg); flex-wrap: wrap; gap: var(--space-md); }
.page-head h1 { font-size: 1.5rem; font-weight: 600; }

.quick-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
.quick-actions .btn { white-space: nowrap; }

/* ============================================================
   Part Cards / Grid
   ============================================================ */

.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-md); }
.part-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition-fast); }
.part-card:hover { border-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.part-card-image { aspect-ratio: 4/3; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; color: var(--text-muted); overflow: hidden; }
.part-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.part-card:hover .part-card-image img { transform: scale(1.05); }
.part-card-content { padding: var(--space-md); }
.part-card-name { font-weight: 600; margin-bottom: var(--space-xs); }
.part-card-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: var(--space-sm); display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.part-card-prices { display: flex; justify-content: space-between; align-items: center; padding-top: var(--space-sm); border-top: 1px solid var(--border-subtle); }
.part-card-lkr { font-weight: 700; color: var(--text-primary); }
.part-card-gbp { font-size: 0.75rem; color: var(--text-muted); }
.part-card-stock { font-size: 0.6875rem; padding: 2px 8px; border-radius: var(--radius-pill); font-weight: 700; }

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
  .app-header, .sidebar, .mobile-nav, .sidebar-overlay,
  .quick-actions, .btn, .search-wrap, .filter-summary,
  .actions, .modal-overlay, .toast-container,
  .image-viewer { display: none !important; }
  
  .main-content { margin: 0; padding: 0; }
  .card, .stat-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .data-table { font-size: 10pt; }
  .data-table th { background: #f0f0f0 !important; color: #000 !important; }
  .stat-card.stat-gold .stat-value { color: #B89038 !important; }
  body { background: white !important; color: black !important; font-size: 11pt; }
  .part-card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
}

/* ============================================================
   Responsive Utilities
   ============================================================ */

.hidden { display: none !important; }
.visible { display: block !important; }

@media (max-width: 768px) {
  .d-none-mobile { display: none !important; }
  .d-block-mobile { display: block !important; }
  .flex-col-mobile { flex-direction: column !important; }
  .w-full-mobile { width: 100% !important; }
  .text-center-mobile { text-align: center !important; }
  .gap-sm-mobile { gap: var(--space-sm) !important; }
}

@media (min-width: 769px) {
  .d-none-desktop { display: none !important; }
}

/* ============================================================
   Accessibility
   ============================================================ */

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}