/* ============================================================
   NINA — App styles (client web panel)
   Built on the foundation tokens in colors_and_type.css.
   Accent is always var(--coral) so white-label can re-theme.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: 8px; }
button { font-family: inherit; cursor: pointer; }
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; white-space: nowrap; }
.serif { font-family: var(--font-display); }
.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; }

/* ---------------- App frame ---------------- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: var(--space-6) var(--space-4);
  gap: var(--space-2); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px var(--space-5); }
.brand__mark { width: 38px; height: 38px; border-radius: var(--radius-full); object-fit: cover; box-shadow: var(--shadow-sm); flex: none; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); letter-spacing: -0.01em; color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__group-label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--subtle); font-weight: 700; padding: var(--space-4) var(--space-3) var(--space-2); }
.nav__item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-btn);
  color: var(--muted); font-weight: 500; font-size: var(--text-sm); border: none; background: none;
  text-align: left; width: 100%; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav__item svg { width: 19px; height: 19px; flex: none; stroke-width: 2; }
.nav__item:hover { background: var(--surface-warm); color: var(--ink); }
.nav__item--active { background: var(--coral-tint); color: var(--coral-strong); font-weight: 600; }
.nav__item--active svg { color: var(--coral-strong); }
.nav__badge { margin-left: auto; background: var(--coral); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill); }
.sidebar__foot { margin-top: auto; position: relative; }

/* account button + dropdown */
.acct-btn { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: background var(--dur-fast), border-color var(--dur-fast); text-align: left; }
.acct-btn:hover { background: var(--surface-warm); border-color: #e6d6c6; }
.acct-btn.open { background: var(--surface-warm); }
.acct-av { width: 38px; height: 38px; border-radius: var(--radius-full); flex: none; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 17px; background: var(--coral-tint); color: var(--coral-strong); }
.acct-meta { min-width: 0; flex: 1; }
.acct-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub { display: block; font-size: 11px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-chev { color: var(--subtle); transition: transform var(--dur-fast); flex: none; }
.acct-btn.open .acct-chev { transform: rotate(180deg); }

.acct-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50; animation: acctIn var(--dur-base) var(--ease-out); transform-origin: bottom center; }
@keyframes acctIn { from { transform: translateY(8px) scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .acct-menu { animation: none; } }
.acct-head { display: flex; align-items: center; gap: 11px; padding: 10px 10px 12px; }
.acct-upsell { margin: 0 4px 8px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, var(--coral-tint), var(--amber-tint)); }
.acct-upsell__top { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12px; color: var(--coral-strong); }
.acct-upsell__sub { font-size: 11px; color: var(--muted); margin: 3px 0 9px; }
.acct-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 11px; border: none; background: none; text-align: left; font-size: 13px; font-weight: 500; color: var(--ink); transition: background var(--dur-fast); }
.acct-item svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.acct-item:hover { background: var(--surface-warm); }
.acct-item__badge { margin-left: auto; background: var(--coral); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill); }
.acct-item--danger { color: var(--expense); } .acct-item--danger svg { color: var(--expense); }
.trial-chip {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--coral-tint), var(--amber-tint)); border: 1px solid var(--line);
}
.trial-chip__top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--text-sm); color: var(--coral-strong); white-space: nowrap; }
.trial-chip__sub { line-height: 1.4; }
.trial-chip__sub { font-size: 12px; color: var(--muted); }

/* ---------------- Topbar + main ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-8); background: rgba(255,251,245,0.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-2xl); letter-spacing: -0.01em; white-space: nowrap; }
.topbar__spacer { flex: 1; }
.content { padding: var(--space-8); max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: var(--space-6); }
.page-head__sub { color: var(--muted); margin-top: 4px; }

/* ---------------- Period selector ---------------- */
.period { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.period button { border: none; background: none; padding: 6px 13px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--muted); transition: color var(--dur-fast); position: relative; }
.period button.is-active { color: var(--coral-strong); }
.period__pill { position: absolute; inset: 0; background: var(--coral-tint); border-radius: var(--radius-pill); z-index: -1; }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--radius-btn); white-space: nowrap;
  font-weight: 600; font-size: var(--text-sm); padding: 11px 18px; border: 1px solid transparent; transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), box-shadow var(--dur-fast); }
