/* ============================================================
   Muriq Auto — Design System
   Mobile-first, Glassmorphism, Gemstone Gold & Midnight Navy
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ─── Design Tokens ──────────────────────────────────────── */
:root {
  --bg:           #0a0e1a;
  --bg-layer:     #0f1525;
  --surface:      #141c30;
  --surface-2:    #1a2540;
  --surface-3:    #1f2d4a;
  --border:       rgba(255,255,255,0.06);
  --border-focus: rgba(245,158,11,0.5);

  --gold:         #f59e0b;
  --gold-light:   #fbbf24;
  --gold-dim:     rgba(245,158,11,0.15);
  --gold-border:  rgba(245,158,11,0.3);

  --blue:         #3b82f6;
  --green:        #22c55e;
  --red:          #ef4444;
  --orange:       #f97316;
  --purple:       #a855f7;

  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;

  --radius:       14px;
  --radius-sm:    8px;
  --radius-xl:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-gold:  0 4px 24px rgba(245,158,11,0.2);
  --glass:        rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.07);

  --nav-height:   64px;
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Page Layout ─────────────────────────────────────────── */
.page {
  width: 100%; max-width: 500px;
  margin: 0 auto;
  padding: 16px 16px 80px;
  box-sizing: border-box;
  overflow-x: hidden;
  display: flex; flex-direction: column;
}
.page-wide { max-width: 1600px; }

/* Desktop Grid Wrapper */
.desktop-grid { display: block; }

/* ─── Typography ──────────────────────────────────────────── */
h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; font-weight: 700; }
h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.font-mono   { font-family: 'Courier New', monospace; letter-spacing: 0.05em; }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.15s;
}
.card:active { transform: scale(0.985); }
.card-glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.card-gold { border-color: var(--gold-border) !important; background: linear-gradient(135deg, var(--surface), #1a1800); }

/* ─── Stat Cards ──────────────────────────────────────────── */
.stat-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px; 
    margin: 16px 0; 
}

@media (min-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.stat-card:active { transform: scale(0.96) translateY(0); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}
.stat-icon.gold  { background: var(--gold-dim); }
.stat-icon.blue  { background: rgba(59,130,246,0.12); }
.stat-icon.green { background: rgba(34,197,94,0.12); }
.stat-icon.red   { background: rgba(239,68,68,0.12); }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 1.45rem; font-weight: 700; font-family: 'Space Grotesk', sans-serif; line-height: 1.1; }
.stat-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Vehicle Cards ───────────────────────────────────────── */
.vehicle-list { display: flex; flex-direction: column; gap: 12px; }
.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; gap: 14px; align-items: flex-start;
  text-decoration: none; color: inherit;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.vehicle-card:hover { transform: translateY(-3px); border-color: var(--gold-border); box-shadow: 0 12px 30px rgba(0,0,0,0.3); }
.vehicle-card:active { transform: scale(0.985); }
.vehicle-icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.vehicle-info { flex: 1; min-width: 0; }
.vehicle-name { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vehicle-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.vehicle-numbers { margin-top: 10px; display: flex; gap: 10px; }
.v-num { text-align: left; }
.v-num-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.v-num-value { font-size: 0.88rem; font-weight: 700; margin-top: 2px; }

/* ─── Status Pills ────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
}
.status-available { background: rgba(34,197,94,0.12);  color: var(--green);  border: 1px solid rgba(34,197,94,0.25); }
.status-repair    { background: rgba(249,115,22,0.12); color: var(--orange); border: 1px solid rgba(249,115,22,0.25); }
.status-restore   { background: rgba(168,85,247,0.12); color: var(--purple); border: 1px solid rgba(168,85,247,0.25); }
.status-sold      { background: rgba(59,130,246,0.12); color: var(--blue);   border: 1px solid rgba(59,130,246,0.25); }
.status-archived  { background: rgba(100,116,139,0.12); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.2); }

/* ─── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; }
.badge-profit  { background: rgba(34,197,94,0.12);  color: var(--green); }
.badge-loss    { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-neutral { background: var(--surface-3); color: var(--text-muted); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; height: 44px;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; transition: all 0.2s; white-space: nowrap;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(0.96) !important; }
.btn-primary { 
    background: var(--gold); color: #0a0e1a; font-weight: 700; border: none;
}
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold-border); background: var(--surface-3); }
.btn-secondary { background: var(--surface-3); color: var(--text-dim); border-color: var(--border); }
.btn-secondary:hover { color: var(--text); border-color: var(--gold-border); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 0.8rem; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; display: flex; }

/* ─── FAB (Floating Action Button) ───────────────────────── */
.fab {
  position: fixed; right: 20px; bottom: calc(var(--nav-height) + 20px + var(--safe-bottom));
  width: 58px; height: 58px; border-radius: 18px;
  background: var(--gold); color: #0a0e1a;
  border: none; font-size: 28px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-gold), 0 8px 32px rgba(0,0,0,0.4);
  transition: all 0.2s; z-index: 100;
}
.fab:active { transform: scale(0.92); }

/* ─── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.form-input {
  width: 100%; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'Inter', sans-serif; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
}
.form-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ─── Hero Components (Common) ───────────────────────────── */
.hero-banner, .vehicle-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 20px;
  display: flex !important; flex-direction: column !important; gap: 12px;
  position: relative;
  overflow: hidden;
}
.hero-greeting { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); opacity: 0.8; }
.hero-company, .vh-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin: 0; }
.hero-tagline { font-size: 0.75rem; color: var(--gold); font-weight: 600; margin-top: 2px; }

