:root {
  color-scheme: light;
  /* Escala tipográfica global: altere estes tokens para calibrar toda a interface. */
  --font-size-3xs: 10px;
  --font-size-2xs: 11px;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-md: 15px;
  --font-size-base: 17px;
  --font-size-lg: 20px;
  --font-size-xl: 22px;
  --font-size-2xl: 26px;
  --font-size-3xl: 32px;
  --font-size-4xl: 40px;
  --font-size-5xl: 50px;
  --font-size-page-title: clamp(27px, 2.2vw, 34px);
  --font-size-metric: clamp(24px, 2vw, 31px);
  --font-size-stat: 28px;
  --app-bg: #f5f6fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --surface-hover: #f1f2f7;
  --surface-strong: #eceef4;
  --border: #e6e8ef;
  --border-strong: #d8dbe6;
  --text: #171927;
  --text-soft: #44485a;
  --muted: #717586;
  --subtle: #9a9ead;
  /* ⚠️ MANTER EM SINCRONIA com `brand` em tailwind.config.js. O violeta da
     Affitto vive nos dois: aqui (app inteiro; `.bg-brand` etc. abaixo o forçam
     via !important) e no config (só o /relatorio, que não carrega este arquivo).
     Divergência silenciosa entre os dois já fez o /relatorio sair azul. */
  --accent: #5b5bd6;
  --accent-hover: #4c4cc2;
  --accent-soft: #eeeeff;
  --accent-text: #4545b4;
  --positive: #07875f;
  --positive-soft: #e9f8f1;
  --negative: #d14343;
  --negative-soft: #fff0f0;
  --warning: #b66806;
  --warning-soft: #fff7e7;
  --info: #3377d6;
  --info-soft: #edf5ff;
  --sidebar: #fbfbfd;
  --shadow-sm: 0 1px 2px rgba(25, 28, 44, .025), 0 6px 18px rgba(25, 28, 44, .035);
  --shadow-md: 0 14px 36px rgba(25, 28, 44, .08);
  --chart-brand: #6968db;
  --chart-revenue: #259b72;
  --chart-result: #6968db;
  --chart-negative: #dc6f70;
  --chart-warning: #d89b3f;
  --chart-grid: rgba(113, 117, 134, .13);
  --chart-text: #717586;
  --chart-strong: #25283a;
  --chart-tooltip-bg: #1b1d28;
  --chart-tooltip-text: #f7f8fb;
}

