/* ============================================================
   AutoAssist Pro — Design System (estilo shadcn/ui em CSS puro)
   Sem build, sem Node. Edite os tokens em :root para mudar o tema.
   ============================================================ */

:root {
  /* Tokens de cor (HSL, padrão shadcn "zinc") */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 71% 45%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5% 64.9%;
  --radius: 0.625rem;

  --sidebar-width: 256px;
  --header-height: 60px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }

/* ----------------------------- Layout shell ----------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: hsl(var(--background));
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform 0.2s ease;
}
.sidebar__brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid hsl(var(--border));
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.sidebar__logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.sidebar__brand small { display:block; font-weight:500; font-size:11px; color:hsl(var(--muted-foreground)); letter-spacing:0; }
.sidebar__logo-img { width:30px; height:30px; border-radius:8px; object-fit:contain; background:#fff; border:1px solid hsl(var(--border)); flex:none; }
.auth-brand img.marca-logo { width:52px; height:52px; object-fit:contain; border-radius:12px; margin:0 auto 12px; display:block; background:#fff; }
.sidebar__nav { padding: 12px; flex: 1; overflow-y: auto; }
.sidebar__group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--muted-foreground)); padding: 14px 12px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground));
  font-weight: 500; margin-bottom: 2px;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav-link.is-active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.sidebar__footer { padding: 12px; border-top: 1px solid hsl(var(--border)); }
.user-chip { display:flex; align-items:center; gap:10px; padding:8px; border-radius:var(--radius); }
.user-chip__avatar { width:32px; height:32px; border-radius:50%; background:hsl(var(--secondary)); color:hsl(var(--secondary-foreground)); display:grid; place-items:center; font-weight:600; font-size:13px; }
.user-chip__name { font-weight:600; font-size:13px; }
.user-chip__role { font-size:11px; color:hsl(var(--muted-foreground)); text-transform:capitalize; }

.main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }
.topbar {
  height: var(--header-height);
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: none; padding: 6px; border-radius: 8px; color: hsl(var(--foreground)); }
.menu-toggle:hover { background: hsl(var(--accent)); }
.content { padding: 24px; max-width: 1280px; }

/* ----------------------------- Cards ----------------------------- */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 hsl(240 5% 10% / 0.04);
}
.card__header { padding: 20px 20px 0; }
.card__title { font-size: 15px; font-weight: 600; }
.card__desc { font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }

/* KPI cards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 2px 0 hsl(240 5% 10% / 0.04); }
.kpi__label { font-size: 13px; color: hsl(var(--muted-foreground)); font-weight: 500; display:flex; align-items:center; justify-content:space-between; }
.kpi__label svg { width: 16px; height: 16px; opacity: 0.5; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; }
.kpi__hint { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 4px; }

/* ----------------------------- Buttons ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: calc(var(--radius) - 2px);
  font-weight: 500; font-size: 14px; border: 1px solid transparent;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  transition: opacity 0.12s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.9; }
.btn svg { width: 16px; height: 16px; }
.btn--outline { background: hsl(var(--background)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn--outline:hover { background: hsl(var(--accent)); opacity: 1; }
.btn--ghost { background: transparent; color: hsl(var(--foreground)); }
.btn--ghost:hover { background: hsl(var(--accent)); opacity: 1; }
.btn--destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 38px; padding: 0; }
.btn--block { width: 100%; }

/* ----------------------------- Forms ----------------------------- */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px; color: hsl(var(--foreground)); font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.25);
}
.input::placeholder, .textarea::placeholder { color: hsl(var(--muted-foreground)); }
.field-hint { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.col-span-full { grid-column: 1 / -1; }

/* ----------------------------- Badges ----------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.6;
  border: 1px solid transparent;
}
.badge--neutral { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge--estoque { background: hsl(217 91% 96%); color: hsl(217 91% 40%); }
.badge--reservado { background: hsl(38 92% 95%); color: hsl(32 81% 38%); }
.badge--vendido { background: hsl(142 71% 95%); color: hsl(142 71% 30%); }
.badge--perdido { background: hsl(0 72% 96%); color: hsl(0 72% 45%); }
.badge--dot::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ----------------------------- Tables ----------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-weight: 500; font-size: 12px;
  color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: 0.03em;
  padding: 10px 16px; border-bottom: 1px solid hsl(var(--border)); white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.1s; }
table.data tbody tr:hover { background: hsl(var(--muted) / 0.6); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-success { color: hsl(var(--success)); font-weight: 600; }
.text-destructive { color: hsl(var(--destructive)); font-weight: 600; }
.text-strong { font-weight: 600; }

/* ----------------------------- Misc ----------------------------- */
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { color: hsl(var(--muted-foreground)); margin-top: 4px; font-size: 14px; }
.row { display:flex; align-items:center; gap:10px; }
.row--wrap { flex-wrap: wrap; }
.stack { display:flex; flex-direction:column; gap:6px; }
.mt-24 { margin-top: 24px; } .mb-16 { margin-bottom:16px; }
.grid-2 { display:grid; grid-template-columns: 2fr 1fr; gap:24px; align-items:start; }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert--error { background: hsl(0 72% 97%); border-color: hsl(0 72% 90%); color: hsl(0 72% 40%); }
.alert--success { background: hsl(142 71% 96%); border-color: hsl(142 60% 85%); color: hsl(142 71% 28%); }

.empty { text-align:center; padding: 48px 24px; color: hsl(var(--muted-foreground)); }
.empty svg { width: 40px; height:40px; opacity:0.4; margin-bottom: 12px; }
.empty h3 { color: hsl(var(--foreground)); margin-bottom: 4px; }

.thumb { width: 48px; height: 36px; border-radius: 6px; object-fit: cover; background: hsl(var(--secondary)); display:grid; place-items:center; color:hsl(var(--muted-foreground)); }

.vehicle-photo { width:100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--radius); background: hsl(var(--secondary)); display:grid; place-items:center; color:hsl(var(--muted-foreground)); }

.dl { display:grid; grid-template-columns: auto 1fr; gap: 10px 20px; font-size: 14px; }
.dl dt { color: hsl(var(--muted-foreground)); }
.dl dd { font-weight: 500; text-align: right; }

/* ----------------------------- Login ----------------------------- */
.auth-wrap { min-height: 100vh; display:grid; place-items:center; padding: 24px; background: hsl(var(--muted)); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align:center; margin-bottom: 24px; }
.auth-brand .sidebar__logo { width:44px; height:44px; font-size:20px; margin:0 auto 12px; }
.auth-brand h1 { font-size: 20px; }
.auth-brand p { color: hsl(var(--muted-foreground)); font-size: 13px; margin-top: 4px; }

/* ----------------------------- Relatórios: gráficos ----------------------------- */
.chart { display:flex; align-items:flex-end; gap:14px; min-height:210px; overflow-x:auto; padding-top:8px; }
.chart__col { display:flex; flex-direction:column; align-items:center; gap:6px; min-width:56px; flex:1; justify-content:flex-end; }
.chart__val { font-size:11px; color:hsl(var(--muted-foreground)); font-variant-numeric:tabular-nums; white-space:nowrap; }
.chart__bar { width:100%; max-width:48px; background:linear-gradient(180deg, hsl(var(--primary)), hsl(var(--primary)/0.7)); border-radius:6px 6px 0 0; transition:height .3s; }
.chart__lbl { font-size:12px; font-weight:600; }
.chart__sub { font-size:11px; color:hsl(var(--muted-foreground)); }

.hbars { display:flex; flex-direction:column; gap:14px; }
.hbar__top { display:flex; justify-content:space-between; font-size:13px; margin-bottom:6px; }
.hbar__track { height:8px; background:hsl(var(--secondary)); border-radius:999px; overflow:hidden; }
.hbar__fill { height:100%; background:hsl(var(--primary)); border-radius:999px; }