/* ─── Vehicle Detail Specifics ────────────────────────────── */
.vehicle-photo-container { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--bg-layer); }
.vehicle-photo { width:100%; height:220px; object-fit:cover; display:block; transition: filter 0.2s; }
.photo-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); opacity: 0; transition: opacity 0.2s; color: white; font-size: 24px; }
.vehicle-photo-placeholder { width:100%; height:160px; display:flex; align-items:center; justify-content:center; font-size:72px; opacity:0.12; background: var(--surface-2); }
.vh-plate { display:inline-flex;align-items:center;gap:6px;background:var(--gold-dim);color:var(--gold);border:1px solid var(--gold-border);border-radius:8px;padding:4px 12px;font-size:0.88rem;font-weight:800;font-family:'Courier New',monospace;letter-spacing:0.12em;margin-bottom:12px; }

/* ─── Sidebar Actions ─────────────────────────────────────── */
.sidebar-action-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
  margin: 16px 0;
  width: 100%;
}
.action-btn-wide {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim); padding: 14px 8px; border-radius: 12px;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  text-align: center; white-space: normal; line-height: 1.2;
}
.action-btn-wide .icon { font-size: 1.4rem; display: block; }
.action-btn-wide .chevron { display: none; } /* Hide chevron on mobile grid */

.action-btn-wide:hover {
  background: var(--surface-3); border-color: var(--gold-border);
  color: var(--gold); transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.action-btn-wide:active { transform: scale(0.96); }

@media (min-width: 1024px) {
    .sidebar-action-panel { grid-template-columns: 1fr; gap: 12px; }
    .action-btn-wide {
        flex-direction: row; justify-content: flex-start; padding: 16px 20px;
        font-size: 0.9rem; text-transform: none; letter-spacing: normal;
    }
    .action-btn-wide .icon { width: 24px; font-size: 1.2rem; }
    .action-btn-wide .chevron { display: block; margin-left: auto; opacity: 0.2; }
}

/* ─── Pro P&L Grid ────────────────────────────────────────── */
.pl-section { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:16px; }
.pl-header { padding:14px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; }
.pl-body { padding:16px 20px; }
.pl-grid { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--border); overflow: hidden; border-radius: var(--radius-sm); }
.cost-row { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; background: var(--surface); }
.cost-label { font-size:0.8rem; color:var(--text-dim); }
.cost-value { font-size:1rem; font-weight:700; }