.btn svg { width: 18px; height: 18px; stroke-width: 2; }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--coral-strong); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: #cf4426; }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { background: var(--surface-warm); border-color: #e6d6c6; }
.btn--ghost { background: none; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-warm); color: var(--ink); }
.btn--whats { background: #25D366; color: #fff; }
.btn--whats:hover { background: #1faa52; }
.btn--danger { background: var(--surface); color: var(--expense); border-color: var(--expense-tint); }
.btn--danger:hover { background: var(--expense-tint); }
.btn--lg { padding: 14px 24px; font-size: var(--text-base); }
.btn--block { width: 100%; }
.btn--icon { padding: 9px; }

/* ---------------- Cards ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
.card--pad { padding: var(--space-6); }
.card-hover { transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-5); gap: var(--space-4); }
.card__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); margin: 0; line-height: 1.2; }
.card__hint { font-size: 13px; color: var(--subtle); }

/* ---------------- StatCard ---------------- */
.stat { padding: var(--space-5) var(--space-6); }
.stat__label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat__dot { width: 9px; height: 9px; border-radius: var(--radius-full); }
.stat__value { font-family: var(--font-display); font-weight: 600; font-size: var(--text-3xl); letter-spacing: -0.02em; margin: 8px 0 6px; }
.stat__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.stat__delta svg { width: 14px; height: 14px; }
.up { color: var(--expense); } .down { color: var(--mint-strong); }
.delta-muted { color: var(--subtle); font-weight: 500; }

/* grids */
.grid { display: grid; gap: var(--space-5); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1080px) { .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-2 { grid-column: span 2; } }

/* ---------------- Pills / badges ---------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: var(--radius-pill); letter-spacing: 0.01em; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: var(--radius-full); }
.pill--mint { background: var(--mint-tint); color: var(--mint-strong); }
.pill--coral { background: var(--coral-tint); color: var(--coral-strong); }
.pill--amber { background: var(--amber-tint); color: #92610b; }
.pill--red { background: var(--expense-tint); color: var(--expense); }
.pill--info { background: #E0F2FE; color: #0369a1; }
.pill--neutral { background: var(--surface-warm); color: var(--muted); }

/* ---------------- Transaction row ---------------- */
.txlist { display: flex; flex-direction: column; }
.txrow { display: flex; align-items: center; gap: var(--space-4); padding: 13px 8px; border-radius: 14px; transition: background var(--dur-fast); }
.txrow:hover { background: var(--surface-warm); }
.txrow__emoji { width: 42px; height: 42px; border-radius: var(--radius-full); display: grid; place-items: center; font-size: 20px; background: var(--surface-warm); flex: none; }
.txrow__main { min-width: 0; flex: 1; }
.txrow__desc { display: block; max-width: 100%; font-weight: 600; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txrow__meta { font-size: 12px; color: var(--subtle); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.txrow__amount { font-weight: 700; font-size: var(--text-sm); white-space: nowrap; }
.amt-income { color: var(--mint-strong); } .amt-expense { color: var(--ink); }
.src-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--subtle); display: inline-block; }
.divider { height: 1px; background: var(--line); border: none; margin: 0; }

/* ---------------- Progress bar (budgets) ---------------- */
.progress { height: 10px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.progress__fill { height: 100%; border-radius: var(--radius-pill); transition: width var(--dur-slow) var(--ease-out); }

/* ---------------- Switch ---------------- */
.switch { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background var(--dur-fast) var(--ease-out); }
.switch.on { background: var(--coral-strong); }
.switch__dot { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur-base) var(--ease-spring); }
.switch.on .switch__dot { transform: translateX(18px); }

/* ---------------- Capture modal (foto / voz / manual) ---------------- */
.cap-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cap-mode { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 16px 8px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); transition: all var(--dur-fast) var(--ease-out); }
.cap-mode:hover { border-color: var(--coral); background: var(--surface-warm); }
.cap-mode.on { border-color: var(--coral-strong); background: var(--coral-tint); }
.cap-mode__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-warm); color: var(--muted); transition: all var(--dur-fast); }
.cap-mode.on .cap-mode__ic { background: var(--coral-strong); color: #fff; }
.cap-mode__lb { font-size: 13px; font-weight: 600; color: var(--ink); }
.cap-mode__sb { font-size: 11px; color: var(--subtle); text-align: center; }

.dropzone { border: 2px dashed var(--line); border-radius: 18px; padding: var(--space-8) var(--space-6); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--surface-warm); transition: border-color var(--dur-fast), background var(--dur-fast); cursor: pointer; }
.dropzone:hover { border-color: var(--coral); background: var(--coral-tint); }
.dropzone__ic { width: 56px; height: 56px; border-radius: var(--radius-full); display: grid; place-items: center; background: var(--surface); color: var(--coral-strong); box-shadow: var(--shadow-sm); }

