/* =============================================
   Auto Parts Management — Style System
   Mobile-First, Navy & White Professional Theme
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

/* =============================================
   CSS Variables
   ============================================= */
:root {
  /* Background */
  --bg-base:     #F4F6FA;
  --bg-surface:  #FFFFFF;
  --bg-elevated: #EBF0F8;
  --bg-card:     #FFFFFF;
  --bg-input:    #FFFFFF;
  --bg-hover:    #E0E9F5;

  /* Accent — Navy Blue */
  --accent:       #1B4F9E;
  --accent-dark:  #0F3577;
  --accent-light: #2E6BC4;
  --accent-glow:  rgba(27, 79, 158, 0.1);

  /* Navy Header */
  --nav-bg:       #12305E;
  --nav-bg-hover: rgba(255,255,255,0.12);
  --nav-text:     #FFFFFF;

  /* Text */
  --text-primary:   #1A2637;
  --text-secondary: #4B5A6D;
  --text-muted:     #7B8DA4;
  --text-white:     #1A2637;

  /* Border */
  --border:       #D8E1EE;
  --border-light: #BBC8DC;

  /* Status */
  --success:       #1A7A3C;
  --success-bg:    rgba(26, 122, 60, 0.1);
  --warning:       #A05C00;
  --warning-bg:    rgba(160, 92, 0, 0.1);
  --danger:        #B8001A;
  --danger-bg:     rgba(184, 0, 26, 0.1);
  --info:          #1B4F9E;
  --info-bg:       rgba(27, 79, 158, 0.1);

  /* Typography */
  --font: 'Noto Sans Thai', 'Sarabun', -apple-system, sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Border Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:  0 2px 10px rgba(18,48,94,0.12);
  --shadow-lg:  0 4px 24px rgba(18,48,94,0.15);
  --shadow-accent: 0 4px 14px rgba(27, 79, 158, 0.35);

  /* Nav */
  --nav-height: 68px;

  /* Header */
  --header-height: 60px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* =============================================
   Material Symbols
   ============================================= */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  vertical-align: middle;
  line-height: 1;
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

body.no-nav {
  padding-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-light); }

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

input, select, textarea, button {
  font-family: var(--font);
  font-size: 1rem;
}

/* =============================================
   Scrollbar
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* =============================================
   Layout
   ============================================= */
.app-container {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
}

.page-content {
  padding: calc(var(--header-height) + var(--space-4)) var(--space-4) var(--space-4);
}

.page-content.no-header {
  padding-top: var(--space-4);
}

/* =============================================
   Header / Top Bar
   ============================================= */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: 100;
  box-shadow: 0 2px 12px rgba(18,48,94,0.25);
}

.app-header-center {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-full);
  color: rgba(255,255,255,0.85);
  font-size: 1.2rem;
  transition: background var(--transition);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.header-back:hover { background: var(--nav-bg-hover); color: #FFFFFF; }

.header-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* =============================================
   Bottom Navigation
   ============================================= */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: #FFFFFF;
  border-top: 2px solid var(--border);
  box-shadow: 0 -2px 12px rgba(18,48,94,0.08);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  transition: color var(--transition);
  padding: var(--space-2) 0;
  position: relative;
  cursor: pointer;
}

.nav-item .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform var(--transition);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
}

.nav-item:hover:not(.active) {
  color: var(--text-secondary);
}

.nav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 16px);
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--r-full);
  min-width: 16px;
  text-align: center;
}

/* =============================================
   Cards
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-elevated);
}

.card-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
}

.card-body {
  padding: var(--space-4);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: var(--space-1);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.card-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Car Card (horizontal) */
