/* APOLLO — interface */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  background-image: var(--bg-tint); background-attachment: fixed; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
svg { flex-shrink: 0; }
.num, .display { font-family: var(--font-display); font-feature-settings: 'tnum' 1; letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.pos { color: var(--income); } .neg { color: var(--expense); } .warn { color: var(--pending); } .proj { color: var(--projected); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Shell ---------- */
#app { min-height: 100dvh; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-header {
  position: sticky; top: 0; z-index: 30; padding: calc(var(--safe-top) + 10px) 18px 10px;
  display: flex; align-items: center; gap: 12px; background: var(--glass);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.app-header.scrolled { border-bottom-color: var(--line); }
.app-header .brand-mark { width: 34px; height: 30px; }
.app-header .brand-full { display: none; height: 30px; }
.app-header .title { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.02em; }
.app-header .subtitle { font-size: 12px; color: var(--text-3); margin-top: -2px; }
.header-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text-2);
  background: var(--surface); box-shadow: var(--shadow-1); position: relative; transition: transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--surface); }
.desk-nav { display: none; }
.desk-add { display: none; }

main.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px); }
.page-enter { animation: pageIn .38s var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Barra inferior */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 6px 10px var(--safe-bottom); display: grid; grid-template-columns: repeat(5, 1fr); align-items: start;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 6px; color: var(--text-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em; transition: color .2s;
}
.tab svg { width: 24px; height: 24px; transition: transform .25s var(--ease-out); }
.tab.active { color: var(--accent); }
.tab.active svg { transform: translateY(-1px); }
.tab-add { display: grid; place-items: center; }
.fab {
  width: 54px; height: 54px; margin-top: -14px; border-radius: 19px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, var(--brand-capri), var(--brand-electric) 55%, var(--brand-ocean));
  box-shadow: var(--shadow-fab); transition: transform .25s var(--ease-out), border-radius .25s;
}
.fab svg { width: 26px; height: 26px; transition: transform .3s var(--ease-out); }
.fab.open { transform: rotate(0); border-radius: 50%; }
.fab.open svg { transform: rotate(45deg); }
.fab:active { transform: scale(.94); }

/* ---------- Tipografia de seção ---------- */
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.section-head h2, .h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.section-head .link { font-size: 13px; font-weight: 600; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 26px; letter-spacing: -.03em; margin: 6px 2px 2px; }