/* AI analyzing — scan line over a receipt */
.scan { position: relative; width: 150px; height: 190px; margin: 0 auto; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--line); }
.scan__lines { padding: 18px 16px; display: flex; flex-direction: column; gap: 9px; }
.scan__lines div { height: 7px; border-radius: 4px; background: var(--line); }
.scan__beam { position: absolute; left: 0; right: 0; height: 36px; top: -36px; background: linear-gradient(180deg, transparent, rgba(255,122,89,0.35), transparent); animation: scanmove 1.5s ease-in-out infinite; }
@keyframes scanmove { 0% { top: -36px; } 100% { top: 190px; } }
@media (prefers-reduced-motion: reduce) { .scan__beam { animation: none; opacity: .4; top: 80px; } }

/* voice */
.mic-btn { width: 92px; height: 92px; border-radius: var(--radius-full); border: none; background: var(--coral-strong); color: #fff; display: grid; place-items: center; margin: 0 auto; box-shadow: var(--shadow-md); position: relative; transition: transform var(--dur-fast) var(--ease-out); }
.mic-btn:hover { transform: scale(1.04); }
.mic-btn.live::before, .mic-btn.live::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--coral); animation: micpulse 1.6s ease-out infinite; }
.mic-btn.live::after { animation-delay: .8s; }
@keyframes micpulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mic-btn.live::before, .mic-btn.live::after { animation: none; } }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 40px; }
.wave span { width: 4px; border-radius: 4px; background: var(--coral); animation: wavebar 0.9s ease-in-out infinite; }
@keyframes wavebar { 0%,100% { height: 8px; } 50% { height: 32px; } }
@media (prefers-reduced-motion: reduce) { .wave span { height: 18px; animation: none; } }

/* parsed result card */
.parsed { border: 1px solid var(--mint-tint); background: var(--mint-tint); border-radius: 16px; padding: var(--space-5); }
.parsed__row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; }
.parsed__row + .parsed__row { border-top: 1px solid rgba(5,150,105,0.12); }

/* admin finance line */
.fin-line { display: flex; flex-direction: column; gap: 4px; min-width: 140px; flex: 1; }
.fin-line__lb { font-size: 13px; font-weight: 700; color: var(--muted); }
.fin-line__v { font-size: 30px; font-weight: 600; line-height: 1.1; }
.fin-op { font-family: var(--font-display); font-size: 30px; color: var(--subtle); align-self: center; }
@media (max-width: 760px) { .fin-op { display: none; } }

/* admin palette picker */
.pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pal-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface); text-align: left; transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out); }
.pal-card:hover { transform: translateY(-2px); border-color: var(--coral); }
.pal-card.on { border-color: var(--coral-strong); box-shadow: 0 0 0 3px var(--coral-tint); }
.pal-swatch { display: flex; gap: 5px; height: 32px; }
.pal-swatch span { flex: 1; border-radius: 7px; }

/* settings sub-tabs */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--space-6); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { border: none; background: none; padding: 11px 4px; margin-right: 20px; font-size: var(--text-sm); font-weight: 600; color: var(--muted); position: relative; white-space: nowrap; transition: color var(--dur-fast); }
.subtabs button:hover { color: var(--ink); }
.subtabs button.on { color: var(--coral-strong); }
.subtabs button.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--coral-strong); border-radius: 2px; }

/* compromisso row actions */
.cmp-actions { opacity: 0; transition: opacity var(--dur-fast); }
.cmp-row:hover .cmp-actions, .cmp-row:focus-within .cmp-actions { opacity: 1; }
@media (hover: none) { .cmp-actions { opacity: 1; } }

