/* ================================================================== *
 * Tokens — shadcn/ui, light mode
 * ================================================================== */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --destructive: 0 72% 51%;
  --success: 142.1 70.6% 35.3%;
  --warning: 32 95% 40%;
  --border: 240 5.9% 90%;
  --ring: 240 5.9% 10%;

  --radius: 0.875rem;
  --sidebar-width: 17.5rem;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

svg { display: block; width: 1rem; height: 1rem; flex-shrink: 0; }
::selection { background: hsl(var(--foreground) / .12); }
:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; border-radius: 4px; }

.tabular { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.eyebrow {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: hsl(var(--muted-foreground));
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ================================================================== *
 * Animações
 * ================================================================== */
@keyframes rise { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px) } to { opacity: 1; transform: none } }
@keyframes sheet { from { transform: translateY(100%) } to { transform: none } }
@keyframes slideIn { from { transform: translateX(-100%) } to { transform: none } }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

.reveal { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }

.skeleton-grid { display: grid; gap: 1rem; }
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--accent) / .4) 50%, hsl(var(--muted)) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ================================================================== *
 * Estrutura
 * ================================================================== */
.app { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
  background: hsl(var(--background));
}

.sidebar-head {
  padding: 1rem 1rem .875rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.brand { display: flex; align-items: center; gap: .625rem; min-width: 0; }
.brand-mark {
  width: 2.125rem; height: 2.125rem; border-radius: .625rem;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: grid; place-items: center;
}
.brand-mark svg { width: 1.0625rem; height: 1.0625rem; }
.brand-mark { overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 600; letter-spacing: -0.015em; }
.brand-sub { font-size: .75rem; color: hsl(var(--muted-foreground)); }

.sidebar-bar { padding: .875rem .5rem .375rem .875rem; display: flex; align-items: center; justify-content: space-between; }
.month-list { flex: 1; overflow-y: auto; padding: 0 .5rem .5rem; display: flex; flex-direction: column; gap: .25rem; }
.sidebar-foot { padding: .75rem; border-top: 1px solid hsl(var(--border)); }

.month-item {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  border-radius: .75rem; padding: .625rem .75rem;
  transition: background-color .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
.month-item:hover { background: hsl(var(--accent)); }
.month-item:active { transform: scale(.985); }
.month-item[aria-current="true"] { background: hsl(var(--accent)); border-color: hsl(var(--border)); }
.month-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.month-name { font-weight: 500; letter-spacing: -0.01em; }
.month-meta { font-size: .75rem; color: hsl(var(--muted-foreground)); }
.month-item > .month-meta { display: block; margin-top: .0625rem; }
.month-track {
  display: block; height: 3px; margin-top: .5rem; border-radius: 999px;
  background: hsl(var(--secondary)); overflow: hidden;
}
.month-track span { display: block; height: 100%; border-radius: 999px; background: hsl(var(--primary)); transition: width .6s var(--ease); }
.month-track.over span { background: hsl(var(--destructive)); }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: hsl(var(--background) / .85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid hsl(var(--border));
  padding: .875rem 1.5rem;
  display: flex; align-items: center; gap: .75rem;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.025em; }
.topbar-title p { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin-top: .0625rem; }
.topbar-actions { display: flex; gap: .5rem; }

.tabs {
  display: flex; gap: .25rem; padding: .25rem;
  background: hsl(var(--muted)); border-radius: .75rem;
  width: fit-content; margin: 1.25rem 1.5rem 0;
}
.tab {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  padding: .4375rem .875rem; border-radius: .5rem;
  font-weight: 500; font-size: .8125rem; color: hsl(var(--muted-foreground));
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.tab:hover { color: hsl(var(--foreground)); }
.tab[aria-selected="true"] {
  background: hsl(var(--background)); color: hsl(var(--foreground));
  box-shadow: 0 1px 2px hsl(var(--foreground) / .07);
}

.content { padding: 1.25rem 1.5rem 3rem; display: flex; flex-direction: column; gap: 1rem; }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

/* ================================================================== *
 * Card aninhado
 * ================================================================== */
.card {
  background: hsl(var(--muted) / .45);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: .3125rem;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .625rem .75rem .6875rem;
}
.card-title { font-size: .8125rem; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: .4375rem; }
.card-sub { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .0625rem; }
.panel {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - .3125rem);
  padding: 1rem 1.125rem;
}
.panel-flush { padding: 0; overflow: hidden; }

.stat-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.035em; }
.stat-note { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .375rem; }
.pos { color: hsl(var(--success)); }
.neg { color: hsl(var(--destructive)); }

.stat-actions { display: flex; gap: .5rem; margin-top: 1rem; }

/* ================================================================== *
 * Botões
 * ================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4375rem;
  height: 2.25rem; padding: 0 .875rem;
  border: 1px solid transparent; border-radius: .625rem;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font: inherit; font-weight: 500; font-size: .8125rem;
  cursor: pointer; white-space: nowrap;
  transition: background-color .16s var(--ease), transform .12s var(--ease), opacity .16s var(--ease);
}
.btn:hover { background: hsl(var(--primary) / .88); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: .875rem; height: .875rem; }

.btn-outline { background: hsl(var(--card)); color: hsl(var(--foreground)); border-color: hsl(var(--border)); }
.btn-outline:hover { background: hsl(var(--accent)); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: #fff; }
.btn-destructive:hover { background: hsl(var(--destructive) / .9); }
.btn-sm { height: 2rem; padding: 0 .75rem; }
.btn-block { width: 100%; }

.icon-btn {
  width: 2.125rem; height: 2.125rem; flex-shrink: 0;
  display: grid; place-items: center;
  border: 0; background: transparent; color: hsl(var(--foreground));
  border-radius: .5rem; cursor: pointer;
  transition: background-color .16s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { background: hsl(var(--accent)); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 1.0625rem; height: 1.0625rem; }
.icon-btn.sm { width: 1.75rem; height: 1.75rem; }
.icon-btn.sm svg { width: .875rem; height: .875rem; }

/* ================================================================== *
 * Badges e barras
 * ================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: .3125rem;
  border-radius: 999px; padding: .1875rem .5rem;
  font-size: .6875rem; font-weight: 600; line-height: 1;
  background: hsl(var(--secondary)); color: hsl(var(--foreground));
  border: 1px solid transparent; white-space: nowrap;
}
.badge svg { width: .75rem; height: .75rem; }
.badge-outline { background: hsl(var(--card)); border-color: hsl(var(--border)); color: hsl(var(--muted-foreground)); font-weight: 500; }
.badge-up { background: hsl(var(--success) / .1); color: hsl(var(--success)); }
.badge-down { background: hsl(var(--destructive) / .1); color: hsl(var(--destructive)); }
.badge-warn { background: hsl(var(--warning) / .12); color: hsl(var(--warning)); }
.dot { width: .5rem; height: .5rem; border-radius: 999px; flex-shrink: 0; }

.progress { height: .5rem; border-radius: 999px; background: hsl(var(--secondary)); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: 999px; background: hsl(var(--primary)); transition: width .8s var(--ease); }
.progress.over > span { background: hsl(var(--destructive)); }
.progress-lg { height: .625rem; }

/* Barra empilhada (fontes de renda) */
.stack { display: flex; gap: 3px; height: .625rem; margin-bottom: 1rem; }
.stack span {
  display: block; height: 100%; width: 0; border-radius: 999px;
  transition: width .8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms);
}
.stack-empty { background: hsl(var(--secondary)); border-radius: 999px; width: 100% !important; }