/* ---------- Superfícies ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px; position: relative; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tight { padding: 14px; }
.card.pad0 { padding: 0; overflow: hidden; }
.card-title { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .info { color: var(--text-3); width: 16px; height: 16px; }

/* Hero de saldo */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); color: #fff; padding: 22px 20px 18px;
  background: var(--hero); box-shadow: 0 18px 40px rgba(16,49,143,.28);
}
.hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(500px 220px at 85% -10%, rgba(39,227,242,.35), transparent 60%); pointer-events: none; }
.hero .orbit-deco { position: absolute; right: -60px; top: -30px; width: 340px; opacity: .55; pointer-events: none; }
.hero .label { font-size: 13px; color: rgba(255,255,255,.75); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hero .amount { font-family: var(--font-display); font-size: clamp(32px, 9vw, 44px); font-weight: 600; letter-spacing: -.035em; margin: 4px 0 2px; line-height: 1.1; }
.hero .amount small { font-size: .5em; font-weight: 500; opacity: .8; margin-right: 4px; letter-spacing: 0; }
.hero .meta { font-size: 12px; color: rgba(255,255,255,.65); }
.hero-split { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.hero-chip { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 10px 12px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-align: left; color: #fff; }
.hero-chip .k { font-size: 11.5px; color: rgba(255,255,255,.72); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.hero-chip .v { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-top: 2px; letter-spacing: -.02em; }
.hero-chip .s { font-size: 11px; color: rgba(255,255,255,.6); }
.hero .eye { color: #fff; background: rgba(255,255,255,.14); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.hero > * { position: relative; z-index: 1; }

/* Chips de período */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; scroll-snap-align: start; height: 34px; padding: 0 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 6px; transition: all .2s var(--ease);
}
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
[data-theme="dark"] .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .count { font-size: 11px; background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 1px 6px; }
.chip.active .count { background: rgba(255,255,255,.2); color: inherit; }

/* Segmentado */
.seg { display: flex; background: var(--surface-3); border-radius: 14px; padding: 4px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; height: 36px; padding: 0 14px; border-radius: 11px; font-size: 13.5px; font-weight: 700; color: var(--text-2); white-space: nowrap; transition: all .25s var(--ease); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(10,27,77,.10); }
.tabs-scroll { margin: 0 -16px; padding: 0 16px; position: sticky; top: calc(var(--safe-top) + var(--header-h)); z-index: 20; padding-top: 4px; padding-bottom: 8px; background: linear-gradient(var(--bg) 70%, transparent); }

/* Pulse strip (receitas/despesas/resultado) */
.pulse { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.pulse > div { padding: 14px 12px; position: relative; }
.pulse > div + div::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.pulse .k { font-size: 11.5px; color: var(--text-3); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.pulse .v { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; white-space: nowrap; }
.pulse .d { font-size: 11px; margin-top: 2px; font-weight: 600; }
.bullet { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Grade de métricas */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { background: var(--surface); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow-1); }
.metric .k { font-size: 12px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.metric .v { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; }
.metric .s { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.metric .ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; }
.metric .ico svg { width: 16px; height: 16px; }

/* Listas */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.list.flat { box-shadow: none; border: 1px solid var(--line); }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; position: relative; width: 100%; text-align: left; transition: background .15s; }
.li + .li::before { content: ''; position: absolute; top: 0; left: 64px; right: 0; height: 1px; background: var(--line); }
button.li:active, a.li:active { background: var(--surface-2); }
.li .t { font-weight: 650; font-weight: 600; font-size: 14.5px; }
.li .s { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.li .amt { font-family: var(--font-display); font-weight: 600; font-size: 15px; text-align: right; white-space: nowrap; letter-spacing: -.01em; }
.li .amt small { display: block; font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.li-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.li-ico svg { width: 19px; height: 19px; }
.li-ico img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.group-label { font-size: 12px; font-weight: 700; color: var(--text-3); margin: 16px 4px 8px; display: flex; justify-content: space-between; }

/* Status */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.received, .pill.paid, .pill.released, .pill.ok, .pill.active, .pill.connected { color: var(--income); background: var(--income-soft); }
.pill.expected, .pill.pending, .pill.paused, .pill.running { color: var(--pending); background: var(--pending-soft); }
.pill.overdue, .pill.error, .pill.expired, .pill.cancelled-sale { color: var(--expense); background: var(--expense-soft); }
.pill.cancelled, .pill.unknown, .pill.revoked, .pill.closed { color: var(--text-3); background: var(--surface-3); }
.pill.projected, .pill.partial { color: var(--projected); background: var(--projected-soft); }
.pill.soon { color: var(--accent); background: var(--accent-soft); }

/* Botões */
.btn {
  height: 48px; padding: 0 20px; border-radius: 15px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease), opacity .2s, background .2s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--brand-electric), var(--brand-ocean)); box-shadow: 0 8px 20px rgba(30,107,255,.28); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); }
.btn.danger { background: var(--expense-soft); color: var(--expense); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { color: var(--accent); font-weight: 700; font-size: 13.5px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 14px; font-size: 16px; outline: none;
  transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238592AD' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field.error .input { border-color: var(--expense); }
.field .err { color: var(--expense); font-size: 12px; font-weight: 600; }
.field .hint { color: var(--text-3); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amount-input {
  border: 0; background: transparent; text-align: center; width: 100%; font-family: var(--font-display); font-size: 40px; font-weight: 600;
  letter-spacing: -.03em; outline: none; padding: 6px 0; color: var(--text);
}
.amount-wrap { background: var(--surface-2); border-radius: 20px; padding: 14px 10px 10px; text-align: center; }
.amount-wrap .label { display: block; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 30px; transition: .25s var(--ease); }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: .25s var(--ease-out); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { height: 36px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.choice.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.choice .bullet { width: 9px; height: 9px; }
details.more { border-top: 1px dashed var(--line-2); padding-top: 10px; }
details.more summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--accent); font-size: 14px; padding: 4px 0; display: flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary svg { transform: rotate(180deg); }
.status-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-toggle button { height: 44px; border-radius: 13px; border: 1px solid var(--line-2); font-weight: 700; font-size: 14px; color: var(--text-2); background: var(--surface); }
.status-toggle button.active { border-color: transparent; background: var(--accent-soft); color: var(--accent); }

/* Sheet (bottom sheet no celular, modal no desktop) */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,11,31,.42); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); opacity: 0; transition: opacity .28s var(--ease); }
.overlay.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; background: var(--surface); border-radius: 26px 26px 0 0; max-height: calc(100dvh - var(--safe-top) - 24px);
  display: flex; flex-direction: column; transform: translateY(104%); transition: transform .38s var(--ease-out); box-shadow: var(--shadow-2);
}
.sheet.show { transform: translateY(0); }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px 8px; flex-shrink: 0; }
.sheet-head h3 { margin: 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.02em; flex: 1; }
.sheet-body { padding: 6px 18px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); display: flex; gap: 10px; flex-shrink: 0; background: var(--surface); }
.sheet-foot .btn { flex: 1; }

/* Ações rápidas */
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 6px 0 4px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px 14px; border-radius: 18px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--text); text-align: center; transition: transform .2s var(--ease-out); }
.quick:active { transform: scale(.96); }
.quick .qi { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; }
.quick .qi svg { width: 22px; height: 22px; }
.sheet.show .quick { animation: popIn .4s var(--ease-out) both; }
.sheet.show .quick:nth-child(2) { animation-delay: .03s; } .sheet.show .quick:nth-child(3) { animation-delay: .06s; }
.sheet.show .quick:nth-child(4) { animation-delay: .09s; } .sheet.show .quick:nth-child(5) { animation-delay: .12s; } .sheet.show .quick:nth-child(6) { animation-delay: .15s; }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