.car-card {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.car-card .car-thumb {
  width: 110px;
  min-width: 110px;
  object-fit: cover;
  background: var(--bg-elevated);
}

.car-card .car-thumb-placeholder {
  width: 110px;
  min-width: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.car-card .car-info {
  flex: 1;
  padding: var(--space-3);
  min-width: 0;
}

/* =============================================
   Stats Cards
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before    { background: var(--info); }
.stat-card.danger::before  { background: var(--danger); }

.stat-icon {
  font-size: 1.8rem;
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* =============================================
   Badges
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success  { background: var(--success-bg);  color: var(--success); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning); }
.badge-danger   { background: var(--danger-bg);   color: var(--danger); }
.badge-info     { background: var(--info-bg);     color: var(--info); }
.badge-secondary { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-accent   { background: var(--accent-glow); color: var(--accent); }

/* =============================================
   Buttons
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  color: white;
  box-shadow: 0 6px 20px rgba(27, 79, 158, 0.45);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text-white);
}

.btn-success {
  background: var(--success);
  color: #FFFFFF;
}
.btn-success:hover { background: #238016; color: #FFFFFF; }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.3);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-glow); }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: 14px var(--space-6);
  font-size: 1rem;
  border-radius: var(--r-lg);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 10px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent); }

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom));
  right: var(--space-4);
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: var(--accent);
  color: white;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-accent);
  border: none;
  cursor: pointer;
  text-decoration: none;
  z-index: 90;
  transition: all var(--transition);
}

.fab:hover {
  background: var(--accent-dark);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(27, 79, 158, 0.5);
}

.fab:active { transform: scale(0.95); }

/* =============================================
   Forms
   ============================================= */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px var(--space-4);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2365676B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

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

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: var(--space-1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.form-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* =============================================
   Image Upload
   ============================================= */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
  position: relative;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon { font-size: 2rem; margin-bottom: var(--space-2); }
.upload-text { color: var(--text-secondary); font-size: 0.9rem; }
.upload-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: var(--space-1); }

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-md);
  overflow: hidden;
}

.image-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  line-height: 1;
}

/* =============================================
   Alerts
   ============================================= */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(0,200,150,0.2); }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,71,87,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,184,48,0.2); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(61,156,245,0.2); }

/* =============================================
   List Items
   ============================================= */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
  cursor: pointer;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-elevated); }

.list-item-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.list-item-content { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: 600;
  color: var(--text-white);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-subtitle { font-size: 0.8rem; color: var(--text-secondary); }
.list-item-action { flex-shrink: 0; color: var(--text-muted); font-size: 1rem; }

/* =============================================
   Section Headers
   ============================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-link {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

/* =============================================
   Search Bar
   ============================================= */
.search-wrapper {
  position: relative;
  margin-bottom: var(--space-4);
}

.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input::placeholder { color: var(--text-muted); }

/* =============================================
   Filter Chips
   ============================================= */
.filter-chips {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.chip.active,
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
}

.empty-state-icon { font-size: 4rem; margin-bottom: var(--space-3); }
.empty-state-title { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-2); }
.empty-state-text  { font-size: 0.9rem; margin-bottom: var(--space-4); }

/* =============================================
   Image Gallery (Car Detail)
   ============================================= */
.gallery-main {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
}

.gallery-thumbs {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  width: 64px; height: 64px;
  border-radius: var(--r-md);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color var(--transition);
}

.gallery-thumb.active { border-color: var(--accent); }

/* =============================================
   Progress Bar (Car sold percentage)
   ============================================= */
.progress {
  background: var(--bg-elevated);
  border-radius: var(--r-full);
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--accent);
  transition: width 0.5s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }

/* =============================================
   Divider
   ============================================= */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

/* =============================================
   Info Row (key: value)
   ============================================= */
.info-table {
  width: 100%;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--space-2);
}

.info-row:last-child { border-bottom: none; }

.info-key {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.info-value.accent { color: var(--accent); font-weight: 700; }
.info-value.success { color: var(--success); font-weight: 700; }
.info-value.danger  { color: var(--danger);  font-weight: 700; }

/* =============================================
   Login Page
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(160deg, #12305E 0%, #1B4F9E 45%, #F4F6FA 45%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48%;
  background: radial-gradient(ellipse at 60% 40%, rgba(255,255,255,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-logo {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.login-brand {
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: var(--space-1);
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.login-sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--space-6);
  box-shadow: 0 8px 40px rgba(18,48,94,0.2);
}

/* =============================================
   Dashboard Widgets
   ============================================= */
.dashboard-greeting {
  margin-bottom: var(--space-5);
}

.dashboard-greeting-time {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dashboard-greeting-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-white);
}

/* =============================================
   Profit display
   ============================================= */
.profit-positive { color: var(--success); }
.profit-negative { color: var(--danger); }
.profit-neutral  { color: var(--text-muted); }

/* =============================================
   Action Sheet (bottom modal)
   ============================================= */
.action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
  backdrop-filter: blur(4px);
}

.action-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.action-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
}

.action-sheet.open {
  transform: translateY(0);
}

.action-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border-light);
  border-radius: var(--r-full);
  margin: 0 auto var(--space-4);
}

.action-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-white);
  text-align: center;
  margin-bottom: var(--space-4);
}

/* =============================================
   Confirm Dialog
   ============================================= */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.dialog-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--space-6);
  max-width: 340px;
  width: 100%;
  transform: scale(0.9);
  transition: transform var(--transition);
}