html.dark {
  color-scheme: dark;
  --app-bg: #101117;
  --surface: #171820;
  --surface-soft: #1b1d26;
  --surface-hover: #232530;
  --surface-strong: #292c38;
  --border: #292b36;
  --border-strong: #383b49;
  --text: #f3f4f8;
  --text-soft: #d2d4dd;
  --muted: #9b9eac;
  --subtle: #707482;
  --accent: #8585ff;
  --accent-hover: #9696ff;
  --accent-soft: rgba(122, 122, 245, .14);
  --accent-text: #aaaaff;
  --positive: #42c993;
  --positive-soft: rgba(31, 166, 112, .13);
  --negative: #ff7b7b;
  --negative-soft: rgba(220, 67, 67, .13);
  --warning: #f2b84b;
  --warning-soft: rgba(217, 145, 22, .13);
  --info: #70a9ff;
  --info-soft: rgba(51, 119, 214, .14);
  --sidebar: #14151c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .12);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, .28);
  --chart-brand: #8181f6;
  --chart-revenue: #4fc99b;
  --chart-result: #8181f6;
  --chart-negative: #e57b7d;
  --chart-warning: #edb85b;
  --chart-grid: rgba(155, 158, 172, .13);
  --chart-text: #9b9eac;
  --chart-strong: #f3f4f8;
  --chart-tooltip-bg: #f3f4f8;
  --chart-tooltip-text: #181a24;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--app-bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg) !important;
  color: var(--text) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--font-size-base);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a, button, input, select, textarea { outline-color: var(--accent); }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border: 2px solid var(--app-bg); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  width: 252px;
  height: 100vh;
  flex: 0 0 252px;
  flex-direction: column;
  overflow: hidden;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.app-brand {
  display: grid;
  min-height: 112px;
  place-items: center;
  padding: 6px 20px;
  color: var(--text);
  text-decoration: none;
}
.app-brand-logo-frame { position: relative; display: block; width: 184px; height: 100px; overflow: hidden; }
.app-brand-logo { position: absolute; top: 50%; left: 50%; display: block; width: 204px; max-width: none; height: auto; transform: translate(-50%, -50%); }
.app-logo-light { filter: contrast(1.12); mix-blend-mode: multiply; }
.app-logo-dark { display: none; filter: contrast(1.18); mix-blend-mode: screen; }
html.dark .app-logo-light { display: none; }
html.dark .app-logo-dark { display: block; }
.app-sidebar-scroll { flex: 1; overflow-x: hidden; overflow-y: auto; padding: 6px 12px 20px; }
.app-nav-group + .app-nav-group { margin-top: 20px; }
.app-nav-label { padding: 0 10px 7px; color: var(--subtle); font-size: var(--font-size-2xs); font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.app-nav { display: grid; gap: 3px; }
.app-nav-link {
  position: relative;
  display: flex;
  min-height: 39px;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color .16s ease, color .16s ease, transform .16s ease;
}
.app-nav-link:hover { background: var(--surface-hover); color: var(--text); }
.app-nav-link:active { transform: translateY(1px); }
.app-nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.app-nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 3px;
  height: 19px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.app-nav-icon { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.75; }
.app-sidebar-footer { border-top: 1px solid var(--border); padding: 14px 14px 15px; }
.app-user { display: flex; min-width: 0; align-items: center; gap: 10px; }
.app-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent-text);
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.app-user-copy { min-width: 0; flex: 1; line-height: 1.25; }
.app-user-name { overflow: hidden; color: var(--text-soft); font-size: var(--font-size-xs); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.app-user-role { margin-top: 2px; color: var(--subtle); font-size: var(--font-size-2xs); }
.app-icon-link { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; color: var(--muted); }
.app-icon-link:hover { background: var(--surface-hover); color: var(--text); }
.app-version { margin-top: 9px; padding-left: 44px; color: var(--subtle); font-size: var(--font-size-3xs); }

.app-workspace { min-width: 0; flex: 1; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--app-bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.page-home .app-topbar { border-bottom: 0; }
.app-topbar-left { min-width: 0; }
.app-topbar-actions { display: flex; align-items: center; gap: 8px; }
.app-icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 1px 2px rgba(25, 28, 44, .02);
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}
.app-icon-button:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text); }
.app-icon-button:active { transform: translateY(1px); }
.app-icon-button svg, .app-icon-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.theme-icon-moon { display: block; }
.theme-icon-sun { display: none; }
html.dark .theme-icon-moon { display: none; }
html.dark .theme-icon-sun { display: block; }
.app-topbar-user { display: flex; align-items: center; gap: 8px; margin-left: 5px; padding-left: 13px; border-left: 1px solid var(--border); }
.app-topbar-name { max-width: 150px; overflow: hidden; color: var(--text-soft); font-size: var(--font-size-xs); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.app-mobile-brand { display: none; width: 102px; height: 52px; place-items: center; overflow: hidden; color: var(--text); text-decoration: none; }
.app-mobile-brand .app-brand-logo-frame { width: 102px; height: 52px; }
.app-mobile-brand .app-brand-logo { width: 112px; }
.app-menu-button { display: none; }
.app-sidebar-backdrop { display: none; }
.app-main { width: 100%; max-width: 1540px; margin: 0 auto; padding: 28px 30px 46px; }

/* Ponte visual para os templates legados, preservando sua marcação e comportamento. */
.bg-slate-950 { background-color: var(--app-bg) !important; }
.bg-slate-900 { background-color: var(--surface) !important; }
.bg-slate-950\/40, .bg-slate-900\/40, .bg-slate-900\/50, .bg-slate-900\/60, .bg-slate-900\/80 { background-color: var(--surface) !important; }
.bg-slate-800 { background-color: var(--surface-soft) !important; }
.bg-slate-800\/70, .bg-slate-700\/50, .bg-slate-600\/30 { background-color: var(--surface-soft) !important; }
.bg-slate-700 { background-color: var(--surface-strong) !important; }
.hover\:bg-slate-100:hover, .hover\:bg-slate-600:hover, .hover\:bg-slate-600\/60:hover,
.hover\:bg-slate-800:hover, .hover\:bg-slate-800\/20:hover, .hover\:bg-slate-800\/30:hover, .hover\:bg-slate-800\/40:hover,
.hover\:bg-slate-700:hover { background-color: var(--surface-hover) !important; }
.text-xs { font-size: var(--font-size-sm); }
.text-sm { font-size: var(--font-size-md); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }
.text-\[10px\] { font-size: var(--font-size-2xs); }
.text-\[11px\] { font-size: var(--font-size-xs); }
.text-\[38px\] { font-size: var(--font-size-4xl); }
.border-slate-900, .border-slate-800, .border-slate-800\/60 { border-color: var(--border) !important; }
.border-slate-700, .border-slate-700\/50 { border-color: var(--border-strong) !important; }
.text-white, .text-slate-100, .text-slate-200 { color: var(--text) !important; }
.text-slate-300 { color: var(--text-soft) !important; }
.text-slate-400 { color: var(--muted) !important; }
.text-slate-500, .text-slate-600, .text-slate-700, .text-slate-800 { color: var(--subtle) !important; }
.hover\:text-white:hover, .hover\:text-slate-200:hover, .hover\:text-slate-300:hover { color: var(--text) !important; }
.bg-brand { background-color: var(--accent) !important; }
.bg-brand\/20 { background-color: var(--accent-soft) !important; }
.bg-brand.text-white, .bg-brand .text-white, button.bg-brand { color: #fff !important; }
.hover\:bg-blue-600:hover { background-color: var(--accent-hover) !important; }
.text-brand, .hover\:text-brand:hover { color: var(--accent-text) !important; }
.border-brand { border-color: var(--accent) !important; }
.text-emerald-300, .text-emerald-400 { color: var(--positive) !important; }
.text-emerald-200 { color: var(--positive) !important; }
.text-red-300, .text-red-400 { color: var(--negative) !important; }
.text-red-200 { color: var(--negative) !important; }
.text-amber-200, .text-amber-300, .text-amber-400 { color: var(--warning) !important; }
.text-blue-300, .text-blue-400 { color: var(--info) !important; }
.text-purple-300, .text-violet-300 { color: var(--accent-text) !important; }
.text-orange-300, .text-orange-400 { color: var(--warning) !important; }
.bg-emerald-500\/10, .bg-emerald-500\/15, .bg-emerald-500\/20, .bg-emerald-900\/30, .bg-emerald-950\/40 { background-color: var(--positive-soft) !important; }
.bg-red-500\/10, .bg-red-500\/15, .bg-red-500\/20, .bg-red-900\/40, .bg-red-950\/40 { background-color: var(--negative-soft) !important; }
.bg-amber-500\/15, .bg-amber-500\/20, .bg-amber-900\/30, .bg-amber-900\/40, .bg-orange-500\/20 { background-color: var(--warning-soft) !important; }
.bg-blue-500\/15, .bg-blue-500\/20, .bg-blue-900\/30, .bg-blue-900\/40 { background-color: var(--info-soft) !important; }
.bg-purple-500\/20, .bg-violet-500\/20 { background-color: var(--accent-soft) !important; }
.border-blue-900\/60 { border-color: color-mix(in srgb, var(--info) 28%, var(--border)) !important; }
.border-amber-700, .border-amber-700\/50, .border-amber-800 { border-color: color-mix(in srgb, var(--warning) 34%, var(--border)) !important; }
.border-red-500\/30, .border-red-700, .border-red-800, .border-red-900\/40 { border-color: color-mix(in srgb, var(--negative) 34%, var(--border)) !important; }
.border-emerald-500\/25, .border-emerald-500\/30, .border-emerald-700, .border-emerald-800 { border-color: color-mix(in srgb, var(--positive) 34%, var(--border)) !important; }
.border-purple-900\/60 { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)) !important; }
.shadow-2xl { box-shadow: var(--shadow-md) !important; }