/* ----------------------------- CRM: Kanban ----------------------------- */
.kanban { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(240px,1fr); gap:14px; overflow-x:auto; padding-bottom:8px; align-items:start; }
.kanban__col { background:hsl(var(--muted)/0.5); border:1px solid hsl(var(--border)); border-radius:var(--radius); display:flex; flex-direction:column; min-height:120px; }
.kanban__head { display:flex; align-items:center; justify-content:space-between; padding:12px 14px; font-weight:600; font-size:13px; border-bottom:1px solid hsl(var(--border)); }
.kanban__count { background:hsl(var(--secondary)); color:hsl(var(--secondary-foreground)); border-radius:999px; min-width:22px; height:22px; display:grid; place-items:center; font-size:12px; padding:0 6px; }
.kanban__body { padding:10px; display:flex; flex-direction:column; gap:10px; }
.kanban__empty { text-align:center; color:hsl(var(--muted-foreground)); padding:10px; font-size:13px; }
.kanban__col--vendido .kanban__head { color:hsl(142 71% 30%); }
.kanban__col--perdido .kanban__head { color:hsl(0 72% 45%); }

.lead { background:hsl(var(--card)); border:1px solid hsl(var(--border)); border-radius:calc(var(--radius) - 2px); padding:12px; box-shadow:0 1px 2px hsl(240 5% 10% / 0.04); }
.lead__name { font-weight:600; font-size:14px; display:block; }
.lead__name:hover { text-decoration:underline; }
.lead__veic { font-size:12px; color:hsl(var(--muted-foreground)); display:flex; align-items:center; gap:5px; margin-top:4px; }
.lead__veic svg { width:13px; height:13px; }
.lead__meta { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; flex-wrap:wrap; }
.lead__wa { font-size:12px; color:hsl(142 71% 32%); font-weight:500; }
.lead__wa:hover { text-decoration:underline; }
.lead__move { margin-top:10px; }
.lead__select { width:100%; height:32px; font-size:12px; border:1px solid hsl(var(--input)); border-radius:8px; background:hsl(var(--background)); padding:0 8px; color:hsl(var(--foreground)); }

/* ----------------------------- CRM: Timeline ----------------------------- */
.timeline { position:relative; padding-left:18px; }
.timeline::before { content:""; position:absolute; left:4px; top:4px; bottom:4px; width:2px; background:hsl(var(--border)); }
.tl-item { position:relative; padding:0 0 16px; }
.tl-item:last-child { padding-bottom:0; }
.tl-dot { position:absolute; left:-18px; top:4px; width:10px; height:10px; border-radius:50%; background:hsl(var(--primary)); border:2px solid hsl(var(--background)); }
.tl-text { font-size:14px; }
.tl-meta { font-size:12px; color:hsl(var(--muted-foreground)); margin-top:3px; display:flex; align-items:center; gap:8px; }
.tl-del { background:none; border:none; color:hsl(var(--muted-foreground)); cursor:pointer; font-size:12px; padding:0 2px; }
.tl-del:hover { color:hsl(var(--destructive)); }

/* Galeria de fotos (admin) */
.gallery { display:grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap:10px; }
.gallery__item { position:relative; aspect-ratio:4/3; border-radius:var(--radius); overflow:hidden; border:1px solid hsl(var(--border)); background:hsl(var(--secondary)); }
.gallery__item img { width:100%; height:100%; object-fit:cover; display:block; }
.gallery__capa { position:absolute; top:6px; left:6px; background:hsl(var(--primary)); color:hsl(var(--primary-foreground)); font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px; }
.gallery__actions { position:absolute; bottom:0; left:0; right:0; display:flex; justify-content:flex-end; gap:2px; padding:4px; background:linear-gradient(transparent, hsl(0 0% 0% / 0.5)); }
.gallery__actions .btn { background:hsl(0 0% 100% / 0.9); }

/* Backdrop for mobile sidebar */
.backdrop { display:none; position:fixed; inset:0; background: hsl(240 10% 4% / 0.4); z-index: 35; }

/* ----------------------------- Responsivo ----------------------------- */
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .backdrop.is-open { display: block; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