.row-list { display: flex; flex-direction: column; }
.row-line {
  display: flex; align-items: center; gap: .625rem;
  font-size: .8125rem; padding: .5625rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.row-line:last-child { border-bottom: 0; padding-bottom: 0; }
.row-line:first-child { padding-top: 0; }
.row-line .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-line .value { font-weight: 500; font-variant-numeric: tabular-nums; }
.row-line .pct { color: hsl(var(--muted-foreground)); width: 2.75rem; text-align: right; font-variant-numeric: tabular-nums; font-size: .75rem; }

/* Donut */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.donut { position: relative; width: 11.5rem; height: 11.5rem; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { transition: stroke-dasharray .9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { display: block; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; }
.donut-center span { font-size: .75rem; color: hsl(var(--muted-foreground)); }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; width: 100%; }
.chip {
  display: flex; align-items: center; gap: .4375rem;
  background: hsl(var(--muted) / .6); border: 1px solid hsl(var(--border));
  border-radius: .625rem; padding: .5rem .625rem; font-size: .75rem;
}
.chip .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .pct { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Barras por dia */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 9rem; }
.bar {
  flex: 1; min-width: 0; height: 0; border-radius: 3px 3px 0 0;
  background: hsl(var(--secondary));
  transition: height .7s var(--ease), background-color .16s var(--ease);
  transition-delay: calc(var(--i, 0) * 12ms);
}
.bar[data-has="1"] { background: hsl(var(--foreground) / .82); }
.bar:hover { background: hsl(var(--foreground)); }
.bars-axis { display: flex; justify-content: space-between; font-size: .6875rem; color: hsl(var(--muted-foreground)); margin-top: .625rem; }

/* Linha de categoria com teto */
.cat-line { padding: .8125rem 0; border-bottom: 1px solid hsl(var(--border)); }
.cat-line:first-child { padding-top: 0; }
.cat-line:last-child { border-bottom: 0; padding-bottom: 0; }
.cat-top { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; margin-bottom: .5rem; }
.cat-top .name { flex: 1; font-weight: 500; }
.cat-top .value { color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; font-size: .75rem; }

/* ================================================================== *
 * Lista de lançamentos (cartões no mobile, tabela no desktop)
 * ================================================================== */
.tx-list { display: flex; flex-direction: column; }
.tx {
  display: flex; align-items: center; gap: .75rem;
  padding: .8125rem 1.125rem;
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color .16s var(--ease);
}
.tx:last-child { border-bottom: 0; }
.tx:hover { background: hsl(var(--muted) / .5); }
.tx-icon {
  width: 2.25rem; height: 2.25rem; border-radius: .625rem;
  display: grid; place-items: center; flex-shrink: 0;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
}
.tx-icon svg { width: 1rem; height: 1rem; }
.tx-icon.in { background: hsl(var(--success) / .12); color: hsl(var(--success)); }
.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: .75rem; color: hsl(var(--muted-foreground)); display: flex; align-items: center; gap: .375rem; margin-top: .0625rem; }
.tx-right { display: flex; align-items: center; gap: .375rem; }
.tx-amount { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.tx-actions { display: flex; gap: .125rem; }
@media (hover: hover) {
  .tx-actions { opacity: 0; transition: opacity .16s var(--ease); }
  .tx:hover .tx-actions, .tx:focus-within .tx-actions { opacity: 1; }
}

.empty { padding: 2.25rem 1.25rem; text-align: center; }
.empty-icon {
  width: 2.75rem; height: 2.75rem; border-radius: .75rem; margin: 0 auto .875rem;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); display: grid; place-items: center;
}
.empty-icon svg { width: 1.25rem; height: 1.25rem; }
.empty-title { font-weight: 500; }
.empty-desc { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin: .25rem 0 1rem; }

/* ================================================================== *
 * Formulário
 * ================================================================== */
.field { display: flex; flex-direction: column; gap: .4375rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.label { font-size: .8125rem; font-weight: 500; line-height: 1; }
.hint { font-size: .75rem; color: hsl(var(--muted-foreground)); }

.input, .select {
  height: 2.625rem; width: 100%;
  border: 1px solid hsl(var(--border)); background: hsl(var(--card));
  border-radius: .625rem; padding: 0 .8125rem;
  font: inherit; font-size: 1rem; color: hsl(var(--foreground));
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input:focus, .select:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .12);
}
.input::placeholder { color: hsl(var(--muted-foreground)); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .6875rem center;
  padding-right: 2.125rem;
}

.money-field { position: relative; }
.money-field .input { padding-left: 2.5rem; font-variant-numeric: tabular-nums; font-weight: 500; }
.money-field::before {
  content: "R$"; position: absolute; left: .8125rem; top: 50%; transform: translateY(-50%);
  font-size: .8125rem; font-weight: 500; color: hsl(var(--muted-foreground)); pointer-events: none;
}
.money-field.big .input { height: 3.5rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.03em; padding-left: 3rem; }
.money-field.big::before { font-size: 1rem; left: 1rem; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; background: hsl(var(--muted)); padding: .25rem; border-radius: .625rem; }
.segmented button {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  padding: .5rem; border-radius: .5rem; font-weight: 500; font-size: .8125rem;
  color: hsl(var(--muted-foreground));
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.segmented button[aria-pressed="true"] { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px hsl(var(--foreground) / .08); }

.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch {
  width: 1.75rem; height: 1.75rem; border-radius: 999px; cursor: pointer; padding: 0;
  border: 2px solid hsl(var(--card)); box-shadow: 0 0 0 1px hsl(var(--border));
  transition: transform .16s var(--ease-spring), box-shadow .16s var(--ease);
}
.swatch:hover { transform: scale(1.1); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px hsl(var(--ring)); transform: scale(1.1); }

.check { display: flex; align-items: center; gap: .625rem; font-size: .8125rem; cursor: pointer; }
.check input { width: 1.0625rem; height: 1.0625rem; accent-color: hsl(var(--primary)); }

/* ================================================================== *
 * Diálogo · bottom sheet no celular
 * ================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: hsl(240 10% 3.9% / .45);
  backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 1rem;
  animation: fade .2s var(--ease);
}
.dialog {
  width: 100%; max-width: 27rem; max-height: calc(100dvh - 2rem); overflow-y: auto;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  box-shadow: 0 24px 48px -12px hsl(var(--foreground) / .18);
  animation: pop .28s var(--ease-spring);
}
.grabber { display: none; }
.dialog-head { padding: 1.375rem 1.375rem 0; }
.dialog-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; }
.dialog-desc { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin-top: .25rem; }
.dialog-body { padding: 1.125rem 1.375rem; display: flex; flex-direction: column; gap: .875rem; }
.dialog-foot { padding: 0 1.375rem 1.375rem; display: flex; gap: .5rem; }
.dialog-foot .btn { flex: 1; height: 2.625rem; }
.dialog-error {
  font-size: .8125rem; color: hsl(var(--destructive));
  background: hsl(var(--destructive) / .08); border-radius: .625rem; padding: .625rem .8125rem;
  animation: rise .3s var(--ease);
}

.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.toast {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  border-radius: .75rem; padding: .6875rem 1rem;
  box-shadow: 0 12px 24px -8px hsl(var(--foreground) / .3);
  font-size: .8125rem; font-weight: 500;
  animation: pop .28s var(--ease-spring);
}
.toast.out { animation: fade .25s var(--ease) reverse forwards; }
.toast.error { background: hsl(var(--destructive)); color: #fff; }

/* ================================================================== *
 * Gaveta, nav inferior e FAB
 * ================================================================== */
.scrim { position: fixed; inset: 0; z-index: 40; background: hsl(240 10% 3.9% / .4); animation: fade .2s var(--ease); }
.mobile-only,
.bottom-nav.mobile-only,
.fab.mobile-only,
.icon-btn.mobile-only,
.icon-btn.drawer-only { display: none; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
  background: hsl(var(--background) / .92);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid hsl(var(--border));
  padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(2, 1fr) 4rem repeat(2, 1fr);
}
.nav-item {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: .375rem .25rem; border-radius: .625rem;
  font-size: .625rem; font-weight: 500; color: hsl(var(--muted-foreground));
  transition: color .18s var(--ease);
}
.nav-item svg { width: 1.25rem; height: 1.25rem; transition: transform .28s var(--ease-spring); }
.nav-item[aria-selected="true"] { color: hsl(var(--foreground)); }
.nav-item[aria-selected="true"] svg { transform: translateY(-2px) scale(1.08); }

.fab {
  position: fixed; z-index: 36;
  bottom: calc(1.05rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: 3.25rem; height: 3.25rem; border-radius: 999px; border: 4px solid hsl(var(--background));
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 20px -6px hsl(var(--foreground) / .4);
  transition: transform .18s var(--ease-spring);
}
.fab svg { width: 1.375rem; height: 1.375rem; }
.fab:active { transform: translateX(-50%) scale(.9); }

/* ================================================================== *
 * Responsivo
 * ================================================================== */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex; }
  .bottom-nav.mobile-only { display: grid; }
  .fab.mobile-only, .icon-btn.mobile-only, .drawer-only { display: grid; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: min(19rem, 86vw);
    box-shadow: 0 0 40px hsl(var(--foreground) / .12);
    animation: slideIn .32s var(--ease);
  }
  .sidebar[hidden] { display: none; }

  .topbar { padding: .75rem 1rem; }
  .topbar-title h1 { font-size: 1.0625rem; }
  .topbar-title p { font-size: .75rem; }

  .content { padding: 1rem 1rem 7rem; gap: .875rem; }
  .grid { gap: .875rem; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }

  .stat-value { font-size: 1.625rem; }
  .panel { padding: .9375rem 1rem; }
  .tx { padding: .75rem 1rem; }
  .donut { width: 10.5rem; height: 10.5rem; }

  /* Diálogo vira bottom sheet */
  .overlay { display: block; padding: 0; }
  .dialog {
    position: fixed; bottom: 0; left: 0; right: 0;
    max-width: none; width: 100%;
    max-height: 92dvh;
    border-radius: 1.25rem 1.25rem 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet .34s var(--ease);
  }
  .grabber { display: block; width: 2.25rem; height: .25rem; border-radius: 999px; background: hsl(var(--border)); margin: .625rem auto .125rem; }
  .dialog-head { padding-top: .875rem; }
  .toasts { bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .chips { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .chips { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; transition-delay: 0ms !important;
  }
}


.brand-mark { overflow: hidden; padding: 0; }
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