main .bg-slate-900.border {
  box-shadow: var(--shadow-sm);
  transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
input, select, textarea {
  border-color: var(--border-strong) !important;
  background: var(--surface-soft) !important;
  color: var(--text-soft) !important;
}
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
table { border-collapse: separate; border-spacing: 0; }
thead { color: var(--muted); }
tbody { color: var(--text-soft); }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-hover) 76%, transparent); }
code { border-radius: 5px; background: var(--surface-strong); padding: .1em .35em; color: var(--text-soft); }

/* Dashboard */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.dashboard-eyebrow { margin-bottom: 7px; color: var(--accent-text); font-size: var(--font-size-2xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.dashboard-title { margin: 0; color: var(--text); font-size: var(--font-size-page-title); font-weight: 700; letter-spacing: -.045em; line-height: 1.12; }
.dashboard-subtitle { margin: 8px 0 0; color: var(--muted); font-size: var(--font-size-sm); line-height: 1.55; }
.dashboard-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; }
.dashboard-toolbar { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-home .dashboard-toolbar { position: relative; padding-top: 12px; }
.page-home .dashboard-toolbar::before { content: ""; position: absolute; top: 0; right: -30px; left: -30px; height: 1px; background: var(--border); }
.dashboard-toolbar-filter { min-width: 0; flex: 1; }
.dashboard-toolbar .period-filter { margin-bottom: 0; }
.dashboard-button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: 0 1px 2px rgba(25, 28, 44, .025);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}
.dashboard-button:hover { border-color: var(--accent); background: var(--surface-hover); color: var(--accent-text); }
.dashboard-button:active { transform: translateY(1px); }
.dashboard-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.dashboard-button-primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 7px 18px rgba(91, 91, 214, .18); }
.dashboard-button-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: #fff; }
.dashboard-notice { margin-bottom: 18px; border-radius: 11px; padding: 12px 14px; font-size: var(--font-size-xs); line-height: 1.5; }