/* ---------------- Inputs ---------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.input, .select { font-family: inherit; font-size: var(--text-base); padding: 12px 14px; border-radius: var(--radius-input); border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: border var(--dur-fast), box-shadow var(--dur-fast); width: 100%; }
.input:focus, .select:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-tint); outline: none; }
.input::placeholder { color: var(--subtle); }
.field__error { font-size: 12px; color: var(--expense); }
.money-input { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 600; text-align: center; border: none; background: none; width: 100%; color: var(--ink); font-variant-numeric: tabular-nums; }
.money-input:focus { outline: none; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-warm); border-radius: var(--radius-btn); padding: 3px; gap: 2px; }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll .seg { min-width: max-content; }
.seg button { border: none; background: none; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all var(--dur-fast); }
.seg button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg--full { display: flex; width: 100%; }
.seg--full button { flex: 1; }

/* category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--muted); transition: all var(--dur-fast); }
.chip:hover { border-color: var(--coral); color: var(--ink); }
.chip.is-active { background: var(--coral-tint); border-color: transparent; color: var(--coral-strong); }

/* ---------------- Modal / sheet ---------------- */
.backdrop { position: fixed; inset: 0; background: rgba(31,41,55,0.32); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: var(--space-6); }
.modal { background: var(--surface); border-radius: 24px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto; animation: modalIn var(--dur-base) var(--ease-out); }
.modal--wide { max-width: 560px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-6) var(--space-6) 0; }
.modal__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); }
.modal__body { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.modal__foot { display: flex; gap: 12px; padding: 0 var(--space-6) var(--space-6); }
.x-btn { border: none; background: var(--surface-warm); width: 34px; height: 34px; border-radius: var(--radius-full); display: grid; place-items: center; color: var(--muted); transition: all var(--dur-fast); }
.x-btn:hover { background: var(--line); color: var(--ink); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { transform: scale(0.96) translateY(8px); } }

/* ---------------- Drawer ---------------- */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 92vw; background: var(--surface); box-shadow: var(--shadow-lg); z-index: 100; overflow: auto; animation: drawerIn var(--dur-slow) var(--ease-out); }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 13px 18px; border-radius: var(--radius-btn); box-shadow: var(--shadow-lg); font-size: var(--text-sm); font-weight: 500; animation: toastIn var(--dur-base) var(--ease-spring); }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--ok svg { color: var(--mint); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ---------------- Skeleton ---------------- */
.sk { background: linear-gradient(90deg, var(--line) 25%, #f7ede2 50%, var(--line) 75%); background-size: 200% 100%; border-radius: 8px; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------------- Empty / error ---------------- */
.state-box { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--space-16) var(--space-6); gap: var(--space-4); }
.state-box__art { width: 120px; height: 120px; }
.state-box__title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); }
.state-box__sub { color: var(--muted); max-width: 360px; }
.float-anim { animation: floaty 4s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .float-anim { animation: none; } }

