/* ==========================================================================
   MotoGestão — Automotive Noir
   Design system: tokens → base → shell → componentes → módulos → motion → responsivo
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;
  /* Superfícies: o preto domina */
  --ink-0: #080809;          /* fundo absoluto */
  --ink-1: #111114;          /* painéis */
  --ink-2: #1A1A1F;          /* campos, elevados */
  --ink-3: #24242B;          /* pressionado, trilhos */
  --line: rgba(245, 245, 247, .07);
  --line-2: rgba(245, 245, 247, .12);
  --line-3: rgba(245, 245, 247, .22);
  /* Texto */
  --fg: #F5F5F7;
  --fg-2: #92929C;
  --fg-3: #63636D;
  /* Assinatura */
  --red: #E50924;
  --red-hover: #F2152F;
  --red-deep: #970B1D;
  --red-text: #FF4458;       /* vermelho legível em texto pequeno (≥ 4.5:1) */
  --red-wash: rgba(229, 9, 36, .11);
  /* Estados (reservados, sempre com rótulo) */
  --ok: #4CC38A;
  --ok-wash: rgba(76, 195, 138, .1);
  --warn: #E5A93B;
  --warn-wash: rgba(229, 169, 59, .1);
  /* Séries de gráfico */
  --series-1: #E50924;
  --series-2: #C8C8CF;
  --bar-neutral: #C8C8CF;
  /* Tipografia */
  --font: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wide: 118%;
  --wider: 125%;
  /* Forma */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  /* Espaço (base 4) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* Movimento */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 150ms;
  --t-base: 220ms;
  --t-slow: 350ms;
  /* Shell */
  --sb-w: 244px;
  --sb-wc: 72px;
  --tabbar-h: 64px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink-0);
  color: var(--fg);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
small { font-size: 12px; }
svg.i { flex-shrink: 0; display: block; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: var(--r-xs); }
.num, table, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--fg); color: var(--ink-0); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; transition: top var(--t-fast); }
.skip:focus { top: 12px; }

/* ---------- 3. Marca ---------- */
img.mark { display: block; width: 30px; height: 30px; flex-shrink: 0; border-radius: 7px; object-fit: contain; }
.wordmark {
  font-weight: 700;
  font-stretch: var(--wider);
  font-size: 15px;
  letter-spacing: -.02em;
  white-space: nowrap;
}