/* Toast */
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 10px); z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-2); display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px); animation: toastIn .35s var(--ease-out); }
.toast.error { background: var(--expense); color: #fff; }
.toast .act { color: var(--brand-turquoise); font-weight: 800; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Skeleton */
.sk { background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Vazio */
.empty { text-align: center; padding: 34px 20px; color: var(--text-2); }
.empty .art { width: 120px; margin: 0 auto 12px; opacity: .9; }
.empty h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text); }
.empty p { margin: 0 auto 14px; max-width: 320px; font-size: 13.5px; }

/* Insights */
.insights { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x mandatory; }
.insights::-webkit-scrollbar { display: none; }
.insight { scroll-snap-align: start; flex: 0 0 min(82%, 320px); background: var(--surface); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-1); display: flex; gap: 12px; text-align: left; }
.insight .ii { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.insight .ii svg { width: 18px; height: 18px; }
.insight .t { font-size: 12px; font-weight: 800; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.insight .x { font-size: 14px; line-height: 1.4; margin-top: 2px; font-weight: 500; }
.tone-positive .ii { background: var(--income-soft); color: var(--income); }
.tone-warning .ii { background: var(--expense-soft); color: var(--expense); }
.tone-neutral .ii { background: var(--accent-soft); color: var(--accent); }

/* Timeline (próximos) */
.timeline { position: relative; }
.tl-day { display: grid; grid-template-columns: 48px 1fr; gap: 10px; }
.tl-date { text-align: center; padding-top: 12px; }
.tl-date .d { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1; }
.tl-date .m { font-size: 11px; color: var(--text-3); font-weight: 700; text-transform: uppercase; }
.tl-date.today .d { color: var(--accent); }

/* Assinaturas */
.subs-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sub-card { background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-1); text-align: left; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
.sub-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 64px; background: linear-gradient(180deg, color-mix(in srgb, var(--svc) 14%, transparent), transparent); pointer-events: none; }
.sub-card.inactive { opacity: .62; }
.sub-card .name { font-weight: 800; font-size: 14.5px; }
.sub-card .plan { font-size: 12px; color: var(--text-3); }
.sub-card .price { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -.02em; margin-top: auto; }
.sub-card .price small { font-family: var(--font-ui); font-size: 12px; color: var(--text-3); font-weight: 600; }
.sub-card .due { font-size: 12px; color: var(--text-2); font-weight: 600; }
.svc { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 17px; position: relative; overflow: hidden; flex-shrink: 0; background: var(--svc, var(--accent)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.svc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 7px; }
.svc.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.svc.xs { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.svc.xs img { padding: 4px; }
.svc-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.svc-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; font-size: 11.5px; font-weight: 700; text-align: center; color: var(--text-2); }
.svc-pick:active, .svc-pick.active { background: var(--accent-soft); color: var(--accent); }

/* Vendas */
.sale { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.sale + .sale { margin-top: 10px; }
.sale-main { display: flex; gap: 12px; padding: 14px; align-items: center; width: 100%; text-align: left; }
.thumb { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-3); flex-shrink: 0; overflow: hidden; display: grid; place-items: center; color: var(--text-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.sale .t { font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sale .s { font-size: 12px; color: var(--text-3); margin-top: 3px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sale .net { font-family: var(--font-display); font-weight: 600; font-size: 16px; text-align: right; white-space: nowrap; }
.sale .gross { font-size: 12px; color: var(--text-3); text-align: right; text-decoration: none; }
.composition { padding: 0 14px 14px; display: none; }
.sale.open .composition { display: block; animation: pageIn .3s var(--ease-out); }
.sale .chev { transition: transform .25s var(--ease); color: var(--text-3); }
.sale.open .chev { transform: rotate(180deg); }
.comp-box { background: var(--surface-2); border-radius: 16px; padding: 14px; }
.comp-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13.5px; }
.comp-row .num { font-weight: 600; }
.comp-row.total { border-top: 1px dashed var(--line-2); margin-top: 4px; padding-top: 10px; font-weight: 800; }
.comp-src { font-size: 11.5px; color: var(--text-3); margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; }
.comp-src svg { width: 14px; height: 14px; margin-top: 1px; }
.listing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.listing { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.listing .img { aspect-ratio: 1; background: var(--surface-3); position: relative; display: grid; place-items: center; color: var(--text-3); }
.listing .img img { width: 100%; height: 100%; object-fit: cover; }
.listing .img .pill { position: absolute; top: 8px; left: 8px; background: var(--glass); backdrop-filter: blur(6px); }
.listing .b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.listing .t { font-size: 13px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing .p { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-top: auto; }
.listing .m { font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; }
.rank { display: grid; grid-template-columns: 26px 44px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.rank + .rank { border-top: 1px solid var(--line); }
.rank .pos { font-family: var(--font-display); font-weight: 700; color: var(--text-3); text-align: center; }
.rank .bar { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.rank .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-capri), var(--brand-electric)); }

/* Calendário */
.cal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 14px 10px 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.cal-head .m { font-family: var(--font-display); font-weight: 600; font-size: 17px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--text-3); padding: 4px 0 6px; }
.cal-day { aspect-ratio: 1 / 1.08; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 7px; gap: 4px; font-weight: 600; font-size: 14px; position: relative; }
.cal-day.out { color: var(--text-3); opacity: .45; }
.cal-day.today { color: var(--accent); }
.cal-day.today::after { content: ''; position: absolute; inset: 3px; border-radius: 11px; border: 1.5px solid var(--accent); opacity: .35; }
.cal-day.sel { background: var(--text); color: var(--surface); }
[data-theme="dark"] .cal-day.sel { background: var(--accent); color: #fff; }
.cal-dots { display: flex; gap: 3px; height: 6px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; color: var(--text-2); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Gráficos */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font-ui); font-size: 10.5px; fill: var(--text-3); font-weight: 600; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 7px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .15s; z-index: 5; }
.chart-tip.show { opacity: 1; }
.chart-wrap { position: relative; }
.donut-wrap { display: grid; grid-template-columns: 140px 1fr; gap: 16px; align-items: center; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.donut-legend .row { font-size: 13px; gap: 8px; }
.donut-legend .row .grow { color: var(--text-2); font-weight: 600; }
.donut-legend .row .num { font-weight: 600; font-size: 13px; }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 6px 0; }
.hbar .track { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: inherit; }

/* Fluxo de caixa */
.proj-card .big { font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.03em; }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; background: var(--projected-soft); color: var(--text-2); border-radius: 14px; padding: 12px 14px; font-size: 12.5px; }
.disclaimer svg { color: var(--projected); width: 18px; height: 18px; margin-top: 1px; }
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-size: 13px; background: var(--info-soft); color: var(--text-2); }
.notice.warn { background: var(--pending-soft); }
.notice.err { background: var(--expense-soft); }
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--accent); }
.notice.warn svg { color: var(--pending); } .notice.err svg { color: var(--expense); }

/* Mais */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 16px 10px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; text-align: center; color: var(--text); }
.tile .ti { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; }
.tile .ti svg { width: 21px; height: 21px; }
.profile-card { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: #fff; background: linear-gradient(135deg, var(--brand-capri), var(--brand-ocean)); }

/* Integrações */
.integ { display: flex; gap: 14px; align-items: flex-start; }
.integ .logo { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; flex-shrink: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-3); font-weight: 600; } .kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }
code.inline { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* Busca global */
.search-panel { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; opacity: 0; transform: translateY(8px); transition: all .25s var(--ease-out); pointer-events: none; }
.search-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.search-bar { display: flex; gap: 10px; align-items: center; padding: calc(var(--safe-top) + 12px) 16px 12px; }
.search-input { flex: 1; height: 46px; border-radius: 14px; border: 0; background: var(--surface); box-shadow: var(--shadow-1); padding: 0 14px 0 42px; font-size: 16px; outline: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238592AD' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M17 17l-4.5-4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
.search-results { flex: 1; overflow-y: auto; padding: 0 16px 40px; }

/* Tutorial */
.tour-layer { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.tour-hole { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(5,11,31,.62); transition: all .45s var(--ease-out); pointer-events: none; }
.tour-hole::after { content: ''; position: absolute; inset: -4px; border-radius: 22px; border: 2px solid var(--brand-turquoise); opacity: .9; animation: tourPulse 1.8s ease-in-out infinite; }
@keyframes tourPulse { 50% { inset: -8px; opacity: .3; } }
.tour-card { position: fixed; pointer-events: auto; width: min(340px, calc(100vw - 28px)); background: var(--surface); color: var(--text); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-2); transition: top .45s var(--ease-out), left .45s var(--ease-out), opacity .3s; }
.tour-card .step { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; }
.tour-card h4 { margin: 4px 0 6px; font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.tour-card p { margin: 0 0 14px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.tour-progress { display: flex; gap: 4px; margin-bottom: 12px; }
.tour-progress i { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.tour-progress i.on { background: linear-gradient(90deg, var(--brand-capri), var(--brand-electric)); }
.tour-dim { position: fixed; inset: 0; background: rgba(5,11,31,.62); pointer-events: auto; }
.help-item { border-bottom: 1px solid var(--line); }
.help-item summary { list-style: none; padding: 15px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 14.5px; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item .body { padding: 0 16px 16px 66px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.help-item .body ol, .help-item .body ul { padding-left: 18px; margin: 6px 0; }
.help-item[open] summary .chev { transform: rotate(180deg); }
.help-item:last-child { border-bottom: 0; }

/* Autenticação */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); background: radial-gradient(900px 600px at 50% -10%, #12338F 0%, var(--brand-navy) 60%); color: #fff; }
.auth-box { width: 100%; max-width: 400px; }
.auth-logo { width: 220px; margin: 0 auto 28px; }
.auth-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); border-radius: 26px; padding: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.auth-card h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; }
.auth-card p { margin: 0 0 18px; color: rgba(255,255,255,.65); font-size: 14px; }
.auth .input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; }
.auth .input::placeholder { color: rgba(255,255,255,.4); }
.auth .input:focus { border-color: var(--brand-turquoise); box-shadow: 0 0 0 4px rgba(39,227,242,.15); }
.auth .field > label { color: rgba(255,255,255,.75); }
.auth .switch-link { text-align: center; margin-top: 18px; font-size: 14px; color: rgba(255,255,255,.7); }
.auth .switch-link a { color: var(--brand-turquoise); font-weight: 700; }
.auth .tagline { text-align: center; margin-top: 26px; font-size: 12px; letter-spacing: .2em; color: rgba(255,255,255,.45); text-transform: uppercase; }

/* ---------- Desktop ---------- */
@media (min-width: 640px) {
  .subs-grid { grid-template-columns: repeat(3, 1fr); }
  .listing-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .svc-picker { grid-template-columns: repeat(6, 1fr); }
  .sheet { left: 50%; right: auto; bottom: 50%; width: min(560px, calc(100vw - 40px)); border-radius: 26px; transform: translate(-50%, 54%) scale(.98); opacity: 0; transition: transform .35s var(--ease-out), opacity .25s; max-height: min(86dvh, 820px); }
  .sheet.show { transform: translate(-50%, 50%); opacity: 1; }
  .sheet .grabber { display: none; }
}
@media (min-width: 1024px) {
  :root { --header-h: 68px; }
  .app-header { padding: 12px 28px; }
  .app-header .brand-mark { display: none; }
  .app-header .brand-full { display: block; }
  .app-header .title-wrap { display: none; }
  .desk-nav { display: flex; gap: 4px; margin-left: 28px; background: var(--surface); padding: 4px; border-radius: 14px; box-shadow: var(--shadow-1); }
  .desk-nav a { height: 38px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--text-2); }
  .desk-nav a svg { width: 18px; height: 18px; }
  .desk-nav a.active { background: var(--accent-soft); color: var(--accent); }
  .desk-add { display: inline-flex; }
  .tabbar { display: none; }
  main.page { padding: 20px 28px 60px; }
  .tabs-scroll { top: var(--header-h); }
  .home-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
  .home-grid .section:first-child { margin-top: 0; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .subs-grid { grid-template-columns: repeat(4, 1fr); }
  .listing-grid { grid-template-columns: repeat(5, 1fr); }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .insights { flex-direction: column; margin: 0; padding: 0; overflow: visible; }
  .insight { flex: none; }
  .split-desk { display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start; }
}
@media (max-width: 380px) {
  .pulse .v { font-size: 14px; }
  .hero .amount { font-size: 30px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print { .tabbar, .app-header { display: none; } }

/* Composição do Início: no celular segue a ordem definida (order); no desktop, duas colunas */
.home-flow { display: flex; flex-direction: column; }
.home-col { display: contents; }
.home-flow > .section:first-child { margin-top: 18px; }
@media (min-width: 1024px) {
  .home-flow { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 22px; align-items: start; margin-top: 14px; }
  .home-col { display: block; }
  .home-col > .hero { margin-top: 8px; }
  .home-col > .section:first-child { margin-top: 8px; }
  .home-flow > .section:first-child { grid-column: 1 / -1; margin-top: 8px; margin-bottom: 8px; }
}
.sale.inactive { opacity: .6; }
.sale-main { color: inherit; }
a.li, a.insight, a.hero-chip, a.tile { color: inherit; }
.li .t { font-weight: 600; }
.header-actions .desk-add { display: none; }
.app-header .title-wrap { min-width: 0; flex: 1; }
.app-header .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
@media (min-width: 1024px) { .header-actions .desk-add { display: inline-flex; } }

main.page { overflow-x: clip; }
.proj-card .big { font-size: clamp(22px, 6.4vw, 28px); }
.proj-head { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; }
.kv.compact { grid-template-columns: auto 1fr auto 1fr; gap: 4px 10px; }
.kv.compact dd { white-space: nowrap; word-break: normal; }
@media (max-width: 420px) { .kv.compact { grid-template-columns: auto 1fr; } }
.arrow-hint { text-align: center; color: var(--accent); animation: bob 1.4s ease-in-out infinite; margin-top: 4px; }
@keyframes bob { 50% { transform: translateY(6px); } }
.install-chip { display: flex; align-items: center; gap: 12px; }