/* ─── AI Quick Log ────────────────────────────────────────── */
.ai-log-bar {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
  box-shadow: 0 0 20px rgba(245,158,11,0.05);
}
.ai-log-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ai-log-icon { font-size: 18px; }
.ai-log-title { font-size: 0.85rem; font-weight: 600; color: var(--gold); }
.ai-log-subtitle { font-size: 0.72rem; color: var(--text-muted); }
.ai-log-input-wrap { display: flex; gap: 8px; }
.ai-log-input {
  flex: 1; padding: 11px 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.92rem; font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}
.ai-log-input:focus { outline: none; border-color: var(--gold); }
.ai-parse-btn {
  padding: 11px 16px; background: var(--gold); color: #0a0e1a;
  border: none; border-radius: var(--radius-sm);
  font-weight: 700; cursor: pointer; font-size: 0.92rem;
  transition: all 0.2s; white-space: nowrap;
}
.ai-parse-btn:active { transform: scale(0.95); }
.ai-result {
  margin-top: 12px; padding: 12px;
  background: var(--surface-3); border-radius: var(--radius-sm);
  border: 1px solid var(--border); display: none;
}
.ai-result.visible { display: block; animation: fadeUp 0.2s ease; }
.ai-result-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-result-row:last-child { margin-bottom: 0; }
.ai-result-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.ai-result-value { font-size: 0.9rem; font-weight: 600; }
.ai-confirm-btn { margin-top: 10px; width: 100%; }
.ai-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* ─── Bottom Navigation ───────────────────────────────────── */
/* ─── Filter Pills ────────────────────────────────────────── */
.filter-pills { 
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

@media (min-width: 1024px) {
  .filter-pills { grid-template-columns: repeat(5, 1fr); }
}

.filter-pill {
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.filter-pill:hover { border-color: var(--gold-border); background: var(--surface-2); }
.filter-pill:active { transform: scale(0.95); }

.filter-pill.active { 
  background: var(--gold-dim); 
  border-color: var(--gold-border); 
  color: var(--gold); 
  box-shadow: 0 4px 12px rgba(245,158,11,0.15);
}

.nav-label { font-size: 0.65rem; font-weight: 600; letter-spacing: 0.03em; }

/* ─── Bottom Navigation ───────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-around;
  padding-top: 10px;
  z-index: 200;
  transition: transform 0.3s;
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 12px;
  text-decoration: none; color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer; border: none; background: transparent;
  font-family: 'Inter', sans-serif;
  min-width: 64px;
}

.nav-item.active { color: var(--gold); }
.nav-item.active .nav-icon { transform: translateY(-2px); }

.nav-icon { font-size: 20px; line-height: 1; transition: transform 0.2s; }

/* ─── Filter Pills ────────────────────────────────────────── */
.page-header {
  position: sticky; top: 0;
  background: rgba(10, 14, 26, 0.88);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px; /* Slightly tighter */
  z-index: 100;
  margin-bottom: 16px;
}
.page-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-logo { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.page-logo-icon { 
    height: 38px; /* Fixed height for consistency */
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; 
    flex-shrink: 0;
    max-width: 120px; /* Allow wider logos but cap them */
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.page-logo-icon img {
    height: 100%;
    width: auto;
    object-fit: contain; /* Don't crop wide logos */
}
.page-logo-text { 
    font-family: 'Space Grotesk', sans-serif; 
    font-size: 1.15rem; /* Slightly smaller to fit */
    font-weight: 700; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.page-logo-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }

/* ─── Modals / Bottom Sheets ──────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 8px 20px 32px;
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 301; max-height: 85vh; overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle { width: 40px; height: 4px; background: var(--surface-3); border-radius: 2px; margin: 10px auto 20px; }
.sheet-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }

/* ─── Expense Row ──────────────────────────────────────────── */
.expense-list { display: flex; flex-direction: column; gap: 1px; }
.expense-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.expense-row:last-child { border-bottom: none; }
.expense-cat-icon { font-size: 20px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); border-radius: 10px; flex-shrink: 0; }
.expense-info { flex: 1; min-width: 0; }
.expense-cat { font-size: 0.85rem; font-weight: 600; }
.expense-desc { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-amount { font-weight: 700; font-size: 0.92rem; color: var(--red); white-space: nowrap; }

/* ─── Profit Bar ──────────────────────────────────────────── */
.profit-bar {
  background: var(--surface-2); border-radius: 99px; height: 8px;
  overflow: hidden; margin: 8px 0;
}
.profit-bar-fill {
  height: 100%; border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  background: linear-gradient(90deg, var(--gold), var(--green));
}
.profit-bar-fill.negative { background: linear-gradient(90deg, var(--red), var(--orange)); }

/* ─── Section Labels ──────────────────────────────────────── */
.section-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted); margin: 20px 0 10px;
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon { font-size: 52px; opacity: 0.3; }
.empty-title { font-size: 1.1rem; font-weight: 700; }
.empty-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

/* ─── Toast Notifications ─────────────────────────────────── */
.auto-toast {
  position: fixed; bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
  left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.88rem; font-weight: 500;
  box-shadow: var(--shadow); z-index: 500;
  opacity: 0; transition: all 0.3s; white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.auto-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.auto-toast.toast-success { border-color: rgba(34,197,94,0.3); }
.auto-toast.toast-error   { border-color: rgba(239,68,68,0.3); }
.auto-toast.toast-warning { border-color: rgba(245,158,11,0.3); }
.print-header { display: none; }

.profit-summary {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--surface), #1a1800);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}
.profit-summary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15); }
.profit-summary:active { transform: scale(0.98); }

.back-btn {
  display: flex !important; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-dim); padding: 12px 20px; border-radius: 14px;
  cursor: pointer; text-decoration: none; font-size: 0.85rem; font-weight: 600;
  transition: all 0.24s; margin-bottom: 24px; width: fit-content;
}
.back-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--gold-border); transform: translateX(-4px); }
.back-btn::before { content: '←'; font-size: 1.1rem; }