/* ---------- 4. Shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

/* Sidebar */
.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  width: var(--sb-w); flex: 0 0 var(--sb-w);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  background: var(--ink-0);
  border-right: 1px solid var(--line);
  z-index: 40;
  transition: width var(--t-slow) var(--ease-out), flex-basis var(--t-slow) var(--ease-out);
  view-transition-name: sidebar;
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 8px 0 9px; margin-bottom: 28px; }
.sb-logo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sb-logo .wordmark { overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sb-logo .wordmark, .sb-link span, .sb-cta span, .sb-user-text, .sb-count { transition: opacity var(--t-fast) var(--ease-out); }
.sb-toggle, .sb-close {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  transition: color var(--t-fast), background var(--t-fast);
}
.sb-toggle:hover, .sb-close:hover { color: var(--fg); background: var(--ink-2); }
.sb-close { display: none; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-link, .sb-cta {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.sb-link:hover { color: var(--fg); background: rgba(245, 245, 247, .035); }
.sb-link.is-active { color: var(--fg); background: var(--ink-1); }
.sb-link.is-active .i { color: var(--red); }
/* Indicador ativo: encosta na borda do menu e desliza entre páginas (View Transitions) */
.sb-ind {
  position: absolute;
  left: -12px; top: 9px; bottom: 9px;
  width: 2px;
  background: var(--red);
  border-radius: 0 2px 2px 0;
  view-transition-name: nav-indicator;
}
.sb-count {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: var(--r-xs);
  background: var(--red-wash);
  color: var(--red-text);
  font-size: 11.5px; font-weight: 600;
}
.sb-cta {
  margin-top: 18px;
  color: var(--fg);
  border: 1px solid var(--line-2);
}
.sb-cta .i { color: var(--red); }
.sb-cta:hover { border-color: var(--line-3); background: var(--ink-1); }
.sb-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 6px 0 6px;
  border-top: 1px solid var(--line);
}
.sb-user { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.avatar {
  display: grid; place-items: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  font-size: 12px; font-weight: 600;
  font-stretch: var(--wide);
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; border-radius: var(--r-md); }
.sb-user-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sb-user-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-text small { color: var(--fg-3); }
.sb-logout { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--fg-3); transition: color var(--t-fast), background var(--t-fast); }
.sb-logout:hover { color: var(--fg); background: var(--ink-2); }

/* Sidebar recolhida */
.nav-collapsed .sidebar { width: var(--sb-wc); flex-basis: var(--sb-wc); }
.nav-collapsed .sb-logo .wordmark,
.nav-collapsed .sb-link span,
.nav-collapsed .sb-cta span,
.nav-collapsed .sb-user-text,
.nav-collapsed .sb-count { opacity: 0; pointer-events: none; }
.nav-collapsed .sb-brand { flex-direction: column; height: auto; gap: 14px; padding: 0; align-items: center; }
.nav-collapsed .sb-toggle .i { transform: scaleX(-1); }
.nav-collapsed .sb-foot { flex-direction: column; padding: 14px 0 0; }
.nav-collapsed .sb-user { flex: none; }
.nav-collapsed .sb-user-text { position: absolute; }
.nav-collapsed .sb-link, .nav-collapsed .sb-cta { overflow: visible; }
.nav-collapsed .sb-link span, .nav-collapsed .sb-cta span, .nav-collapsed .sb-logo .wordmark { position: absolute; }
/* Tooltip refinado (apenas recolhido) */
.nav-collapsed [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 14px); top: 50%;
  padding: 6px 10px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-4px, -50%);
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .8);
  z-index: 50;
}
.nav-collapsed [data-tip]:hover::after,
.nav-collapsed [data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.nav-collapsed .sb-logout { position: relative; }

/* Área principal */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 60px;
  padding: 0 40px;
  background: rgba(8, 8, 9, .82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.tb-brand { display: none; }
.tb-date { color: var(--fg-2); font-size: 13px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.tb-hello { font-size: 13px; color: var(--fg-2); }
.tb-bell { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--fg-2); transition: color var(--t-fast), background var(--t-fast); }
.tb-bell:hover { color: var(--fg); background: var(--ink-1); }
.tb-bell b {
  position: absolute; top: 3px; right: 1px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--red); color: #fff;
  border: 2px solid var(--ink-0);
  border-radius: 9px;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.content {
  width: 100%; max-width: 1480px;
  margin: 0 auto;
  padding: 36px 40px 64px;
  flex: 1;
  view-transition-name: content;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-title { min-width: 0; }
.page-title h1 {
  font-size: clamp(26px, 2.3vw, 34px);
  font-weight: 650;
  font-stretch: var(--wide);
  letter-spacing: -.025em;
  line-height: 1.08;
}
.page-title p { margin-top: 8px; color: var(--fg-2); max-width: 64ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.tabbar, .scrim { display: none; }

/* ---------- 5. Componentes ---------- */

/* Botões */
.btn {
  --h: 40px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h);
  padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
  user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-hover); box-shadow: 0 8px 24px -10px rgba(229, 9, 36, .75); }
.btn.ghost { background: var(--ink-2); border-color: var(--line-2); color: var(--fg); }
.btn.ghost:hover { background: var(--ink-3); border-color: var(--line-3); }
.btn.quiet { color: var(--fg-2); padding: 0 10px; }
.btn.quiet:hover { color: var(--fg); background: var(--ink-2); }
.btn.danger { border-color: rgba(229, 9, 36, .35); color: var(--red-text); }
.btn.danger:hover { background: var(--red-wash); border-color: rgba(229, 9, 36, .6); }
.btn.lg { --h: 48px; padding: 0 22px; font-size: 14.5px; }
.btn.sm { --h: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: var(--h); }
.btn.is-off { opacity: .35; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading .i { opacity: 0; }
.btn.is-loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.link { display: inline-flex; align-items: center; gap: 4px; color: var(--fg-2); font-size: 13px; font-weight: 500; transition: color var(--t-fast); white-space: nowrap; }
.link:hover { color: var(--fg); }
.link .i { transition: transform var(--t-fast) var(--ease-out); }
.link:hover .i { transform: translateX(2px); }
.link.red { color: var(--red-text); }

/* Campos */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--fg-2); transition: color var(--t-fast); }
.field > span em { font-style: normal; color: var(--fg-3); font-weight: 400; }
.field:focus-within > span { color: var(--fg); }
.field:has(:user-invalid) > span { color: var(--red-text); }
input, select, textarea {
  width: 100%; min-width: 0;
  height: 42px;
  padding: 0 12px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-base) var(--ease-out);
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
input:focus, select:focus, textarea:focus { border-color: var(--red); background: var(--ink-1); box-shadow: 0 0 0 3px rgba(229, 9, 36, .16); }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--red); }
input::placeholder, textarea::placeholder { color: var(--fg-3); }
input[type="date"] { color-scheme: dark; }
input[type="file"] { height: auto; padding: 8px; font-size: 13px; color: var(--fg-2); }
input[type="file"]::file-selector-button { margin-right: 12px; height: 30px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--ink-3); color: var(--fg); font: 500 13px var(--font); cursor: pointer; }
input.money, .money input { text-align: right; font-variant-numeric: tabular-nums; }
select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2392929C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
option { background: var(--ink-2); color: var(--fg); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.hint { font-size: 12.5px; color: var(--fg-2); display: flex; gap: 8px; align-items: flex-start; }
.hint .i { color: var(--fg-3); margin-top: 1px; }
/* Revelação progressiva de campos condicionais */
.reveal { display: grid; grid-template-rows: 1fr; transition: grid-template-rows var(--t-slow) var(--ease-out), opacity var(--t-base) var(--ease-out); }
.reveal > * { min-height: 0; overflow: hidden; }
.reveal.is-closed { grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
/* item fechado ocupa uma linha de altura zero: anula um dos dois gaps */
.form-grid > .reveal.is-closed { margin-bottom: -18px; }
.reveal.is-closed > * { visibility: hidden; transition: visibility 0s linear var(--t-slow); }

/* Painéis */
.panel { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 24px; min-width: 0; }
.panel.flush { padding: 0; }
.panel.flush .panel-head { padding: 20px 24px 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 20px; }
.panel-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head p { margin-top: 3px; color: var(--fg-2); font-size: 12.5px; }
.panel-head .aside { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.panel h3 { font-size: 13px; font-weight: 600; color: var(--fg-2); margin-bottom: 12px; }
.divider { height: 1px; background: var(--line); margin: 24px 0; }
.vstack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-21.start, .grid-2.start { align-items: start; }
.grid-21 { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; }
.grid-12 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; }
.mt { margin-top: 16px; }
.mt-l { margin-top: 32px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.section-title h2 { font-size: 18px; font-weight: 600; font-stretch: var(--wide); letter-spacing: -.015em; }
.section-title p { color: var(--fg-2); font-size: 13px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-xs);
  background: var(--ink-2);
  color: var(--fg-2);
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { color: var(--ok); background: var(--ok-wash); }
.badge.warn { color: var(--warn); background: var(--warn-wash); }
.badge.danger { color: var(--red-text); background: var(--red-wash); }
.badge.light { color: var(--fg); background: var(--ink-3); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: var(--r-xs); font-size: 12px; color: var(--fg-2); white-space: nowrap; }

/* Chips de filtro rápido e controle segmentado */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 13px; font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.chip:hover { color: var(--fg); border-color: var(--line-3); }
.chip.is-on { background: var(--fg); border-color: var(--fg); color: var(--ink-0); }
.chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-sm); }
.seg button { display: grid; place-items: center; width: 34px; height: 30px; border-radius: var(--r-xs); color: var(--fg-3); transition: color var(--t-fast), background var(--t-fast); }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--ink-3); color: var(--fg); }