.dialog-overlay.open .dialog { transform: scale(1); }

.dialog-icon { font-size: 2.5rem; text-align: center; margin-bottom: var(--space-3); }
.dialog-title { font-size: 1.1rem; font-weight: 700; text-align: center; color: var(--text-white); margin-bottom: var(--space-2); }
.dialog-text  { font-size: 0.9rem; color: var(--text-secondary); text-align: center; margin-bottom: var(--space-5); }
.dialog-actions { display: flex; gap: var(--space-3); }
.dialog-actions .btn { flex: 1; }

/* =============================================
   Table (Reports)
   ============================================= */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  background: var(--nav-bg);
  color: rgba(255,255,255,0.9);
  font-weight: 700;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:hover td { background: var(--bg-elevated); }

/* =============================================
   Utilities
   ============================================= */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm     { font-size: 0.85rem; }
.text-xs     { font-size: 0.75rem; }
.text-lg     { font-size: 1.1rem; }
.text-xl     { font-size: 1.3rem; }

.text-muted   { color: var(--text-muted); }
.text-white   { color: var(--text-white); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-bold   { font-weight: 700; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }

.flex-1 { flex: 1; }
.w-full { width: 100%; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden { display: none !important; }

/* =============================================
   Loading Spinner
   ============================================= */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--r-full);
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   Toast Notification
   ============================================= */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease forwards;
  pointer-events: all;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =============================================
   Sidebar brand — hidden on mobile
   ============================================= */
.sidebar-brand { display: none; }

/* =============================================
   Responsive — Small Phone+ (640px)
   ============================================= */
@media (min-width: 640px) {
  .image-preview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* =============================================
   Responsive — Tablet (768px+) Sidebar Layout
   ============================================= */
@media (min-width: 768px) {
  body {
    padding-bottom: 0;
  }

  /* Content area shifts right of sidebar */
  .app-container {
    max-width: none;
    margin-left: 68px;
  }

  .page-content {
    padding: calc(var(--header-height) + var(--space-6)) var(--space-6) var(--space-6);
  }

  /* Header spans only content area */
  .app-header {
    left: 68px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 1px 8px rgba(18,48,94,0.12);
  }

  .app-header-center {
    max-width: none;
  }

  /* ── Transform bottom nav → left sidebar ── */
  .bottom-nav {
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 68px;
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border-top: none;
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,0.08);
    background: var(--nav-bg);
    box-shadow: 2px 0 16px rgba(18,48,94,0.2);
    padding-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Sidebar brand — pinned to bottom */
  .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    color: rgba(255,255,255,0.5);
    font-size: 1.4rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    margin-top: auto;
    text-decoration: none;
    transition: color var(--transition);
  }
  .sidebar-brand:hover { color: rgba(255,255,255,0.85); }
  .sidebar-brand-text { display: none; }

  /* Nav items stack vertically */
  .nav-item {
    width: 100%;
    height: auto;
    padding: 14px 0;
    color: rgba(255,255,255,0.6);
    font-size: 0.6rem;
    border-radius: 0;
    flex-shrink: 0;
  }

  .nav-item .nav-icon { font-size: 1.4rem; }

  .nav-item.active {
    color: #FFFFFF;
    background: rgba(255,255,255,0.12);
  }

  /* Active indicator: left border instead of top */
  .nav-item.active::before {
    top: 0; bottom: 0;
    left: 0; right: auto;
    width: 3px;
    height: 100%;
    border-radius: 0 3px 3px 0;
    background: rgba(255,255,255,0.9);
  }

  .nav-item:hover:not(.active) {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.07);
  }

  .nav-badge {
    top: 4px;
    right: calc(50% - 18px);
  }

  /* Content grids */
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row   { grid-template-columns: 1fr 1fr; }

  /* FAB — free from bottom nav height */
  .fab {
    bottom: var(--space-6);
    right: var(--space-6);
  }
}

/* =============================================
   Responsive — Desktop (1024px+)
   ============================================= */
@media (min-width: 1024px) {
  /* Sidebar stays icon-only (68px) — no expansion */
  .page-content {
    padding: calc(var(--header-height) + var(--space-8)) var(--space-8) var(--space-8);
    max-width: 1180px;
  }

  /* Dashboard 2-column: recent cars + recent sales */
  .dashboard-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    align-items: start;
  }

  .stats-grid { gap: var(--space-4); }

  /* 3-column form variant */
  .form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
  }
}

/* =============================================
   Responsive — Large Desktop (1280px+)
   ============================================= */
@media (min-width: 1280px) {
  .page-content { max-width: 1400px; }
}