.period-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 2px;
  overflow-x: auto;
  font-size: var(--font-size-xs);
  scrollbar-width: thin;
}
.period-filter-presets { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.period-filter-link { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 550; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.period-filter-link:hover { background: var(--surface-hover); color: var(--text); }
.period-filter-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 650; }
.period-filter-form { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.period-filter input, .period-filter select { height: 35px; border: 1px solid var(--border); border-radius: 9px; padding: 5px 9px; font-size: var(--font-size-xs); }
.period-filter-separator { color: var(--subtle); }

@media (min-width: 1024px) {
  .page-home .app-topbar { position: relative; height: 0; padding: 0; background: transparent; backdrop-filter: none; }
  .page-home .app-topbar-actions { position: absolute; top: 38px; right: 30px; }
  .page-home .dashboard-header { padding-right: 260px; }
  .dashboard-toolbar .period-filter { gap: 8px; font-size: var(--font-size-2xs); }
  .dashboard-toolbar .period-filter-link { padding-right: 6px; padding-left: 6px; }
  .dashboard-toolbar .period-filter-form { gap: 5px; }
  .dashboard-toolbar .period-filter input,
  .dashboard-toolbar .period-filter select { padding-right: 7px; padding-left: 7px; font-size: var(--font-size-2xs); }
  .dashboard-toolbar .period-filter select { width: 150px; }
  .dashboard-toolbar .dashboard-button { min-height: 35px; padding: 7px 11px; font-size: var(--font-size-2xs); }
}

@media (min-width: 768px) and (max-width: 1390px) {
  .dashboard-toolbar { flex-wrap: wrap; }
  .dashboard-toolbar-filter { flex-basis: 100%; }
  .dashboard-toolbar .dashboard-actions { margin-left: auto; }
}

.dashboard-kpis { display: grid; grid-template-columns: minmax(245px, 1.25fr) repeat(3, minmax(190px, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card {
  position: relative;
  min-width: 0;
  min-height: 136px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-label { color: var(--muted); font-size: var(--font-size-2xs); font-weight: 650; letter-spacing: .045em; text-transform: uppercase; }
.metric-info {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 650;
  line-height: 1;
}
.metric-info:hover { background: var(--surface-hover); color: var(--accent-text); }
.metric-value { margin-top: 13px; color: var(--text); font-size: var(--font-size-metric); font-weight: 700; letter-spacing: -.055em; line-height: 1; white-space: nowrap; }
.metric-value .currency { margin-right: 4px; color: var(--muted); font-size: .46em; font-weight: 650; letter-spacing: 0; vertical-align: .45em; }
.metric-value.is-positive { color: var(--positive); }
.metric-value.is-negative { color: var(--negative); }
.metric-meta { margin-top: 10px; color: var(--subtle); font-size: var(--font-size-2xs); line-height: 1.5; }
.metric-trend { display: inline-flex; align-items: center; gap: 4px; }

.financial-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.summary-item { position: relative; min-width: 0; padding: 15px 17px; }
.summary-item + .summary-item::before { content: ""; position: absolute; top: 14px; bottom: 14px; left: 0; width: 1px; background: var(--border); }
.summary-label { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--muted); font-size: var(--font-size-3xs); font-weight: 650; letter-spacing: .045em; text-transform: uppercase; }
.summary-value { margin-top: 7px; overflow: hidden; color: var(--text); font-size: var(--font-size-base); font-weight: 700; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.summary-value.is-warning { color: var(--warning); }
.summary-value.is-positive { color: var(--positive); }
.summary-value.is-negative { color: var(--negative); }
.summary-caption { margin-top: 4px; overflow: hidden; color: var(--subtle); font-size: var(--font-size-3xs); text-overflow: ellipsis; white-space: nowrap; }
.summary-item .metric-info { width: 18px; height: 18px; flex-basis: 18px; font-size: var(--font-size-2xs); }

.dashboard-chart-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: stretch; gap: 16px; margin-bottom: 16px; }
.dashboard-panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 22px; box-shadow: var(--shadow-sm); }
.dashboard-performance-panel, .dashboard-ranking-panel { grid-column: span 7; }
.dashboard-occupancy-panel, .dashboard-expenses-panel { grid-column: span 5; }
.dashboard-expenses-panel-wide { grid-column: 1 / -1; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-title { color: var(--text); font-size: var(--font-size-md); font-weight: 650; letter-spacing: -.022em; line-height: 1.35; }
.panel-subtitle { margin-top: 5px; color: var(--subtle); font-size: var(--font-size-xs); font-weight: 450; line-height: 1.5; }
.panel-period { color: var(--muted); font-size: var(--font-size-2xs); font-weight: 550; white-space: nowrap; }
.panel-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; color: var(--muted); font-size: var(--font-size-2xs); font-weight: 600; text-decoration: none; white-space: nowrap; transition: color .16s ease; }
.panel-link:hover { color: var(--accent-text); }
.panel-link span { font-size: var(--font-size-md); transition: transform .16s ease; }
.panel-link:hover span { transform: translateX(2px); }
.chart-html-legend { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px 18px; margin: -5px 0 6px; color: var(--chart-text); font-size: var(--font-size-xs); font-weight: 500; line-height: 1.25; }
.chart-html-legend-start { justify-content: flex-start; margin: -4px 0 5px; }
.chart-html-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-html-legend-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--legend-color); }
.chart-html-legend-line { width: 12px; height: 2px; flex: 0 0 12px; border-radius: 2px; background: var(--legend-color); }
.performance-chart { position: relative; min-height: 274px; }
.cashflow-chart { position: relative; min-height: 390px; }

/* Data visuals: a mesma linguagem tipográfica, cromática e espacial do shell. */
.data-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--subtle); }
.data-dot.is-expense { background: var(--chart-negative); }
.data-dot.is-result { background: var(--chart-result); }
.data-dot.is-rented { background: var(--chart-brand); }
.data-dot.is-available { border: 2px solid var(--border-strong); background: var(--surface); }
.data-dot.is-maintenance { background: var(--chart-warning); }
.data-track { display: block; width: 100%; height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.data-fill { display: block; width: var(--bar-size, 0%); height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left center; animation: data-bar-enter .5s cubic-bezier(.2,.7,.3,1) both; }
.data-fill.is-revenue { background: var(--chart-revenue); }
.data-fill.is-expense { background: var(--chart-negative); }
.data-fill.is-ranking { background: color-mix(in srgb, var(--chart-revenue) 72%, var(--surface)); }
.is-leader .data-fill.is-ranking { background: var(--chart-revenue); }
@keyframes data-bar-enter { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.result-composition { display: flex; min-height: 154px; flex-direction: column; justify-content: center; }
.composition-visual { padding: 2px 0; }
.composition-label { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: var(--font-size-2xs); font-weight: 550; }
.composition-track { display: flex; width: 100%; height: 14px; gap: 3px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.composition-segment { display: block; width: var(--share); height: 100%; min-width: 0; }
.composition-segment.is-expense { background: var(--chart-negative); }
.composition-segment.is-result { background: var(--chart-result); }
.composition-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin-top: 14px; }
.composition-breakdown > div { display: grid; min-width: 0; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 4px 7px; color: var(--muted); font-size: var(--font-size-2xs); }
.composition-breakdown strong { overflow: hidden; color: var(--text-soft); font-size: var(--font-size-xs); font-variant-numeric: tabular-nums; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.composition-breakdown small { grid-column: 2; color: var(--subtle); font-size: var(--font-size-3xs); font-variant-numeric: tabular-nums; }
.comparison-visual { display: grid; gap: 18px; padding: 10px 0; }
.comparison-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: var(--font-size-2xs); }
.comparison-row strong { color: var(--text-soft); font-variant-numeric: tabular-nums; font-weight: 650; }

.dashboard-occupancy-panel { display: flex; flex-direction: column; }
.occupancy-content { display: grid; flex: 1; grid-template-columns: minmax(118px, .9fr) minmax(150px, 1.1fr); align-items: center; gap: 22px; padding: 2px; }
.occupancy-ring { position: relative; width: min(100%, 150px); margin: 0 auto; aspect-ratio: 1; }
.occupancy-ring svg { display: block; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.occupancy-ring circle { fill: none; stroke-width: 9; }
.occupancy-ring-track { stroke: var(--surface-strong); }
.occupancy-ring-value { stroke: var(--chart-brand); stroke-linecap: round; filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--chart-brand) 16%, transparent)); }
.occupancy-ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.occupancy-ring-label strong { color: var(--text); font-size: var(--font-size-stat); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.occupancy-ring-label span { margin-top: 5px; color: var(--muted); font-size: var(--font-size-3xs); font-weight: 550; }
.fleet-status-list { display: grid; }
.fleet-status-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fleet-status-item:last-child { border-bottom: 0; }
.fleet-status-name { overflow: hidden; color: var(--text-soft); font-size: var(--font-size-xs); font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.fleet-status-item strong { color: var(--text); font-size: var(--font-size-sm); font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }

.ranking-list { display: grid; gap: 12px; padding-top: 2px; }
.ranking-item { display: grid; grid-template-columns: 22px 72px minmax(80px, 1fr) auto; align-items: center; gap: 10px; }
.ranking-position { color: var(--subtle); font-size: var(--font-size-3xs); font-variant-numeric: tabular-nums; font-weight: 650; }
.ranking-label { overflow: hidden; color: var(--text-soft); font-size: var(--font-size-xs); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ranking-value { min-width: 82px; color: var(--muted); font-size: var(--font-size-2xs); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.ranking-item.is-leader .ranking-position, .ranking-item.is-leader .ranking-label, .ranking-item.is-leader .ranking-value { color: var(--positive); }
.ranking-item:hover .data-fill.is-ranking { background: var(--chart-revenue); }

.expense-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--border); padding: 1px 0 16px; }
.expense-total > div { display: grid; gap: 5px; }
.expense-total span { color: var(--subtle); font-size: var(--font-size-3xs); font-weight: 550; }
.expense-total strong { color: var(--text); font-size: var(--font-size-lg); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.expense-total > span { border-radius: 999px; background: var(--surface-soft); padding: 5px 8px; }
.expense-list { display: grid; gap: 17px; padding-top: 1px; }
.expense-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--text-soft); font-size: var(--font-size-xs); }
.expense-item-head span { overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.expense-item-head strong { flex: 0 0 auto; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 650; }
.expense-item-bar { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 9px; }
.expense-item-bar small { color: var(--subtle); font-size: var(--font-size-3xs); font-variant-numeric: tabular-nums; text-align: right; }
.data-list-footer { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; color: var(--subtle); font-size: var(--font-size-3xs); line-height: 1.45; }
.data-empty { display: flex; min-height: 210px; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); font-size: var(--font-size-2xs); line-height: 1.5; text-align: center; }
.data-empty-icon { display: grid; width: 34px; height: 34px; place-items: center; margin-bottom: 11px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--font-size-base); }
.data-empty strong { margin-bottom: 3px; color: var(--text-soft); font-size: var(--font-size-xs); }
.data-empty a { margin-top: 7px; color: var(--accent-text); font-weight: 600; text-decoration: none; }
.dashboard-section { margin-top: 16px; }
.table-scroll { overflow-x: auto; }
.dashboard-table { width: 100%; min-width: 680px; font-size: var(--font-size-xs); }
.dashboard-table th { padding: 10px 8px; color: var(--muted); font-size: var(--font-size-3xs); font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.dashboard-table td { padding: 11px 8px; border-bottom: 1px solid var(--border); }
.dashboard-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-table tfoot td { padding: 12px 8px 2px; border-top: 1px solid var(--border-strong); }
.sync-line { display: flex; align-items: flex-start; gap: 11px; margin-top: 22px; padding: 18px 3px 0; border-top: 1px solid var(--border); font-size: var(--font-size-2xs); }
.sync-dot { width: 7px; height: 7px; flex: 0 0 7px; margin-top: 4px; border-radius: 50%; background: var(--positive); box-shadow: 0 0 0 4px var(--positive-soft); }
.sync-title { color: var(--text-soft); font-weight: 650; }
.sync-copy { margin-top: 4px; color: var(--muted); line-height: 1.5; }

/* Acesso */
.auth-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 30%),
    radial-gradient(circle at 88% 88%, color-mix(in srgb, var(--positive) 6%, transparent), transparent 28%),
    var(--app-bg) !important;
}
.auth-theme-toggle { position: fixed; top: 20px; right: 22px; z-index: 2; }
.auth-shell { width: 100%; max-width: 410px; }
.auth-brand { display: grid; place-items: center; margin-bottom: 18px; color: var(--text); text-decoration: none; }
.auth-brand .app-brand-logo-frame { width: 210px; height: 112px; }
.auth-brand .app-brand-logo { width: 228px; }
.auth-card { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 34px; box-shadow: var(--shadow-md); }
.auth-kicker { margin-bottom: 8px; color: var(--accent-text); font-size: var(--font-size-3xs); font-weight: 700; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.auth-title { margin: 0; color: var(--text); font-size: var(--font-size-2xl); font-weight: 700; letter-spacing: -.04em; line-height: 1.2; text-align: center; }
.auth-subtitle { margin: 9px auto 25px; max-width: 280px; color: var(--muted); font-size: var(--font-size-xs); line-height: 1.6; text-align: center; }
.auth-alert { margin-bottom: 16px; border-radius: 10px; padding: 11px 12px; font-size: var(--font-size-2xs); line-height: 1.55; }
.auth-google {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #d9dce6;
  border-radius: 10px;
  background: #fff;
  color: #282b3a;
  box-shadow: 0 1px 2px rgba(25, 28, 44, .03);
  font-size: var(--font-size-xs);
  font-weight: 650;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.auth-google:hover { border-color: #bfc3d0; box-shadow: 0 7px 18px rgba(25, 28, 44, .07); }
.auth-google:active { transform: translateY(1px); }
.auth-assurance { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; color: var(--subtle); font-size: var(--font-size-3xs); }
.auth-assurance svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.auth-footer { margin-top: 20px; color: var(--subtle); font-size: var(--font-size-3xs); text-align: center; }

@media (max-width: 1279px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .financial-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-item:nth-child(4)::before { display: none; }
  .summary-item:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .dashboard-performance-panel, .dashboard-occupancy-panel, .dashboard-ranking-panel, .dashboard-expenses-panel, .dashboard-expenses-panel-wide { grid-column: 1; }
}

@media (max-width: 767px) {
  .dashboard-header { flex-direction: column; gap: 16px; }
  .dashboard-toolbar { flex-direction: column; }
  .dashboard-toolbar-filter, .dashboard-actions { width: 100%; }
  .dashboard-button { flex: 1; }
  .dashboard-kpis { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 132px; padding: 15px 16px; }
  .financial-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-item:nth-child(3)::before, .summary-item:nth-child(5)::before { display: none; }
  .summary-item:nth-child(4)::before { display: block; }
  .summary-item:nth-child(-n+4) { border-bottom: 1px solid var(--border); }
  .dashboard-panel { padding: 17px; }
  .performance-chart { min-height: 260px; }
  .cashflow-chart { min-height: 330px; }
  .ranking-item { grid-template-columns: 22px 68px minmax(60px, 1fr) auto; gap: 8px; }
}

@media (max-width: 520px) {
  .dashboard-kpis { grid-template-columns: 1fr; }
  .metric-card { min-height: 128px; }
  .financial-summary { grid-template-columns: 1fr 1fr; }
  .dashboard-actions { flex-direction: column; }
  .dashboard-actions form { display: flex; width: 100%; }
  .dashboard-button { width: 100%; }
  .panel-header { gap: 12px; }
  .panel-link { font-size: 0; }
  .panel-link span { font-size: var(--font-size-base); }
  .composition-breakdown { grid-template-columns: 1fr; }
  .occupancy-content { grid-template-columns: 1fr; gap: 12px; }
  .occupancy-ring { width: 132px; }
  .fleet-status-list { width: 100%; }
  .ranking-item { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .ranking-item .data-track { grid-column: 2 / 4; }
  .ranking-value { min-width: 0; }
  .auth-card { padding: 28px 23px; }
  .auth-theme-toggle { top: 14px; right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .data-fill { animation: none; }
}

@media (max-width: 1023px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    box-shadow: var(--shadow-md);
    transition: transform .22s ease;
  }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  .app-sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(14, 15, 23, .42); backdrop-filter: blur(2px); }
  body.sidebar-open .app-sidebar-backdrop { display: block; }
  .app-menu-button, .app-mobile-brand { display: grid; }
  .app-topbar { height: 60px; padding: 0 20px; }
  .page-home .dashboard-toolbar::before { right: -20px; left: -20px; }
  .app-topbar-left { display: flex; align-items: center; gap: 10px; }
  .app-main { padding: 24px 20px 40px; }
}
@media (max-width: 639px) {
  .app-topbar { padding: 0 14px; }
  .app-main { padding: 20px 14px 34px; }
  .page-home .dashboard-toolbar::before { right: -14px; left: -14px; }
  .app-topbar-name { display: none; }
  .app-topbar-user { margin-left: 0; padding-left: 8px; }
  .app-topbar-user .app-avatar { width: 32px; height: 32px; flex-basis: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
