/* ============================================================
   FaroAuto Design System
   Light / Dark via [data-theme] on <html>
   ============================================================ */

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

/* THEME TOKENS */
:root {
  --bg:         #EEF2FF;
  --surface:    #FFFFFF;
  --card:       #FFFFFF;
  --border:     #E2E8F0;
  --hover:      #F1F5F9;
  --t1:         #0F172A;
  --t2:         #64748B;
  --t3:         #94A3B8;
  --accent:     #2563EB;
  --accent-bg:  rgba(37,99,235,.10);
  --accent-t:   #1D4ED8;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --fipe-grad:  linear-gradient(to right, #93c5fd 0%, #3b82f6 55%, #1d4ed8 100%);
}

[data-theme="dark"] {
  --bg:         #060a10;
  --surface:    #0b1018;
  --card:       #0f1620;
  --border:     #1e293b;
  --hover:      #1a2840;
  --t1:         #f1f5f9;
  --t2:         #94a3b8;
  --t3:         #475569;
  --accent:     #3b82f6;
  --accent-bg:  rgba(59,130,246,.12);
  --accent-t:   #60a5fa;
  --shadow-sm:  none;
  --shadow:     none;
  --fipe-grad:  linear-gradient(to right, #1e3a5f 0%, #2563eb 55%, #60a5fa 100%);
}

/* BASE */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--t1);
  display: flex;
  height: 100dvh;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
}

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

/* MATERIAL ICONS */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
  vertical-align: middle;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: background .2s, border-color .2s;
}

.sidebar-brand {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-icon .material-symbols-outlined { font-size: 17px; }

.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--t1);
  line-height: 1;
}

.brand-name em { font-style: normal; color: var(--accent); }

.brand-sub {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section-label {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t3);
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--t2);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.nav-item .material-symbols-outlined { font-size: 16px; }

.nav-item:hover  { background: var(--hover); color: var(--t1); }
.nav-item.active { background: var(--accent-bg); color: var(--accent-t); font-weight: 600; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-export-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: filter .12s;
}

.sidebar-export-btn .material-symbols-outlined { font-size: 13px; }
.sidebar-export-btn:hover { filter: brightness(1.1); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}

.sidebar-user:hover { background: var(--hover); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-size: 11.5px; font-weight: 600; color: var(--t1); line-height: 1.2; }
.user-role { font-size: 9.5px; color: var(--t3); }

/* ─── MAIN AREA ─── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ─── TOPBAR ─── */
.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 20;
  transition: background .2s, border-color .2s;
}

.topbar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--t1);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.vr {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  max-width: 300px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px 6px 30px;
  font-size: 11.5px;
  color: var(--t1);
  font-family: inherit;
  outline: none;
  transition: border-color .12s;
}

.topbar-search input::placeholder { color: var(--t3); }
.topbar-search input:focus { border-color: var(--accent); }

.search-icon {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t3);
  font-size: 15px;
  pointer-events: none;
}

.spacer { flex: 1; }

/* Icon button */
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--t2);
  cursor: pointer;
  transition: background .12s, color .12s;
  position: relative;
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--hover); color: var(--t1); }
.icon-btn .material-symbols-outlined { font-size: 19px; }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #EF4444;
  border: 2px solid var(--surface);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  transition: all .12s;
  flex-shrink: 0;
}

.btn .material-symbols-outlined { font-size: 15px; }

.btn-ghost {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--t1);
}
.btn-ghost:hover { background: var(--hover); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.2);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-success {
  background: #10B981;
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.2);
}
.btn-success:hover { filter: brightness(1.08); }

/* ─── CONTENT ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── CARD ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: background .2s, border-color .2s;
}

.card-p { padding: 16px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t1);
}

.card-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.card-icon .material-symbols-outlined { font-size: 13px; }

/* ─── BADGE ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-green { background: rgba(16,185,129,.1);  color: #10B981; border-color: rgba(16,185,129,.25); }
.badge-amber { background: rgba(245,158,11,.1);  color: #F59E0B; border-color: rgba(245,158,11,.25); }
.badge-red   { background: rgba(239,68,68,.1);   color: #EF4444; border-color: rgba(239,68,68,.25); }
.badge-blue  { background: var(--accent-bg);     color: var(--accent-t); border-color: rgba(59,130,246,.25); }
.badge-violet{ background: rgba(124,58,237,.1);  color: #7C3AED; border-color: rgba(124,58,237,.25); }

/* ─── DATA TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  text-align: left;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t3);
  padding: 0 20px 8px 0;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  font-size: 11.5px;
  padding: 9px 20px 9px 0;
  border-bottom: 1px solid var(--border);
  color: var(--t2);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: var(--hover); }

/* ─── LISTING ITEM ─── */
.listing-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s;
}

.listing-item:hover { background: var(--hover); }

.listing-item.below-avg {
  background: rgba(239,68,68,.04);
  border-color: rgba(239,68,68,.2);
}

.listing-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0;
}

.listing-thumb .material-symbols-outlined { font-size: 14px; }

/* ─── METRIC CARD ─── */
.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background .2s, border-color .2s;
}

.metric-kpi {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-kpi .material-symbols-outlined { font-size: 17px; }

.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ─── FIPE BAR ─── */
.fipe-bar {
  height: 5px;
  border-radius: 9999px;
  background: var(--fipe-grad);
  position: relative;
}

.fipe-tick {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  border-radius: 1px;
  background: var(--t3);
}

.fipe-label {
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.fipe-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2.5px solid #60a5fa;
  box-shadow: 0 0 8px rgba(96,165,250,.5);
}

/* ─── SPARKLINE ─── */
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.spark .spark-area { fill: url(#spark-grad); stroke: none; }

/* ─── VEHICLE THUMBNAILS ─── */
.thumb-slot {
  border-radius: 8px;
  background: var(--hover);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--t3);
}

/* ─── HOT DEAL ITEM ─── */
.hot-deal-item {
  padding: 10px;
  background: var(--hover);
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color .12s;
}

.hot-deal-item:hover { border-color: var(--accent); }

/* ─── GRID HELPERS ─── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }

/* ─── CHART PLACEHOLDER ─── */
.chart-wrap {
  height: 180px;
  position: relative;
}

.chart-y {
  position: absolute;
  left: 0;
  top: 0;
  height: calc(100% - 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10px;
  color: var(--t3);
}

.chart-area {
  margin-left: 38px;
  height: calc(100% - 20px);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.chart-grid-line {
  position: absolute;
  width: 100%;
  border-top: 1px dashed var(--border);
}

.chart-x {
  margin-left: 38px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--t3);
  margin-top: 5px;
}
