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

:root {
  --bg:       #0e0e0e;
  --bg2:      #161616;
  --bg3:      #1e1e1e;
  --bg4:      #262626;
  --border:   #2a2a2a;
  --border2:  #333;
  --text:     #f0ede8;
  --text2:    #9a9690;
  --text3:    #5a5652;
  --gold:     #c9a84c;
  --gold2:    #e8c97a;
  --gold-dim: rgba(201,168,76,0.12);
  --blue:     #5b9cf6;
  --blue-dim: rgba(91,156,246,0.12);
  --green:    #5ec47e;
  --green-dim:rgba(94,196,126,0.12);
  --red:      #e07070;
  --red-dim:  rgba(224,112,112,0.12);
  --amber:    #f0a940;
  --amber-dim:rgba(240,169,64,0.12);
  --radius:   12px;
  --radius-sm:8px;
  --radius-xs:6px;
  --font:     'DM Sans', -apple-system, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --nav-h:    64px;
  --header-h: 56px;
  --sidebar-w:220px;
  --shadow:   0 2px 12px rgba(0,0,0,0.4);
}


[data-theme="light"] {
  --bg:       #f5f4f0;
  --bg2:      #ffffff;
  --bg3:      #f0ede8;
  --bg4:      #e8e5e0;
  --border:   #dedad4;
  --border2:  #ccc9c4;
  --text:     #1a1814;
  --text2:    #5a5652;
  --text3:    #9a9690;
  --gold:     #b8922a;
  --gold2:    #9a7820;
  --gold-dim: rgba(184,146,42,0.12);
  --blue:     #2563eb;
  --blue-dim: rgba(37,99,235,0.1);
  --green:    #16a34a;
  --green-dim:rgba(22,163,74,0.1);
  --red:      #dc2626;
  --red-dim:  rgba(220,38,38,0.1);
  --amber:    #d97706;
  --amber-dim:rgba(217,119,6,0.1);
  --shadow:   0 2px 12px rgba(0,0,0,0.1);
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
input, select, textarea, button { font-family: var(--font); }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* Sidebar (desktop) */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon { font-size: 22px; }
.sidebar-logo-text { font-family: var(--font-serif); font-size: 18px; color: var(--gold); letter-spacing: 0.04em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { padding: 12px 12px 4px; font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-size: 13.5px; color: var(--text2);
  cursor: pointer; transition: all 0.15s;
  border-radius: 0; position: relative;
}
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--gold); background: var(--gold-dim); }
.nav-item.active::before { content:''; position:absolute; left:0; top:20%; bottom:20%; width:2px; background:var(--gold); border-radius:0 2px 2px 0; }
.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--gold); color: #1a1200; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 12px; color: var(--text3); padding: 4px 4px 8px; }
.sidebar-signout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 13px; color: var(--text3);
  cursor: pointer; border-radius: var(--radius-xs);
  transition: all 0.15s; border: 1px solid var(--border); background: none; width: 100%;
}
.sidebar-signout:hover { color: var(--red); border-color: var(--red); }

/* Main content */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* Header */
#header {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 90;
  gap: 12px;
}
#header-title { font-size: 16px; font-weight: 600; flex: 1; }
#header-actions { display: flex; gap: 8px; align-items: center; }

/* Content area */
#content { flex: 1; padding: 20px; max-width: 1200px; }

/* Bottom nav (mobile) */
#bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 4px;
  justify-content: space-around; align-items: center;
}
.bnav-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 12px;
  cursor: pointer; border-radius: var(--radius-xs);
  transition: all 0.15s; flex: 1;
  font-size: 10px; color: var(--text3); font-weight: 500;
}
.bnav-item .bnav-icon { font-size: 18px; }
.bnav-item.active { color: var(--gold); }
.bnav-more { position: relative; }

/* Mobile header */
#mobile-header {
  display: none;
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 90;
  gap: 10px;
}
.mobile-logo-text { font-family: var(--font-serif); font-size: 17px; color: var(--gold); flex: 1; }

/* ── Views ───────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Components ──────────────────────────────────────────────────────────── */
/* Cards */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; font-family: var(--font); }
.btn-primary { background: var(--gold); color: #1a1200; }
.btn-primary:hover { background: var(--gold2); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { border-color: var(--text2); }
.btn-ghost { background: none; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text2); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(224,112,112,0.2); }
.btn-danger:hover { background: rgba(224,112,112,0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 15px; color: var(--text2); transition: all 0.15s; }
.btn-icon:hover { color: var(--text); border-color: var(--text2); }

/* Fields */
.field-label { display: block; font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; margin-bottom: 5px; }
.field { width: 100%; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text); font-size: 14px; font-family: var(--font); outline: none; transition: border-color 0.15s; }
.field:focus { border-color: var(--gold); }
.field::placeholder { color: var(--text3); }
select.field { cursor: pointer; }
textarea.field { resize: vertical; min-height: 80px; }
.field-group { display: flex; flex-direction: column; gap: 0; }
.form-row { margin-bottom: 14px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Status badges */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-gold { background: var(--gold-dim); color: var(--gold); }
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-gray { background: var(--bg4); color: var(--text2); }

/* List items */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg3); }
.list-item-icon { font-size: 20px; width: 36px; height: 36px; background: var(--bg4); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 12px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-right { text-align: right; flex-shrink: 0; }
.list-item-value { font-size: 14px; font-weight: 600; color: var(--gold2); }
.list-item-tag { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; margin-bottom: 16px; }

/* Search bar */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gold2); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-sub { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* Section header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 14px; font-weight: 600; color: var(--text); }

/* Toast */
#toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg4); border: 1px solid var(--border2);
  color: var(--text); padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 999;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Modal overlay */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); z-index: 200;
  align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  padding: 0;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; padding: 2px; line-height: 1; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }

/* Loading spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border2); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.toggle-label { font-size: 13.5px; color: var(--text); }
.toggle-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--bg4); border-radius: 22px; cursor: pointer; transition: 0.2s; border: 1px solid var(--border2); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--text3); border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .toggle-slider { background: var(--gold-dim); border-color: var(--gold); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--gold); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Dashboard ───────────────────────────────────────────────────────────── */
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--bg3); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 500; }
.alert-sub { font-size: 11.5px; color: var(--text2); margin-top: 2px; }

/* ── Watch cards ─────────────────────────────────────────────────────────── */
.watch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.watch-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.watch-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.watch-card-img { height: 130px; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text3); }
.watch-card-body { padding: 12px; }
.watch-card-brand { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; }
.watch-card-model { font-size: 14px; font-weight: 600; margin: 2px 0 6px; }
.watch-card-footer { display: flex; align-items: center; justify-content: space-between; }
.watch-card-price { font-size: 15px; font-weight: 700; color: var(--gold2); }
.watch-card-stock { font-size: 11px; color: var(--text3); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #main { margin-left: 0; padding-bottom: var(--nav-h); }
  #header { display: none; }
  #mobile-header { display: flex; }
  #bottom-nav { display: flex; }
  #content { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .form-row.three-col { grid-template-columns: 1fr 1fr; }
  .watch-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; }
  #toast { bottom: calc(var(--nav-h) + 16px); }
}
@media (max-width: 400px) {
  .watch-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 769px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: var(--radius); }
  #toast { bottom: 24px; }
}

/* Theme toggle */
.theme-toggle {
  background: none; border: 1px solid var(--border);
  color: var(--text2); border-radius: var(--radius-sm);
  padding: 6px 10px; cursor: pointer; font-size: 14px;
  transition: all 0.15s; line-height: 1;
}
.theme-toggle:hover { border-color: var(--text2); color: var(--text); }