/* Barra de filtros */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.toolbar input, .toolbar select, .toolbar .btn { height: 38px; }
.search { position: relative; }
.search .i { position: absolute; left: 12px; bottom: 10px; color: var(--fg-3); pointer-events: none; }
.search input { padding-left: 38px; }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th {
  padding: 12px 16px;
  font-size: 12px; font-weight: 500;
  color: var(--fg-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: rgba(245, 245, 247, .022); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table .r { text-align: right; }
.table .strong { font-weight: 600; }
.cell-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-main strong { font-weight: 600; }
.cell-main small { color: var(--fg-2); }
.cell-person { display: flex; align-items: center; gap: 12px; }
.table td.empty-cell { padding: 0; }

/* Progresso */
.meter { position: relative; height: 4px; border-radius: 2px; background: var(--ink-3); overflow: hidden; min-width: 80px; }
.meter b { position: absolute; inset: 0 auto 0 0; width: var(--v, 0%); background: var(--fg); border-radius: 2px; transform-origin: left; animation: grow-x .7s var(--ease-out) both; }
.meter.red b { background: var(--red); }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .meter { flex: 1; }
.meter-row span { font-size: 12px; color: var(--fg-2); min-width: 36px; text-align: right; }

/* Lista de informações */
.info { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; }
.info dt, .info dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.info dt { color: var(--fg-2); }
.info dd { text-align: right; overflow-wrap: anywhere; font-weight: 500; }
.info dt:last-of-type, .info dd:last-of-type { border-bottom: 0; }

/* Estado vazio */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--fg-2); }
.empty .i { color: var(--fg-3); margin-bottom: 4px; }
.empty strong { color: var(--fg); font-weight: 600; font-size: 14px; }
.empty p { font-size: 13px; max-width: 44ch; }
.empty .btn { margin-top: 8px; }

/* Skeleton */
.skeleton { position: relative; overflow: hidden; background: var(--ink-2); border-radius: var(--r-sm); }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(245, 245, 247, .04), transparent); transform: translateX(-100%); animation: shimmer 1.3s infinite; }

/* Paginação */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--fg-2); }
.pager > div { display: flex; align-items: center; gap: 8px; }
.pager-pos { min-width: 52px; text-align: center; }

/* Avisos */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-1); color: var(--fg-2); font-size: 13px; line-height: 1.55; }
.notice .i { color: var(--fg); margin-top: 1px; }
.notice.red { border-color: rgba(229, 9, 36, .3); background: var(--red-wash); }
.notice.red .i { color: var(--red-text); }

/* Toasts */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 12px;
  width: min(400px, calc(100vw - 32px));
  padding: 14px 14px 14px 16px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, .85);
  animation: toast-in var(--t-slow) var(--ease-out) both;
}
.toast::before { content: ''; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; background: var(--ok); border-radius: 2px; }
.toast { position: relative; }
.toast.error::before { background: var(--red); }
.toast > .i { color: var(--ok); margin-top: 1px; }
.toast.error > .i { color: var(--red-text); }
.toast > .i path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s .15s var(--ease-out) forwards; }
.toast p { flex: 1; font-size: 13.5px; line-height: 1.45; }
.toast-x { color: var(--fg-3); padding: 2px; border-radius: var(--r-xs); }
.toast-x:hover { color: var(--fg); }
.toast.out { animation: toast-out var(--t-base) var(--ease-io) forwards; }

/* Modais e gavetas */
.modal {
  position: fixed; inset: 0; z-index: 70;
  display: flex;
  padding: 24px;
  overflow-y: auto;
  background: rgba(8, 8, 9, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-base) var(--ease-out), visibility 0s linear var(--t-base);
}
.modal.open { opacity: 1; visibility: visible; transition-delay: 0s; }
.modal-box {
  margin: auto;
  width: min(600px, 100%);
  background: var(--ink-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 48px 96px -24px rgba(0, 0, 0, .9);
  transform: translateY(10px) scale(.97);
  transition: transform var(--t-slow) var(--ease-out);
}
.modal-box.sm { width: min(420px, 100%); }
.modal.open .modal-box { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; font-weight: 600; font-stretch: var(--wide); }
.modal-head p { font-size: 12.5px; color: var(--fg-2); margin-top: 2px; }
.modal-body { padding: 24px; }
.modal-foot {
  position: sticky; bottom: 0;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  background: var(--ink-1);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.x-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); color: var(--fg-2); transition: color var(--t-fast), background var(--t-fast); }