/* ---------------- Nina avatar / insight ---------------- */
.insight { display: flex; gap: var(--space-4); padding: var(--space-5) var(--space-6); background: linear-gradient(135deg, var(--coral-tint), var(--amber-tint)); border-radius: var(--radius-card); border: 1px solid #f7ddcb; }
.insight__avatar { width: 48px; height: 48px; border-radius: var(--radius-full); object-fit: cover; flex: none; box-shadow: var(--shadow-sm); }
.insight__name { font-weight: 700; font-size: 13px; color: var(--coral-strong); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.insight__text { font-size: var(--text-sm); color: var(--ink); line-height: 1.5; }
.typing { display: inline-flex; gap: 3px; align-items: center; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); animation: typing 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------------- Motion: page entrance + stagger ---------------- */
.rise { animation: rise var(--dur-slow) var(--ease-out); }
@keyframes rise { from { transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ---------------- Speed-dial FAB (lançamento rápido) ---------------- */
.fab-dial { position: fixed; right: 28px; bottom: 28px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.fab-main { width: 60px; height: 60px; border-radius: var(--radius-full); background: var(--coral-strong); color: #fff; border: none; display: grid; place-items: center; box-shadow: var(--shadow-md); transition: transform var(--dur-base) var(--ease-spring), background var(--dur-fast); }
.fab-main:hover { background: #cf4426; }
.fab-dial.open .fab-main { transform: rotate(135deg); }
.fab-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.fab-act { display: flex; align-items: center; gap: 12px; border: none; background: none; padding: 0; cursor: pointer;
  opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring); }
.fab-dial.open .fab-act { opacity: 1; transform: none; pointer-events: auto; }
.fab-act__lb { display: flex; flex-direction: column; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); border-radius: 12px; padding: 7px 13px; line-height: 1.2; }
.fab-act__lb b { font-size: 13px; font-weight: 700; color: var(--ink); }
.fab-act__lb i { font-size: 11px; color: var(--subtle); font-style: normal; }
.fab-act__ic { width: 46px; height: 46px; border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--line); color: var(--coral-strong); display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none; transition: background var(--dur-fast), color var(--dur-fast); }
.fab-act:hover .fab-act__ic { background: var(--coral-strong); color: #fff; }
@media (prefers-reduced-motion: reduce) { .fab-main, .fab-act { transition: none; } }

/* spinner */
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin 0.7s linear infinite; flex: none; }
.spin--dark { border-color: var(--line); border-top-color: var(--coral-strong); }
@keyframes spin { to { transform: rotate(360deg); } }

/* chips: variante rolável (1 linha) p/ filtros com muitas categorias */
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 4px; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.chips--scroll::-webkit-scrollbar { display: none; }
.chips--scroll .chip { white-space: nowrap; flex: none; }

/* seletor de cartão (chips grandes) */
.card-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.card-pick__item { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; color: var(--ink); font-family: inherit; cursor: pointer; transition: all var(--dur-fast); }
.card-pick__item:hover { border-color: var(--coral); }
.card-pick__item.on { border-color: var(--coral-strong); background: var(--coral-tint); color: var(--coral-strong); }

/* ---------------- misc layout helpers ---------------- */
.row { display: flex; align-items: center; gap: var(--space-3); }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); } .subtle { color: var(--subtle); }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.gap-2 { gap: 8px; } .gap-4 { gap: 16px; }

/* segmented data-state switch in topbar (review tool) */
.statewitch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.statewitch__seg { display: inline-flex; background: var(--surface-warm); border-radius: var(--radius-pill); padding: 2px; }
.statewitch__seg button { border: none; background: none; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: var(--radius-pill); color: var(--subtle); }
.statewitch__seg button.on { background: var(--surface); color: var(--coral-strong); box-shadow: var(--shadow-sm); }

/* ---------------- Mobile ---------------- */
.menu-btn, .mobile-tabbar { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform var(--dur-slow) var(--ease-out); width: 280px; box-shadow: var(--shadow-lg); overflow-y: auto; -webkit-overflow-scrolling: touch; z-index: 50; }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(31,41,55,0.3); z-index: 45; }
  .sidebar.open ~ .mobile-tabbar, .sidebar.open ~ .fab-dial { opacity: 0; pointer-events: none; }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-btn); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
  .topbar { padding: var(--space-3) var(--space-4); }
  .topbar__title { font-size: var(--text-lg); }
  .content { padding: var(--space-4); padding-bottom: 96px; }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: span 1; }
  .drawer { width: 100%; max-width: 100%; }
  .mobile-tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: rgba(255,255,255,0.92); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobile-tabbar button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: var(--subtle); padding: 4px 10px; border-radius: 12px; }
  .mobile-tabbar button svg { width: 22px; height: 22px; }
  .mobile-tabbar button.on { color: var(--coral-strong); }
  .tab-add { background: var(--coral-strong) !important; color: #fff !important; width: 52px; height: 52px; border-radius: var(--radius-full); margin-top: -22px; box-shadow: var(--shadow-md); align-self: center; }
  .statewitch { display: none; }
  .cap-mode__sb { display: none; }
  .fab-dial { right: 18px; bottom: 82px; }
}
@media (max-width: 480px) {
  .content { padding: var(--space-3); padding-bottom: 92px; }
  .card--pad { padding: var(--space-4); }
  .stat { padding: var(--space-4); }
  .money-input { font-size: var(--text-2xl); }
  .modal__body, .modal__head, .modal__foot { padding-left: var(--space-4); padding-right: var(--space-4); }
}
