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

body {
  font-family: 'DM Sans', sans-serif;
  background: #0a0a0a;
  color: #f0ece6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCREENS ── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ── LOGIN ── */
#login-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  position: relative;
}
#login-screen::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(190,20,20,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  background: #131313;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .brand { font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 3px; color: #f0ece6; display: block; }
.login-logo .sub { font-size: 11px; letter-spacing: 2px; color: #666; text-transform: uppercase; margin-top: 4px; display: block; }
.login-logo .red-line { width: 40px; height: 2px; background: #be1414; margin: 12px auto 0; }
.login-error { background: rgba(190,20,20,0.15); border: 1px solid rgba(190,20,20,0.3); border-radius: 6px; padding: 10px 14px; font-size: 13px; color: #f08080; margin-bottom: 16px; display: none; }
.login-btn { width: 100%; background: #be1414; border: none; border-radius: 6px; padding: 13px; color: #fff; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; letter-spacing: 1px; cursor: pointer; transition: background 0.2s; margin-top: 8px; }
.login-btn:hover { background: #d41616; }
.login-btn:disabled { background: #6a0e0e; cursor: not-allowed; }

/* ── APP LAYOUT ── */
#app-screen { flex-direction: row; background: #0a0a0a; }

/* ── SIDEBAR ── */
.sidebar { width: 220px; min-width: 220px; background: #0f0f0f; border-right: 1px solid #1a1a1a; display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid #1a1a1a; }
.brand-sm { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 2px; }
.sub-sm { font-size: 10px; color: #555; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }
.red-bar { width: 24px; height: 2px; background: #be1414; margin-top: 10px; }
.sidebar-user { padding: 14px 20px; border-bottom: 1px solid #1a1a1a; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: #be1414; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: #fff; float: left; margin-right: 10px; }
.user-info { overflow: hidden; }
.uname { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.urole { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }
.urole.admin { color: #be1414; }
.urole.staff { color: #666; }
.clearfix::after { content: ''; display: table; clear: both; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-section-label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: #333; padding: 12px 20px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; cursor: pointer; font-size: 13px; color: #777; transition: color 0.15s, background 0.15s; border-left: 2px solid transparent; user-select: none; }
.nav-item:hover { color: #ccc; background: rgba(255,255,255,0.03); }
.nav-item.active { color: #f0ece6; border-left-color: #be1414; background: rgba(190,20,20,0.08); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge { margin-left: auto; background: #be1414; color: #fff; font-size: 9px; padding: 2px 6px; border-radius: 10px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid #1a1a1a; }
.loc-toggle { display: flex; gap: 4px; margin-bottom: 12px; }
.loc-btn { flex: 1; padding: 6px; border-radius: 4px; font-size: 11px; border: 1px solid #2a2a2a; cursor: pointer; background: transparent; color: #555; transition: all 0.15s; font-family: 'DM Sans', sans-serif; }
.loc-btn.active { background: #be1414; border-color: #be1414; color: #fff; }
.logout-btn { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #555; cursor: pointer; transition: color 0.2s; padding: 4px 0; }
.logout-btn:hover { color: #be1414; }
.admin-only { display: none; }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; overflow-y: auto; min-height: 100vh; }
.panel { display: none; }
.panel.active { display: block; }
.panel-body { padding: 28px; }
.topbar { background: #0f0f0f; border-bottom: 1px solid #1a1a1a; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 2px; }
.topbar-loc { font-size: 12px; color: #555; }
.topbar-actions { display: flex; gap: 8px; }

/* ── BUTTONS ── */
.btn { border-radius: 6px; padding: 7px 14px; font-size: 12px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 500; border: 1px solid #2a2a2a; background: #1c1c1c; color: #aaa; transition: all 0.15s; letter-spacing: 0.5px; }
.btn:hover { border-color: #444; color: #f0ece6; }
.btn.red { background: #be1414; border-color: #be1414; color: #fff; }
.btn.red:hover { background: #d41616; }
.btn.ghost { background: transparent; border-color: #2a2a2a; color: #666; }
.btn.ghost:hover { border-color: #be1414; color: #be1414; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── FILTERS ── */
.filters { padding: 14px 24px; border-bottom: 1px solid #111; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #0c0c0c; }
.search-input { background: #1a1a1a; border: 1px solid #242424; border-radius: 6px; padding: 8px 13px; color: #f0ece6; font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; width: 200px; }
.search-input:focus { border-color: #be1414; }
.filter-select { background: #1a1a1a; border: 1px solid #242424; border-radius: 6px; padding: 8px 12px; color: #999; font-size: 12px; font-family: 'DM Sans', sans-serif; outline: none; cursor: pointer; }
.pill-row { display: flex; gap: 5px; flex-wrap: wrap; }
.pill { padding: 5px 13px; border-radius: 20px; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; cursor: pointer; border: 1px solid #242424; background: transparent; color: #555; font-family: 'DM Sans', sans-serif; transition: all 0.15s; }
.pill.active { background: #be1414; border-color: #be1414; color: #fff; }
.pill:hover:not(.active) { border-color: #444; color: #ccc; }
.results-count { font-size: 12px; color: #444; margin-left: auto; white-space: nowrap; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 600px; }
.inv-table th { text-align: left; padding: 10px 14px; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #444; border-bottom: 1px solid #1a1a1a; font-weight: 400; white-space: nowrap; }
.inv-table td { padding: 11px 14px; border-bottom: 1px solid #111; color: #bbb; vertical-align: middle; }
.inv-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.cell-primary { font-size: 13px; font-weight: 500; color: #f0ece6; }
.cell-sub { font-size: 11px; color: #555; margin-top: 2px; }
.type-tag { display: inline-block; background: #1a1a1a; border: 1px solid #242424; border-radius: 3px; padding: 2px 8px; font-size: 10px; color: #888; letter-spacing: 0.5px; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 3px; font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; font-weight: 500; }
.badge-available { background: rgba(30,120,60,0.18); color: #4dab70; }
.badge-hold { background: rgba(190,20,20,0.15); color: #e06060; }
.badge-low { background: rgba(190,20,20,0.15); color: #e06060; }
.badge-ok { background: rgba(30,120,60,0.18); color: #4dab70; }
.action-btns { display: flex; gap: 5px; opacity: 0; transition: opacity 0.15s; }
.inv-table tbody tr:hover .action-btns { opacity: 1; }
.act-btn { background: transparent; border: 1px solid #242424; border-radius: 4px; padding: 4px 9px; font-size: 10px; color: #666; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.15s; white-space: nowrap; }
.act-btn:hover { border-color: #555; color: #ccc; }
.act-btn.danger:hover { border-color: #be1414; color: #e06060; }
.act-btn.warn:hover { border-color: #f0a020; color: #f0a020; }

/* ── DASHBOARD ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 28px; }
.stat-card { background: #131313; border: 1px solid #1e1e1e; border-radius: 8px; padding: 16px 18px; }
.stat-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #555; margin-bottom: 8px; }
.stat-value { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 1px; }
.stat-sub { font-size: 11px; color: #555; margin-top: 4px; }
.section-title { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: #444; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: #1a1a1a; }
.alert-row { background: rgba(190,20,20,0.07); border: 1px solid rgba(190,20,20,0.18); border-radius: 8px; padding: 14px 18px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.alert-name { font-size: 13px; }
.alert-stock { font-size: 12px; color: #e06060; margin-top: 2px; }
.muted-msg { font-size: 13px; color: #444; padding: 16px 0; }

/* ── DRAWER ── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0); pointer-events: none; z-index: 40; transition: background 0.25s; }
.drawer-overlay.open { background: rgba(0,0,0,0.65); pointer-events: all; }
.drawer { position: fixed; right: -580px; top: 0; bottom: 0; width: 100%; max-width: 560px; background: #111; border-left: 1px solid #1e1e1e; z-index: 41; overflow-y: auto; transition: right 0.28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; }
.drawer.open { right: 0; }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid #1a1a1a; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #111; z-index: 2; }
.drawer-title { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 2px; }
.close-btn { background: transparent; border: 1px solid #242424; border-radius: 6px; padding: 6px 10px; color: #666; cursor: pointer; font-size: 16px; line-height: 1; transition: all 0.15s; }
.close-btn:hover { border-color: #444; color: #ccc; }
.drawer-body { padding: 24px; flex: 1; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid #1a1a1a; display: flex; gap: 10px; background: #111; position: sticky; bottom: 0; }
.drawer-footer .btn { flex: 1; padding: 11px; font-size: 13px; text-align: center; }

/* ── FORMS ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group label { display: block; font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #555; margin-bottom: 7px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; background: #1a1a1a; border: 1px solid #242424; border-radius: 6px; padding: 10px 13px; color: #f0ece6; font-size: 13px; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #be1414; }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-section-label { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: #333; margin: 20px 0 14px; padding-bottom: 8px; border-bottom: 1px solid #1a1a1a; }

/* ── PHOTO UPLOAD ── */
.photo-upload-area { border: 1.5px dashed #2a2a2a; border-radius: 8px; padding: 24px; text-align: center; cursor: pointer; transition: border-color 0.2s; position: relative; background: #151515; }
.photo-upload-area:hover { border-color: #be1414; }
.photo-upload-area input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-label { font-size: 13px; color: #555; }
.upload-sub { font-size: 11px; color: #333; margin-top: 4px; }
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.photo-preview-wrap { position: relative; width: 72px; height: 72px; }
.photo-preview-wrap img { width: 72px; height: 72px; border-radius: 6px; object-fit: cover; border: 1px solid #2a2a2a; }
.remove-photo { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; background: #be1414; border-radius: 50%; border: none; color: #fff; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: #131313; border: 1px solid #2a2a2a; border-radius: 12px; padding: 32px; width: 100%; max-width: 420px; }
.modal-box h3 { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 2px; margin-bottom: 6px; }
.modal-sub { font-size: 12px; color: #555; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; padding: 11px; }

/* ── EXPORT ── */
.export-card { background: #131313; border: 1px solid #1e1e1e; border-radius: 10px; padding: 28px; max-width: 520px; }
.export-title { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 2px; margin-bottom: 8px; }
.export-desc { font-size: 13px; color: #666; line-height: 1.6; }

/* ── SHOWROOM PREVIEW ── */
.info-box { background: #131313; border: 1px solid #1e1e1e; border-radius: 8px; padding: 16px 20px; font-size: 13px; color: #666; margin-bottom: 20px; line-height: 1.6; }
.showroom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 14px; }
.showroom-card { background: #131313; border: 1px solid #1e1e1e; border-radius: 8px; overflow: hidden; }
.showroom-card-img { height: 120px; background: #1a1a1a; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #444; overflow: hidden; }
.showroom-card-img img { width: 100%; height: 100%; object-fit: cover; }
.showroom-card-body { padding: 12px; }
.showroom-card-color { font-size: 13px; font-weight: 500; }
.showroom-card-meta { font-size: 11px; color: #555; margin-top: 3px; }

/* ── USER LIST ── */
.user-card { background: #131313; border: 1px solid #1e1e1e; border-radius: 8px; padding: 14px 18px; margin-bottom: 8px; display: flex; align-items: center; gap: 14px; }
.u-avatar { width: 36px; height: 36px; border-radius: 50%; background: #1e1e1e; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: #be1414; flex-shrink: 0; }
.u-name { font-size: 14px; font-weight: 500; }
.u-email { font-size: 12px; color: #555; margin-top: 2px; }
.u-role { margin-left: auto; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 4px; }
.u-role.admin { background: rgba(190,20,20,0.15); color: #e06060; }
.u-role.staff { background: #1c1c1c; color: #666; }

/* ── MISC ── */
.empty-state { text-align: center; padding: 60px 24px; color: #333; }
.es-title { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 2px; color: #222; margin-bottom: 8px; }
.empty-state p { font-size: 13px; line-height: 1.6; }
.thumb-placeholder { width: 38px; height: 38px; border-radius: 4px; background: #161616; border: 1px solid #1e1e1e; display: flex; align-items: center; justify-content: center; }
.toast { position: fixed; bottom: 24px; right: 24px; background: #1e1e1e; border: 1px solid #2a2a2a; border-radius: 8px; padding: 12px 18px; font-size: 13px; color: #f0ece6; z-index: 200; transform: translateY(80px); opacity: 0; transition: all 0.25s; pointer-events: none; max-width: 320px; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(30,120,60,0.4); }
.toast.danger { border-color: rgba(190,20,20,0.4); }
.loading-overlay { position: fixed; inset: 0; background: rgba(10,10,10,0.85); z-index: 300; display: none; align-items: center; justify-content: center; }
.loading-overlay.active { display: flex; }
.spinner { width: 36px; height: 36px; border: 2px solid #2a2a2a; border-top-color: #be1414; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .sidebar { width: 180px; min-width: 180px; }
  .form-row { grid-template-columns: 1fr; }
}