.x-btn:hover { color: var(--fg); background: var(--ink-2); }
/* Gaveta lateral */
.modal.drawer { padding: 0; }
.modal.drawer .modal-box {
  margin: 0 0 0 auto;
  width: min(540px, 100%);
  min-height: 100%;
  border-width: 0 0 0 1px;
  border-radius: 0;
  display: flex; flex-direction: column;
  transform: translateX(32px);
}
.modal.drawer .modal-box > form { display: flex; flex-direction: column; flex: 1; }
.modal.drawer .modal-body { flex: 1; }
.modal.drawer .modal-foot { border-radius: 0; }
.modal.open.drawer .modal-box { transform: none; }
.confirm-body { text-align: left; }
.confirm-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--red-wash); color: var(--red-text); margin-bottom: 16px; }
.confirm-body h2 { font-size: 17px; font-stretch: var(--wide); margin-bottom: 6px; }
.confirm-body p { color: var(--fg-2); }

/* ---------- 6. Gráficos ---------- */
.chart { position: relative; height: 260px; }
.chart.sm { height: 200px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-dasharray: 2 4; }
.chart .axis text { fill: var(--fg-3); font: 400 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .x-axis text { fill: var(--fg-2); }
.chart .s-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .s-area { opacity: .1; }
.chart .dot { stroke: var(--ink-1); stroke-width: 2; opacity: 0; transition: opacity var(--t-fast); }
.chart .dot.on { opacity: 1; }
.chart .cross { stroke: var(--line-3); stroke-width: 1; opacity: 0; transition: opacity var(--t-fast); }
.chart .cross.on { opacity: 1; }
.chart .bar { transition: opacity var(--t-fast); }
.chart.hovering .bar { opacity: .35; }
.chart.hovering .bar.on { opacity: 1; }
.chart .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw-line .9s var(--ease-out) .1s forwards; }
.chart .rise { transform-box: fill-box; transform-origin: bottom; animation: rise-y .6s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms + 80ms); }
.chart .fade { animation: area-in .6s var(--ease-out) .35s both; }
@keyframes area-in { from { opacity: 0; } to { opacity: .1; } }
.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 5;
  min-width: 170px;
  padding: 10px 12px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .9);
  font-size: 12.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast), transform var(--t-base) var(--ease-out);
}
.chart-tip.on { opacity: 1; }
.chart-tip strong { display: block; font-weight: 600; margin-bottom: 6px; }
.chart-tip div { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.chart-tip div + div { margin-top: 3px; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.chart-tip b { margin-left: auto; padding-left: 12px; color: var(--fg); font-weight: 600; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg-3); font-size: 13px; text-align: center; padding: 20px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 2px; border-radius: 1px; }
.legend i.box { width: 8px; height: 8px; border-radius: 2px; }

/* Barras horizontais (rankings, distribuição) */
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; }
.hbar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.hbar-name small { color: var(--fg-3); margin-left: 6px; }
.hbar-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar-val small { color: var(--fg-3); font-weight: 400; margin-left: 6px; }
.hbar-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--ink-2); overflow: hidden; }
.hbar-track b { display: block; height: 100%; width: var(--w); background: var(--bar-neutral); border-radius: 3px; transform-origin: left; animation: grow-x .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
.hbar-track b.red { background: var(--red); }

/* Ranking numerado (é uma ordem real) */
.rank { display: flex; flex-direction: column; }
.rank a, .rank > div { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
.rank > :last-child { border-bottom: 0; }
.rank a:hover .rank-name { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.rank-pos { font-stretch: var(--wider); font-weight: 650; font-size: 13px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.rank > :first-child .rank-pos { color: var(--red-text); }
.rank-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank small { color: var(--fg-2); }
.rank-val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- 7. Painel (dashboard) ---------- */
.period { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.period form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period input, .period select { height: 36px; width: auto; font-size: 13px; }
.period input[type="date"] { width: 148px; }
.period .btn { height: 36px; }
.period-sep { color: var(--fg-3); }

/* Cluster de instrumentos: hero + medidores secundários numa peça só */
.cluster { position: relative; background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cluster::before {
  content: '';
  position: absolute; right: -10%; top: -60%;
  width: 60%; height: 160%;
  background: radial-gradient(closest-side, rgba(151, 11, 29, .22), transparent);
  pointer-events: none;
}
.hero { position: relative; padding: 28px 32px 26px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hero-label { color: var(--fg-2); font-size: 13.5px; }
.hero-value {
  margin-top: 10px;
  font-size: clamp(40px, 5.4vw, 76px);
  font-weight: 700;
  font-stretch: var(--wider);
  letter-spacing: -.04em;
  line-height: .95;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hero-value .cur { font-size: .36em; font-weight: 500; color: var(--fg-2); letter-spacing: 0; margin-right: .35em; vertical-align: .95em; }
/* Redline: régua tipo conta-giros. Vermelho = dinheiro recebido; cinza = crédito de troca; apagado = a receber */
.redline { display: flex; align-items: flex-end; gap: 3px; height: 30px; margin: 26px 0 18px; }
.redline i { flex: 1; height: 12px; border-radius: 1px; background: var(--ink-3); }
.redline i.major { height: 22px; }
.redline i.paid { background: var(--red); animation: tick-paid .25s var(--ease-out) both; animation-delay: calc(var(--i) * 9ms + 150ms); }
.redline i.credit { background: var(--fg-2); animation: tick-credit .25s var(--ease-out) both; animation-delay: calc(var(--i) * 9ms + 150ms); }
.hero-legend { display: flex; flex-wrap: wrap; gap: 12px 40px; }
.hero-legend > div { display: flex; flex-direction: column; gap: 4px; }
.hero-legend > div > span { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 12.5px; }
.hero-legend > div > span i { width: 10px; height: 3px; border-radius: 1px; background: var(--ink-3); }
.hero-legend > div > span i.paid { background: var(--red); }
.hero-legend > div > span i.credit { background: var(--fg-2); }
.hero-legend strong { white-space: nowrap; font-size: 18px; font-weight: 600; font-stretch: var(--wide); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hero-legend em { font-style: normal; color: var(--fg-3); font-size: 12.5px; font-weight: 400; margin-left: 6px; }

/* Divisórias de 1px via gap: funciona para qualquer número de colunas */
.gauges { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); position: relative; }
.cluster > .gauges:first-child { border-top: 0; }
.gauge { padding: 18px 22px 20px; min-width: 0; background: var(--ink-1); }
.gauge > span { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 12.5px; }
.gauge > strong { display: block; margin-top: 8px; font-size: 22px; font-weight: 620; font-stretch: var(--wide); letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.gauge > small { display: block; margin-top: 4px; color: var(--fg-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge.alert > strong { color: var(--red-text); }
.gauge.alert > span .i { color: var(--red-text); }
a.gauge { transition: background var(--t-fast); }
a.gauge:hover { background: #141418; }

/* Atividade recente */
.feed { display: flex; flex-direction: column; }
.feed a { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 24px; border-top: 1px solid var(--line); transition: background var(--t-fast); }
.feed a:hover { background: rgba(245, 245, 247, .022); }
.feed-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--ink-2); color: var(--fg-2); }
.feed-ico.compra { color: var(--fg); }
.feed-main { min-width: 0; }
.feed-main strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-main small { color: var(--fg-2); }
.feed-val { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.feed-val strong { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 8. Estoque ---------- */
.stock-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.stock-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.stock-stats div { display: flex; flex-direction: column; }
.stock-stats div > span { font-size: 12.5px; color: var(--fg-2); }
.stock-stats strong { font-size: 22px; font-weight: 620; font-stretch: var(--wide); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.moto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.moto {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-base), transform var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.moto:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .9); }
.moto.is-out { opacity: .55; }
.moto-art { position: relative; aspect-ratio: 16 / 8.5; display: grid; place-items: center; background: var(--ink-0); border-bottom: 1px solid var(--line); overflow: hidden; }
/* Foto da moto (ou espaço reservado quando não há foto) */
.moto-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.moto-photo.ph { display: grid; place-items: center; color: var(--fg-3); background: var(--ink-0); }
.moto-art > .moto-photo { position: absolute; inset: 0; transition: transform var(--t-slow) var(--ease-out); }
.moto:hover .moto-art > img.moto-photo { transform: scale(1.03); }
.moto-art .badge { z-index: 1; background: rgba(8, 8, 9, .78); backdrop-filter: blur(4px); }
.moto-art .badge.ok { color: var(--ok); }
.moto-art .tag-cond { position: absolute; left: 12px; top: 12px; }
.moto-art .tag-stock { position: absolute; right: 12px; top: 12px; }
.moto-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.moto-title small { color: var(--fg-2); font-size: 12.5px; }
.moto-title h3 { margin: 2px 0 0; color: var(--fg); font-size: 17px; font-weight: 620; font-stretch: var(--wide); letter-spacing: -.015em; }
.moto-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.moto-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.moto-price span { display: block; color: var(--fg-3); font-size: 12px; }
.moto-price strong { font-size: 18px; font-weight: 620; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.moto-actions { display: flex; gap: 4px; }
.moto-link::after { content: ''; position: absolute; inset: 0; }
.moto-actions .btn { position: relative; z-index: 1; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--paint); border: 1px solid var(--line-3); margin-right: 6px; vertical-align: -1px; }
.moto-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.moto-hero .moto-art { aspect-ratio: auto; min-height: 280px; border: 1px solid var(--line); border-radius: var(--r-md); }
/* ---------- 9. Nova negociação ---------- */
.deal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.stepper { display: flex; gap: 4px; margin-bottom: 20px; counter-reset: step; }
.stepper button {
  flex: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 0 0 4px;
  color: var(--fg-3);
  font-size: 13px; font-weight: 500;
  text-align: left;
  transition: color var(--t-base);
}
.stepper button::before { content: ''; display: block; width: 100%; height: 2px; border-radius: 1px; background: var(--ink-3); transition: background var(--t-slow) var(--ease-out); }
.stepper button span::before { counter-increment: step; content: counter(step) '  '; font-variant-numeric: tabular-nums; color: var(--fg-3); white-space: pre; }
.stepper button.done { color: var(--fg-2); }
.stepper button.done::before { background: var(--fg-2); }
.stepper button.current { color: var(--fg); }
.stepper button.current::before { background: var(--red); }
.step { display: none; }
.step.current { display: block; animation: step-in var(--t-slow) var(--ease-out) both; }
.step.back { animation-name: step-in-back; }
.step-head { margin-bottom: 22px; }
.step-head h2 { font-size: 19px; font-weight: 620; font-stretch: var(--wide); letter-spacing: -.015em; }
.step-head p { color: var(--fg-2); margin-top: 4px; }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.kind { position: relative; display: block; cursor: pointer; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind > div {
  height: 100%;
  display: grid; grid-template-columns: 40px 1fr; gap: 2px 14px;
  padding: 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--ink-1);
  transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base);
}
.kind:hover > div { border-color: var(--line-3); }
.kind .i { grid-row: span 2; width: 40px; height: 40px; padding: 9px; border-radius: var(--r-sm); background: var(--ink-2); color: var(--fg-2); transition: color var(--t-base), background var(--t-base); }
.kind strong { font-weight: 600; font-size: 14.5px; }
.kind small { color: var(--fg-2); font-size: 12.5px; line-height: 1.4; }
.kind input:checked + div { border-color: var(--red); background: linear-gradient(var(--red-wash), var(--red-wash)), var(--ink-1); }
.kind input:checked + div .i { color: #fff; background: var(--red); }
.kind input:focus-visible + div { outline: 2px solid var(--red); outline-offset: 2px; }

.summary { position: sticky; top: 84px; }
.summary .panel { padding: 0; overflow: hidden; }
.sum-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.sum-head small { color: var(--fg-2); }
.sum-head strong { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; }
.sum-rows { padding: 8px 22px; }
.sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 13.5px; }
.sum-row span { color: var(--fg-2); }
.sum-row b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sum-row.minus b::before { content: '− '; color: var(--fg-3); }
.sum-total { padding: 18px 22px 20px; border-top: 1px solid var(--line); background: var(--ink-0); }
.sum-total span { color: var(--fg-2); font-size: 12.5px; }
.sum-total strong { display: block; margin-top: 2px; font-size: 32px; font-weight: 700; font-stretch: var(--wider); letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; transition: color var(--t-base); }
.sum-total strong.zero { color: var(--ok); }
.sum-total small { display: block; margin-top: 6px; color: var(--fg-2); }
.sum-dues { padding: 4px 22px 18px; border-top: 1px solid var(--line); }
.sum-dues h4 { font-size: 12.5px; font-weight: 500; color: var(--fg-2); margin: 14px 0 8px; }
.sum-dues ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sum-dues li { display: flex; justify-content: space-between; font-size: 13px; font-variant-numeric: tabular-nums; }
.sum-dues li span { color: var(--fg-2); }
.sum-mobile { display: none; }
.reveal[data-when="out"].is-closed + .reveal .divider { display: none; }
.pulse { animation: pulse-val .45s var(--ease-out); }

/* ---------- 10. Negociação, cliente, financeiro ---------- */
.deal-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; }
.deal-strip > div { padding: 20px 24px; border-right: 1px solid var(--line); min-width: 0; }
.deal-strip > div:last-child { border-right: 0; }
.deal-strip > div > span { color: var(--fg-2); font-size: 12.5px; }
.deal-strip strong { display: block; margin-top: 6px; font-size: 26px; font-weight: 650; font-stretch: var(--wide); letter-spacing: -.025em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-strip small { display: block; color: var(--fg-3); margin-top: 2px; }
.deal-strip .key strong { color: var(--fg); }
.deal-strip .meter { margin-top: 14px; }
.vehicle { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.vehicle .moto-photo { width: 76px; height: 52px; flex-shrink: 0; border-radius: var(--r-sm); border: 1px solid var(--line); }
.vehicle .moto-photo.ph svg { width: 22px; height: 22px; }
.vehicle > div { flex: 1; min-width: 0; }
.vehicle strong { display: block; font-weight: 600; }
.vehicle small { color: var(--fg-2); }
.pay-box { padding: 18px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--ink-0); }
.amount-row { display: flex; gap: 8px; align-items: flex-end; }
.amount-row .field { flex: 1; }

/* Linha do tempo */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; }
.timeline li::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:first-child::before { top: 20px; }
.timeline li:last-child::before { bottom: calc(100% - 20px); }
.timeline li:only-child::before { display: none; }
.tl-dot { position: relative; width: 9px; height: 9px; margin: 6px 0 0 4px; border-radius: 50%; background: var(--ink-1); border: 2px solid var(--fg-2); }
.tl-dot.in { border-color: var(--ok); }
.tl-dot.out { border-color: var(--fg); }
.tl-main { min-width: 0; }
.tl-main strong { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-main small { display: block; color: var(--fg-2); }
.tl-main .note { color: var(--fg-3); }
.tl-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.profile { display: flex; align-items: center; gap: 18px; }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.due-list { display: flex; flex-direction: column; }
.due { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.due:first-child { border-top: 0; }
.due-date { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: var(--r-sm); background: var(--ink-2); line-height: 1.1; }
.due-date b { font-size: 17px; font-weight: 650; font-stretch: var(--wide); font-variant-numeric: tabular-nums; }
.due-date small { font-size: 11px; color: var(--fg-2); }
.due.late .due-date { background: var(--red-wash); color: var(--red-text); }
.due.late .due-date small { color: var(--red-text); }
.due-main { min-width: 0; }
.due-main strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-main small { color: var(--fg-2); }
.due-val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { height: 32px; width: auto; font-size: 13px; padding-left: 10px; }

/* ---------- 11. Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--ink-0); }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; border-right: 1px solid var(--line); overflow: hidden; }
.login-art::before { content: ''; position: absolute; left: -20%; bottom: -50%; width: 110%; height: 110%; background: radial-gradient(closest-side, rgba(151, 11, 29, .28), transparent); pointer-events: none; }
.login-art .brand { position: relative; display: flex; align-items: center; gap: 12px; }
.login-statement { position: relative; }
.login-statement h1 { font-size: clamp(36px, 4.6vw, 64px); font-weight: 700; font-stretch: var(--wider); letter-spacing: -.04em; line-height: 1; max-width: 12ch; }
.login-statement p { margin-top: 18px; color: var(--fg-2); font-size: 15px; max-width: 42ch; }
.login-art .redline { max-width: 520px; margin: 32px 0 0; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.login-form > div { width: min(380px, 100%); }
.login-form h2 { font-size: 24px; font-weight: 650; font-stretch: var(--wide); letter-spacing: -.02em; }
.login-form > div > p { color: var(--fg-2); margin: 6px 0 28px; }
.login-form form { display: flex; flex-direction: column; gap: 18px; }
.login-form .btn { margin-top: 6px; }
.login-foot { margin-top: 28px; color: var(--fg-3); font-size: 12.5px; }
.login-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 18px; border-radius: var(--r-sm); background: var(--red-wash); color: var(--fg); font-size: 13.5px; animation: shake .4s var(--ease-out); }
.login-error .i { color: var(--red-text); margin-top: 1px; }
.login-mobile-brand { display: none; }

/* ---------- 12. Motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes rise-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tick-paid { from { background: var(--ink-3); } to { background: var(--red); } }
@keyframes tick-credit { from { background: var(--ink-3); } to { background: var(--fg-2); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes step-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes step-in-back { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes pulse-val { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Entrada progressiva: só os blocos principais, uma única vez, em cascata curta */
.content > .page-head, .content > .enter { animation: enter var(--t-slow) var(--ease-out) both; }
.content > .enter:nth-of-type(2) { animation-delay: 40ms; }
.content > .enter:nth-of-type(3) { animation-delay: 80ms; }
.content > .enter:nth-of-type(4) { animation-delay: 120ms; }
.content > .enter:nth-of-type(n+5) { animation-delay: 160ms; }

/* Transições entre páginas (navegadores com View Transitions; os demais ignoram) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(content) { animation: vt-out 140ms var(--ease-io) both; }
::view-transition-new(content) { animation: vt-in 300ms var(--ease-out) both; }
::view-transition-group(nav-indicator) { animation-duration: 320ms; animation-timing-function: var(--ease-out); }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
/* Com a transição de página ativa, a cascata de entrada seria duplicada */
@supports (view-transition-name: a) {
  html:active-view-transition .content > * { animation: none; }
}

/* ---------- 13. Responsivo ---------- */
@media (max-width: 1280px) {
  .deal-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .gauge { padding: 16px 18px 18px; }
  .gauge > strong { font-size: 19px; }
}
@media (max-width: 1100px) {
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-21, .grid-12 { grid-template-columns: minmax(0, 1fr); }
  .moto-hero { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  /* Sidebar vira gaveta; a navegação principal passa para a barra inferior */
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw) !important; flex-basis: auto !important;
    transform: translateX(-102%);
    transition: transform var(--t-slow) var(--ease-out);
    box-shadow: 24px 0 64px rgba(0, 0, 0, .6);
    view-transition-name: none;
    z-index: 60;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: none; }
  .nav-collapsed .sidebar .wordmark, .nav-collapsed .sidebar .sb-link span, .nav-collapsed .sidebar .sb-cta span, .nav-collapsed .sidebar .sb-user-text, .nav-collapsed .sidebar .sb-count { opacity: 1; position: static; pointer-events: auto; }
  .nav-collapsed .sidebar .wordmark { position: static; }
  .nav-collapsed .sb-brand { flex-direction: row; height: 40px; padding: 0 8px 0 9px; }
  .nav-collapsed .sb-foot { flex-direction: row; padding: 14px 6px 0; }
  .nav-collapsed .sb-user { flex: 1; }
  .nav-collapsed [data-tip]::after { display: none; }
  .sb-toggle { display: none; }
  .sb-close { display: grid; }
  .sb-ind { view-transition-name: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 8, 9, .6); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity var(--t-base), visibility 0s linear var(--t-base); }
  .scrim.open { opacity: 1; visibility: visible; transition-delay: 0s; }
  .topbar { padding: 0 16px; height: 56px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .tb-brand { display: flex; }
  .tb-date { display: none; }
  .content { padding: 24px 20px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    background: rgba(8, 8, 9, .9);
    backdrop-filter: saturate(140%) blur(16px);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; color: var(--fg-3); font-size: 11px; font-weight: 500; transition: color var(--t-fast); -webkit-tap-highlight-color: transparent; }
  .tabbar .is-active { color: var(--fg); }
  .tabbar .is-active::before { content: ''; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; background: var(--red); border-radius: 0 0 2px 2px; }
  .tabbar .tab-cta { justify-self: center; width: 48px; height: 48px; border-radius: var(--r-md); background: var(--red); color: #fff; transition: transform var(--t-fast) var(--ease-out); }
  .tabbar .tab-cta:active { transform: scale(.94); }
  .tabbar .tab-cta.is-active::before { display: none; }
  .toasts { right: 16px; left: 16px; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); align-items: center; }
  .deal-layout { grid-template-columns: minmax(0, 1fr); }
  .summary { display: none; }
  .sum-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); z-index: 20;
    margin-top: 20px; padding: 12px 16px;
    background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-md);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .9);
  }
  .sum-mobile div > span { color: var(--fg-2); font-size: 12px; display: block; }
  .sum-mobile strong { font-size: 19px; font-weight: 650; font-stretch: var(--wide); font-variant-numeric: tabular-nums; }
  .sum-mobile small { color: var(--fg-2); text-align: right; font-size: 12px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
}
@media (max-width: 760px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 16px; margin-bottom: 22px; }
  .page-actions .btn { flex: 1; }
  .hero { padding: 22px 20px 20px; }
  .hero-value { font-size: clamp(34px, 10.5vw, 48px); }
  .redline { gap: 2px; height: 24px; margin: 20px 0 16px; }
  .redline i.major { height: 18px; }
  .redline i.m-hide { display: none; }
  .hero-legend { gap: 14px 24px; }
  .hero-legend strong { font-size: 16px; }
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gauge { padding: 14px 16px 16px; }
  .gauge > strong { font-size: 18px; }
  .period { flex-direction: column; align-items: stretch; }
  .period form { display: grid; grid-template-columns: 1fr 1fr; }
  .period input[type="date"], .period select { width: 100%; }
  .period .btn, .period .period-sep { grid-column: 1 / -1; }
  .period-sep { display: none; }
  .panel { padding: 18px 16px; }
  .panel.flush .panel-head { padding: 16px 16px 0; }
  .feed a { padding: 12px 16px; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .toolbar { gap: 10px; }
  .toolbar .field { min-width: calc(50% - 5px); flex: 1; }
  .toolbar .grow { min-width: 100%; }
  .toolbar .btn { flex: 1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  /* Tabelas viram cartões empilhados */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody { display: block; }
  .table.stack tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { display: flex; flex-direction: column; padding: 0 !important; border: 0; text-align: left !important; }
  .table.stack td::before { content: attr(data-label); font-size: 11.5px; color: var(--fg-3); margin-bottom: 1px; }
  .table.stack td.lead { grid-column: 1 / -1; }
  .table.stack td.lead::before, .table.stack td.act::before, .table.stack td.empty-cell::before { display: none; }
  .table.stack td.act { grid-column: 1 / -1; }
  .table.stack td.act:empty { display: none; }
  .table.stack td.empty-cell { grid-column: 1 / -1; }
  .table.stack tr:has(td.empty-cell) { padding: 0; display: block; }
  .table.stack td .meter-row { margin-top: 4px; }
  .pager { padding: 14px 16px; }
  .deal-strip { grid-template-columns: minmax(0, 1fr); }
  .deal-strip > div { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; }
  .deal-strip > div:last-child { border-bottom: 0; }
  .deal-strip strong { font-size: 22px; }
  .kinds { grid-template-columns: minmax(0, 1fr); }
  .stepper button { font-size: 0; gap: 0; }
  .stepper button span::before { font-size: 12px; }
  .stepper button.current { font-size: 12px; }
  .stepper button.current span::before { content: counter(step) '  '; }
  .modal { padding: 0; }
  .modal-box, .modal.drawer .modal-box { margin: auto 0 0; width: 100%; min-height: 0; max-height: 94dvh; overflow-y: auto; border-radius: 16px 16px 0 0; border-width: 1px 0 0; transform: translateY(32px); }
  .modal-box.sm { width: 100%; }
  .modal.open .modal-box { transform: none; }
  .modal-foot { border-radius: 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .moto-grid { grid-template-columns: minmax(0, 1fr); }
  .stock-stats { gap: 20px; }
  .profile .avatar.lg { width: 48px; height: 48px; }
  .info { grid-template-columns: minmax(100px, 40%) 1fr; }
  .chart { height: 220px; }
  .login-form { align-items: flex-start; padding: 40px 20px; }
}
@media (hover: none) {
  .moto:hover, .btn.primary:hover { transform: none; box-shadow: none; }
}

/* ---------- 14. Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Estorno de pagamento (negociação) */
.reverse-form{display:flex;gap:6px;margin-top:8px}
.reverse-form input{min-width:0;flex:1;background:transparent;border:1px solid var(--line,#2a2a31);border-radius:8px;color:inherit;padding:6px 10px;font:inherit;font-size:12px}

/* Campo de foto no cadastro de moto */
.photo-box { display: flex; gap: 14px; align-items: center; }
.photo-preview { position: relative; width: 120px; aspect-ratio: 4 / 3; flex-shrink: 0; display: grid; place-items: center; overflow: hidden; border-radius: var(--r-sm); border: 1px dashed var(--line-3); background: var(--ink-0); color: var(--fg-3); }
.photo-preview:not(.is-empty) { border-style: solid; border-color: var(--line-2); }
.photo-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-preview.is-empty svg { display: block; }
.photo-preview:not(.is-empty) svg { display: none; }
.photo-ctrl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--red); flex-shrink: 0; }

/* Configurações */
.sb-logout.is-active { color: var(--fg); background: var(--ink-2); }
.icon-tile { width: 96px; height: 96px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--line-2); background: repeating-conic-gradient(#1a1a1f 0 25%, #111114 0 50%) 0 0 / 16px 16px; }
.icon-tile img { width: 72px; height: 72px; object-fit: contain; }
.mock-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 9px 14px; border-radius: 10px 10px 0 0; background: var(--ink-2); border: 1px solid var(--line-2); border-bottom: 0; font-size: 12.5px; }
.mock-tab img { border-radius: 3px; flex-shrink: 0; }
.mock-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mock-side { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--ink-0); border: 1px solid var(--line); }
.mock-app { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; font-size: 12px; text-align: center; }
.mock-app img { width: 64px; height: 64px; border-radius: 15px; object-fit: contain; background: var(--ink-0); border: 1px solid var(--line-2); }
.mock-app span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Contadores: ficam ocultos até o JS zerar o valor (evita piscar o número final). Se o JS falhar, aparecem após 2 s. */
.js [data-count]:not(.is-ready) { opacity: 0; animation: count-reveal 0s linear 2s forwards; }
@keyframes count-reveal { to { opacity: 1; } }
/* Painel: os medidores e a legenda entram em cascata junto com os números */
.cluster .gauge { animation: enter var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--g, 0) * 55ms + 200ms); }
.gauge:nth-child(1) { --g: 0; } .gauge:nth-child(2) { --g: 1; } .gauge:nth-child(3) { --g: 2; } .gauge:nth-child(4) { --g: 3; } .gauge:nth-child(5) { --g: 4; }
.gauge:nth-child(6) { --g: 5; } .gauge:nth-child(7) { --g: 6; } .gauge:nth-child(8) { --g: 7; } .gauge:nth-child(9) { --g: 8; } .gauge:nth-child(10) { --g: 9; }
.hero-legend > div { animation: enter var(--t-slow) var(--ease-out) both; }
.hero-legend > div:nth-child(1) { animation-delay: 120ms; } .hero-legend > div:nth-child(2) { animation-delay: 190ms; } .hero-legend > div:nth-child(3) { animation-delay: 260ms; }