/* ─── Charts Container ────────────────────────────────────── */
.chart-container { position: relative; height: 200px; }

/* ─── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 20px;
}
.login-hero { text-align: center; margin-bottom: 36px; }
.login-logo { font-size: 56px; margin-bottom: 12px; }
.login-title { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 800; }
.login-title span { color: var(--gold); }
.login-subtitle { color: var(--text-muted); margin-top: 8px; font-size: 0.92rem; }
.login-card { width: 100%; max-width: 400px; }
.login-tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 24px; }
.login-tab { flex: 1; padding: 8px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; border: none; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.login-tab.active { background: var(--surface-3); color: var(--text); }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Category Grid ───────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; border-radius: 12px;
  background: var(--surface-2); border: 2px solid transparent;
  cursor: pointer; transition: all 0.15s; text-align: center;
}
.cat-tile:active { transform: scale(0.95); }
.cat-tile.selected { border-color: var(--gold); background: var(--gold-dim); }
.cat-tile-icon { font-size: 22px; }
.cat-tile-label { font-size: 0.68rem; font-weight: 600; color: var(--text-dim); line-height: 1.2; }

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}
.fade-up { animation: fadeUp 0.3s ease both; }
.skeleton { animation: pulse 1.5s ease infinite; background: var(--surface-2); border-radius: 6px; }

/* ─── Responsive: Desktop Overhaul ────────────────────────── */
@media (min-width: 640px) {
  .page { max-width: 90%; padding: 0 24px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .vehicle-list { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
}

@media (min-width: 800px) {
  .page { max-width: 1600px; padding: 0 40px; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; min-height: 100vh; overflow: visible; }
  .page-header { padding-top: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
  
  /* Mac-style Dock */
  .bottom-nav {
    left: 50%; transform: translateX(-50%) translateY(-24px);
    width: auto; min-width: 480px;
    padding: 12px 32px;
    height: 84px;
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 30px rgba(245,158,11,0.08);
    background: rgba(15, 21, 37, 0.9);
  }

  /* Desktop Grid Layouts - Balanced for High Res */
  .desktop-grid { display: grid; grid-template-columns: 1fr 400px; gap: 48px; align-items: start; width: 100%; }
  .stat-grid { grid-template-columns: repeat(5, 1fr) !important; gap: 20px; }
  .vehicle-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
  
  /* Horizontal Hero - Fluid Scaling */
  .vh-flex { display: flex; gap: 32px; align-items: stretch; height: 180px; background: var(--bg-layer); margin-bottom: 32px; width: 100%; }
  .vh-flex .vehicle-photo-container { width: 320px !important; height: 180px !important; margin: 0 !important; }
  .vh-flex .vehicle-photo { height: 180px !important; }
  .vh-flex .vh-content { flex: 1; padding: 20px 40px; display: flex; flex-direction: column; justify-content: center; position: relative; }
  .vh-flex .vh-content::after { font-size: 100px; right: 24px; bottom: 12px; opacity: 0.04; }
  .hero-company, .vh-title { font-size: 2rem; margin: 2px 0; }

  /* P&L Grid - 3 Column SaaS Row */
  .pl-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 1px; background: var(--border); width: 100%; }
  .pl-grid .cost-row { padding: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
  .pl-grid .cost-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
  .pl-grid .cost-value { font-size: 1.4rem; font-family: 'Space Grotesk', sans-serif; }



  /* Professional Centered Modals for Desktop */
  .bottom-sheet {
      left: 50%; right: auto; width: 600px;
      bottom: auto; top: 50%;
      transform: translate(-50%, -40%) scale(0.95);
      border-radius: 24px; opacity: 0; pointer-events: none;
      transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
      box-shadow: 0 30px 90px rgba(0,0,0,0.7);
  }
  .bottom-sheet.open {
      transform: translate(-50%, -50%) scale(1);
      opacity: 1; pointer-events: all;
  }
}

/* ─── Global Print Overrides ─────────────────────────────────── */
@media print {
    /* Global Overrides */
    * { 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
        box-shadow: none !important;
        text-shadow: none !important;
        background-color: transparent !important;
    }
    
    body { 
        background: #fff !important; 
        color: #000 !important; 
        font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
        font-size: 11pt;
        line-height: 1.4;
        margin: 0;
        padding: 0;
    }

    @page {
        margin: 1.2cm;
        size: A4;
    }

    /* Hide Web Elements */
    .bottom-nav, .back-btn, .action-btn-wide, .sheet-overlay, .bottom-sheet, 
    .btn, .sidebar-action-panel, .hide-print, .section-label, .photo-overlay,
    .chevron, .icon:not(.vh-plate .icon), .skeleton, .ai-log-bar, .filter-pills,
    .btn-icon, .btn-ghost, .spinner { 
        display: none !important; 
    }

    /* Layout Flattening */
    .desktop-grid { display: block !important; }
    .main-column, .desktop-sidebar { 
        width: 100% !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        display: block !important;
    }
    
    .page, #pageRoot { 
        padding: 0 !important; 
        margin: 0 !important; 
        max-width: 100% !important; 
        background: #fff !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .page-header { display: none !important; }
    .hero-banner { 
        background: #f8f9fa !important; 
        border: 1px solid #eee !important;
        border-radius: 0 !important;
        margin-bottom: 20pt !important;
        padding: 15pt !important;
    }
    .hero-greeting, .hero-company { color: #000 !important; }

    /* Print Header */
    .print-header { display: block !important; }

    /* Report Sections & Cards */
    .card, .pl-section, .stat-card, .vehicle-card, .profit-summary { 
        background: #fff !important; 
        border: 1px solid #eee !important; 
        color: #000 !important; 
        margin-bottom: 15pt !important;
        padding: 12pt !important;
        border-radius: 0 !important;
        break-inside: avoid;
        box-shadow: none !important;
    }

    .pl-header {
        border-bottom: 2pt solid #000 !important;
        margin-bottom: 12pt !important;
        padding-bottom: 4pt !important;
    }

    .pl-header h3 { 
        color: #000 !important; 
        text-transform: uppercase;
        letter-spacing: 1pt;
        font-size: 12pt;
        margin: 0 !important;
    }

    /* Hero Image */
    .vehicle-hero {
        background: #fff !important;
        border: 1px solid #eee !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 20pt !important;
        padding: 0 !important;
        margin-bottom: 20pt !important;
        break-inside: avoid;
        height: auto !important;
    }

    .vehicle-photo-container { 
        width: 35% !important; 
        height: auto !important;
        border-right: 1px solid #eee !important;
        background: #fcfcfc !important;
    }

    .vehicle-photo { 
        width: 100% !important; 
        max-height: 180pt !important; 
        object-fit: cover !important;
        border-radius: 0 !important;
    }

    .vh-content { padding: 10pt !important; flex: 1; }
    .vh-plate { 
        background: #f1f1f1 !important; 
        color: #000 !important; 
        border: 1px solid #ddd !important; 
        font-weight: bold !important; 
        font-size: 10pt !important;
        padding: 2pt 8pt !important;
        border-radius: 4pt !important;
    }
    .vh-title { font-size: 18pt !important; color: #000 !important; font-weight: 800 !important; margin: 5pt 0 !important; }

    /* Tables & Costs */
    .cost-row { 
        border-bottom: 0.5pt solid #eee !important; 
        padding: 6pt 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        background: transparent !important;
    }
    .cost-label { color: #444 !important; font-size: 10pt !important; }
    .cost-value { color: #000 !important; font-weight: 600 !important; font-size: 11pt !important; }
    
    #plInvestment { font-size: 13pt !important; color: #000 !important; font-weight: 800 !important; }
    .text-red { color: #900 !important; }
    .text-green { color: #060 !important; }
    .stat-value { color: #000 !important; font-weight: 900 !important; }

    /* Professional Lists */
    .expense-list, .vehicle-list { display: block !important; }
    .expense-row {
        display: flex !important;
        border-bottom: 1px solid #eee !important;
        padding: 8pt 0 !important;
        break-inside: avoid;
        background: transparent !important;
    }
    
    .expense-cat-icon { 
        width: 20pt !important; 
        height: 20pt !important; 
        background: #f8f8f8 !important; 
        border: 1px solid #eee !important;
        border-radius: 50% !important;
        font-size: 10pt !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .expense-info { flex: 1; margin-left: 10pt !important; }
    .expense-cat { font-weight: 700 !important; color: #000 !important; }
    .expense-desc { color: #666 !important; font-size: 9pt !important; }
    .expense-amount { font-weight: 700 !important; color: #000 !important; }

    /* Charts visibility */
    canvas, .chart-container { display: block !important; width: 100% !important; height: auto !important; max-height: 250pt !important; }
    .chart-card { break-inside: avoid; }

    /* Footer for Signatures */
    .print-footer {
        display: flex !important;
        justify-content: space-between;
        margin-top: 40pt;
        border-top: 1px dashed #ccc;
        padding-top: 20pt;
    }
    .signature-line {
        width: 180pt;
        border-top: 1pt solid #000;
        text-align: center;
        font-size: 9pt;
        margin-top: 30pt;
    }

    /* Role Adaptation cleanup */
    #adminHomeView, #dealerHomeView { display: block !important; }
}

@media (min-width: 1400px) {
    .vehicle-list { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Utils ───────────────────────────────────────────────── */
@media (max-width: 639px) {
    .hide-mobile { display: none !important; }
    .show-mobile-inline { display: inline-block !important; }
}
@media (min-width: 640px) {
    .show-mobile-inline { display: none !important; }
}
