/* ============================================================
   Quitado — tokens
   Um significado por cor: índigo = ação/seleção · verde = pago ·
   âmbar = pendente · vermelho = atrasado/destrutivo.
   ============================================================ */
:root {
  color-scheme: light dark;

  --bg: oklch(0.973 0.007 85);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.953 0.008 85);
  --surface-3: oklch(0.925 0.01 85);
  --ink: oklch(0.22 0.02 265);
  --ink-2: oklch(0.43 0.02 265);
  --ink-3: oklch(0.52 0.015 265);
  --line: oklch(0.22 0.02 265 / 0.1);
  --line-strong: oklch(0.22 0.02 265 / 0.22);

  --accent: oklch(0.5 0.19 270);
  --accent-hover: oklch(0.45 0.19 270);
  --on-accent: oklch(0.99 0.005 270);
  --accent-soft: oklch(0.94 0.035 270);

  --paid: oklch(0.45 0.115 155);
  --paid-bg: oklch(0.94 0.045 155);
  --paid-solid: oklch(0.56 0.14 155);
  --pending: oklch(0.47 0.1 70);
  --pending-bg: oklch(0.95 0.055 85);
  --pending-solid: oklch(0.8 0.13 80);
  --late: oklch(0.5 0.18 27);
  --late-bg: oklch(0.95 0.035 27);
  --danger: oklch(0.52 0.19 27);
  --on-danger: oklch(0.99 0.005 27);

  --shadow-card: 0 0 0 1px oklch(0.22 0.02 265 / 0.06), 0 1px 2px oklch(0.22 0.02 265 / 0.05), 0 10px 28px -14px oklch(0.22 0.02 265 / 0.14);
  --shadow-pop: 0 0 0 1px oklch(0.22 0.02 265 / 0.08), 0 4px 10px oklch(0.22 0.02 265 / 0.08), 0 24px 48px -16px oklch(0.22 0.02 265 / 0.28);
  --img-outline: oklch(0 0 0 / 0.1);

  --font-ui: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;

  --r-card: 24px;
  --r-ctl: 12px;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

:root[data-theme='dark'] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: oklch(0.185 0.014 265);
    --surface: oklch(0.23 0.016 265);
    --surface-2: oklch(0.27 0.017 265);
    --surface-3: oklch(0.32 0.018 265);
    --ink: oklch(0.95 0.006 265);
    --ink-2: oklch(0.8 0.01 265);
    --ink-3: oklch(0.7 0.012 265);
    --line: oklch(1 0 0 / 0.1);
    --line-strong: oklch(1 0 0 / 0.24);
    --accent: oklch(0.74 0.14 270);
    --accent-hover: oklch(0.8 0.12 270);
    --on-accent: oklch(0.2 0.04 270);
    --accent-soft: oklch(0.32 0.07 270);
    --paid: oklch(0.82 0.14 155);
    --paid-bg: oklch(0.31 0.06 155);
    --paid-solid: oklch(0.72 0.16 155);
    --pending: oklch(0.84 0.12 85);
    --pending-bg: oklch(0.33 0.06 80);
    --pending-solid: oklch(0.78 0.13 82);
    --late: oklch(0.8 0.13 27);
    --late-bg: oklch(0.32 0.075 27);
    --danger: oklch(0.72 0.16 27);
    --on-danger: oklch(0.18 0.04 27);
    --shadow-card: 0 0 0 1px oklch(1 0 0 / 0.07), 0 10px 28px -14px oklch(0 0 0 / 0.5);
    --shadow-pop: 0 0 0 1px oklch(1 0 0 / 0.1), 0 24px 48px -16px oklch(0 0 0 / 0.7);
    --img-outline: oklch(1 0 0 / 0.1);
  }
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button, a, select, summary, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior-y: none; }
a { color: inherit; }
svg.icon { flex: none; display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; inset-inline-start: 12px; top: -80px; z-index: 100; padding: 10px 16px;
  background: var(--ink); color: var(--bg); border-radius: var(--r-ctl); text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }
.boot { padding: 48px var(--gutter); color: var(--ink-3); text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.amt, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.spacer { flex: 1; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ============================================================ botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-ctl);
  font-weight: 600; font-size: 15px; line-height: 1; text-decoration: none; white-space: nowrap;
  transition-property: background-color, color, box-shadow, transform; transition-duration: 140ms; transition-timing-function: var(--ease);
  position: relative;
}
.btn:active { transform: scale(0.96); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px oklch(0.2 0.1 270 / 0.3), inset 0 1px 0 oklch(1 0 0 / 0.14); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-quiet-danger { background: transparent; color: var(--danger); padding-inline: 12px; }
@media (hover: hover) {
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-ghost:hover { background: var(--surface-2); }
  .btn-quiet-danger:hover { background: var(--late-bg); }
  .btn-danger:hover { filter: brightness(0.94); }
}
.btn[aria-disabled='true'] { pointer-events: none; opacity: 0.8; }
.btn[aria-disabled='true']::after {
  content: ''; width: 16px; height: 16px; border-radius: 50%; margin-inline-start: 2px;
  border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--ink-2);
  transition-property: background-color, color, transform; transition-duration: 140ms; transition-timing-function: var(--ease);
}
.icon-btn:active { transform: scale(0.96); }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); color: var(--ink); } }

.link {
  background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: from-font; cursor: pointer;
}

/* ============================================================ formulários */
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .label { font-size: 14px; font-weight: 600; color: var(--ink); }
.optional { font-weight: 400; color: var(--ink-3); }
input:not([type='radio'], [type='checkbox']), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: var(--r-ctl);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow 140ms var(--ease); font-size: 16px; line-height: 1.4;
}
textarea { resize: vertical; min-height: 72px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:not([type='radio'], [type='checkbox']):focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 0; box-shadow: inset 0 0 0 1px var(--accent);
}
[aria-invalid='true'] { box-shadow: inset 0 0 0 1.5px var(--danger) !important; }
select { appearance: none; padding-inline-end: 38px; cursor: pointer;
  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='%23888' 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 12px center; }
.select-sm { width: auto; min-height: 40px; padding-block: 6px; font-size: 14px; }
.hint { font-size: 13px; color: var(--ink-2); }
.err { font-size: 13px; font-weight: 500; color: var(--danger); }
.form-err { padding: 10px 12px; border-radius: var(--r-ctl); background: var(--late-bg); }
.stack-form { display: grid; gap: 18px; }
.plain { border: 0; min-width: 0; display: grid; gap: 18px; }
legend.label { padding: 0; margin-bottom: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-affix { position: relative; }
.input-affix > span { position: absolute; inset-block: 0; inset-inline-start: 14px; display: grid; place-items: center; color: var(--ink-3); font-weight: 600; pointer-events: none; }
.input-affix input { padding-inline-start: 42px; font-variant-numeric: tabular-nums; }
input[type='date'] { font-variant-numeric: tabular-nums; }

.radio-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.radio-seg label { position: relative; display: block; font-weight: 600; font-size: 15px; }
.radio-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radio-seg span { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border-radius: 12px; color: var(--ink-2); transition: background-color 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease); }
.radio-seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 265 / 0.12), 0 0 0 1px var(--line); }
.radio-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.radio-seg i { font-style: normal; }

.check-row, .choice { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; padding: 10px 0; }
.check-row input, .choice input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.choice-list { border: 0; display: grid; gap: 2px; margin-block: 4px; }
.series-note { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.seg-btn { border: 0; min-height: 40px; border-radius: 12px; background: transparent; color: var(--ink-2); font-weight: 600; transition: background-color 140ms var(--ease), color 140ms var(--ease); }
.seg-btn[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 265 / 0.12), 0 0 0 1px var(--line); }

/* ============================================================ avatares */
.avatar {
  --h: 270; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
  font-weight: 700; font-size: 14px; background: oklch(0.9 0.07 var(--h)); color: oklch(0.36 0.11 var(--h));
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; box-shadow: 0 0 0 2px var(--bg); }
.av-0 { --h: 270; } .av-1 { --h: 25; } .av-2 { --h: 70; } .av-3 { --h: 150; }
.av-4 { --h: 200; } .av-5 { --h: 245; } .av-6 { --h: 310; } .av-7 { --h: 350; }
.avatar-pending { background: var(--surface-2); color: var(--ink-2); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-inline-start: -8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .avatar { background: oklch(0.38 0.08 var(--h)); color: oklch(0.92 0.06 var(--h)); }
  :root:not([data-theme='light']) .avatar-pending { background: var(--surface-2); color: var(--ink-2); }
}

/* ============================================================ status */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.pill-paid { background: var(--paid-bg); color: var(--paid); }
.pill-pending { background: var(--pending-bg); color: var(--pending); }
.pill-overdue { background: var(--late-bg); color: var(--late); }
.tag { margin-inline-start: 8px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; vertical-align: 1px; }
.count { min-width: 24px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.count-late { background: var(--late-bg); color: var(--late); }

.check-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; padding: 0;
  border: 0; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent; position: relative;
  transition-property: background-color, box-shadow, color, transform; transition-duration: 160ms; transition-timing-function: var(--ease);
}
.check-btn::before { content: ''; position: absolute; inset: -8px; } /* área de toque de 44px */
.check-btn:active { transform: scale(0.92); }
.check-btn.is-paid { background: var(--paid-solid); box-shadow: none; color: oklch(0.99 0 0); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .check-btn.is-paid { color: oklch(0.2 0.05 155); } }
@media (hover: hover) {
  .check-btn:not(.is-paid, :disabled):hover { box-shadow: inset 0 0 0 1.5px var(--paid-solid); color: var(--paid-solid); }
}
.check-btn:disabled { cursor: not-allowed; opacity: 0.6; }

/* ============================================================ layout do app */
.shell { display: block; min-height: 100dvh; }
.side {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px; background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.side-nav, .side-foot { display: none; }
#page { padding: 8px var(--gutter) calc(112px + env(safe-area-inset-bottom)); outline: 0; max-width: 1160px; }
#page:focus-visible, h1:focus-visible { outline: none; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-size: 26px; line-height: 1; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: radial-gradient(120% 90% at 25% 10%, oklch(1 0 0 / 0.28), transparent 60%), linear-gradient(145deg, #7a70f5, #3a2fb4); box-shadow: 0 1px 2px oklch(0.2 0.1 270 / 0.35); }
.brand-compact { display: none; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -1px 0 var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { display: grid; grid-template-columns: repeat(4, 1fr); }
.tab-link { display: grid; justify-items: center; gap: 2px; padding: 8px 4px 8px; min-height: 56px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.tab-link[aria-current='page'] { color: var(--accent); }
.tab-link[aria-current='page'] svg { stroke-width: 2; }

.switcher { position: relative; min-width: 0; flex: 1; max-width: 260px; }
.switcher-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 4px 8px 4px 12px;
  background: var(--surface); border: 0; border-radius: 14px; text-align: start; box-shadow: var(--shadow-card);
}
.switcher-text { display: grid; min-width: 0; line-height: 1.2; }
.switcher-text small { font-size: 11px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.switcher-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-btn[aria-expanded='true'] svg { transform: rotate(180deg); }
.switcher-btn svg { transition: transform 160ms var(--ease); color: var(--ink-3); }
.menu {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; padding: 6px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow-pop);
}
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 6px 10px 6px 6px; border: 0; background: transparent; border-radius: 12px; text-align: start; }
.menu-check { display: grid; place-items: center; width: 24px; color: var(--accent); flex: none; }
.menu-label { display: grid; line-height: 1.25; font-weight: 600; min-width: 0; }
.menu-label small { font-weight: 400; color: var(--ink-3); font-size: 13px; }
.menu-add { color: var(--ink-2); margin-top: 2px; box-shadow: 0 -1px 0 var(--line); border-radius: 0 0 12px 12px; }
@media (hover: hover) { .menu-item:hover { background: var(--surface-2); } }

.toasts { position: fixed; z-index: 90; inset-inline: var(--gutter); bottom: calc(76px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 460px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop);
}
.toast-error { background: var(--danger); color: var(--on-danger); }
.toast-close { display: grid; place-items: center; width: 32px; height: 32px; margin: -6px -8px -6px 0; border: 0; border-radius: 8px; background: transparent; color: inherit; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 220ms var(--ease); }
  @keyframes toast-in { from { opacity: 0; translate: 0 8px; } }
}

.add-btn { box-shadow: var(--shadow-pop); }
.page-tools .add-btn {
  position: fixed; z-index: 25; inset-inline-end: var(--gutter); bottom: calc(72px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; padding: 0; border-radius: 18px;
}
.add-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.month-nav { width: 100%; justify-content: space-between; }
.hero-stats > div:last-child { grid-column: 1 / -1; }
.hero-stats { grid-template-columns: 1fr 1fr; }

/* ============================================================ cabeçalho de página */
.page-head { display: grid; gap: 14px; padding: 12px 0 20px; }
.page-title h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.05; letter-spacing: -0.015em; }
.page-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }
.ws-name { font-weight: 600; }
.ws-name::after { content: '·'; margin-inline-start: 8px; color: var(--ink-3); font-weight: 400; }
.page-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-nav { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-card); }
.month-label { min-width: 148px; text-align: center; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }

/* ============================================================ painéis */
.panel { background: var(--surface); border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-card); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .split-text h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.005em; }
.subhead { font-size: 15px; font-weight: 650; margin: 20px 0 8px; }
.banner { padding: 12px 16px; border-radius: var(--r-ctl); background: var(--accent-soft); font-size: 14px; margin-bottom: 14px; }
.banner-error { background: var(--late-bg); color: var(--late); }
.banner-error .link { color: inherit; }
.stack-sections { display: grid; gap: 16px; max-width: 760px; }

.grid-painel { display: grid; gap: 16px; }

.hero { padding: 24px 20px; display: grid; gap: 0; }
.hero-label { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.ok-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--paid-solid); color: oklch(0.99 0 0); }
.ok-mark.big { width: 40px; height: 40px; flex: none; }
.hero-number { font-family: var(--font-display); font-size: clamp(48px, 13vw, 72px); line-height: 1.05; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-cur { font-size: 0.45em; margin-inline-end: 0.22em; color: var(--ink-3); letter-spacing: 0; vertical-align: 0.5em; }
.hero-sub { color: var(--ink-2); font-size: 15px; margin-top: 6px; }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); margin-top: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--w, 0%); border-radius: 999px; background: var(--paid-solid); }
.progress-label { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.hero-stats { display: grid; gap: 16px; margin-top: 24px; padding-top: 20px; box-shadow: 0 -1px 0 var(--line); }
.hero-stats dt { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.hero-stats dd { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hero-stats dd.sub { font-size: 13px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-top: 0; }
.hero-stats dd.neg { color: var(--late); }
.hero-empty { padding: 8px; }

.skeleton { min-height: 280px; display: grid; gap: 14px; align-content: start; }
.skeleton i, .skeleton-list i { display: block; height: 20px; border-radius: 8px; background: var(--surface-2); }
.skeleton i:nth-child(1) { width: 40%; } .skeleton i:nth-child(2) { height: 64px; width: 70%; } .skeleton i:nth-child(3) { width: 100%; height: 10px; }
.skeleton-list { display: grid; gap: 10px; }
.skeleton-list i { height: 64px; border-radius: var(--r-ctl); }

.mini-list { display: grid; }
.mini-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; }
.mini-row + .mini-row { box-shadow: 0 -1px 0 var(--line); }
.mini-main { display: grid; gap: 1px; min-width: 0; border: 0; background: none; padding: 4px 0; text-align: start; border-radius: 8px; }
.mini-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.mini-main small.late { color: var(--late); font-weight: 600; }
.mini-row .amt { font-weight: 600; font-size: 15px; }
.more { display: inline-block; margin-top: 10px; font-size: 14px; }
.calm { display: flex; gap: 14px; align-items: center; padding: 8px 0; }
.calm p { font-size: 14px; }

.bars { display: grid; gap: 14px; }
.bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.bar-top .amt { font-weight: 600; }
.bar-top small { color: var(--ink-3); font-weight: 400; margin-inline-start: 6px; font-size: 13px; }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-track > span { display: block; height: 100%; width: var(--w, 0%); border-radius: 999px; background: var(--accent); }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-paid, .seg-paid { background: var(--paid-solid); }
.sw-pending, .seg-pending { background: var(--pending-solid); }
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; padding-top: 4px; }
.col { position: relative; display: grid; justify-items: center; gap: 6px; padding: 0 2px; border-radius: 10px; }
.col-total { height: 18px; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack { width: min(100%, 44px); height: 140px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; box-shadow: 0 1px 0 var(--line-strong); }
.seg { display: block; width: 100%; height: calc(var(--h, 0) * 1%); min-height: 3px; }
.seg:first-child { border-radius: 4px 4px 0 0; }
.col-label { font-size: 13px; color: var(--ink-3); font-weight: 500; text-transform: capitalize; }
.col.is-current .col-label { color: var(--ink); font-weight: 700; }
.tip {
  position: absolute; z-index: 5; bottom: calc(100% - 20px); left: 50%; translate: -50% 0; display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 13px; white-space: nowrap; box-shadow: var(--shadow-pop); pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 120ms var(--ease);
}
.tip b { font-weight: 650; margin-bottom: 2px; }
.col:hover .tip, .col:focus-visible .tip { opacity: 1; visibility: visible; }
.col:first-child .tip { left: 0; translate: 0 0; }
.col:last-child .tip { left: auto; right: 0; translate: 0 0; }

/* ============================================================ lançamentos */
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; flex: none;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: 600; font-size: 14px; color: var(--ink-2);
  transition-property: background-color, color, box-shadow; transition-duration: 140ms; transition-timing-function: var(--ease);
}
.chip[aria-pressed='true'] { background: var(--ink); color: var(--bg); box-shadow: none; }
.chip-n { font-variant-numeric: tabular-nums; font-size: 13px; opacity: 0.75; }
.search { position: relative; }
.search > svg { position: absolute; inset-inline-start: 14px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search input { padding-inline-start: 42px; background: var(--surface); }

.tx-list { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); overflow: hidden; }
.tx-head { display: none; }
.tx-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: 'check main amt' 'check due status';
  gap: 2px 12px; align-items: center; padding: 12px 16px; cursor: pointer; transition: background-color 120ms var(--ease);
}
.tx-row + .tx-row { box-shadow: 0 -1px 0 var(--line); }
@media (hover: hover) { .tx-row:hover { background: var(--surface-2); } }
.c-check { grid-area: check; align-self: start; padding-top: 4px; }
.c-main { grid-area: main; display: grid; gap: 2px; min-width: 0; border: 0; background: none; padding: 2px 0; text-align: start; border-radius: 8px; }
.tx-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: block; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-due { grid-area: due; font-size: 13px; color: var(--ink-2); }
.c-amt { grid-area: amt; justify-self: end; font-weight: 650; font-size: 16px; }
.c-status { grid-area: status; justify-self: end; margin-top: 4px; }
.tx-row.paid .tx-name { color: var(--ink-2); }
.tx-row.overdue .c-due { color: var(--late); font-weight: 600; }
.list-foot { margin-top: 12px; padding-inline: 4px; font-size: 14px; color: var(--ink-2); }
.list-foot b { color: var(--ink); font-weight: 650; }
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 40px 20px; max-width: 420px; margin-inline: auto; }
.empty h3 { font-size: 18px; font-weight: 650; }
.empty .btn { margin-top: 14px; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 8px; }
.tx-list:has(.empty), .panel .empty { box-shadow: none; }

/* ============================================================ membros e conta */
.people { display: grid; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.person + .person { box-shadow: 0 -1px 0 var(--line); }
.person-text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.person-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.person-text small { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.role-text { font-size: 14px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.invite-form { display: grid; gap: 12px; margin-top: 14px; align-items: end; }
.role-help { display: grid; gap: 8px; margin-top: 18px; font-size: 14px; }
.role-help dt { font-weight: 650; display: inline; }
.role-help dd { display: inline; color: var(--ink-2); }
.role-help dd::before { content: ' — '; }
.danger-zone { padding: 8px 4px 0; display: grid; gap: 6px; justify-items: start; }
.danger-zone .subhead { margin: 0; }
.danger-zone .btn { margin-top: 8px; margin-inline-start: -12px; }
.split { display: grid; gap: 12px; }
.split-text { display: grid; gap: 4px; align-content: start; }
.split-text p { font-size: 14px; }
.row-actions { display: flex; gap: 8px; }
.row-actions.wrap { flex-wrap: wrap; }
.status-line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.is-dim { opacity: 0.55; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; display: block; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch .avatar { width: 40px; height: 40px; color: transparent; transition: box-shadow 140ms var(--ease); }
.swatch input:checked + .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); color: oklch(0.3 0.1 var(--h)); }
.swatch input:focus-visible + .avatar { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ============================================================ diálogos */
.dialog {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: none; max-height: min(92dvh, 860px); overflow: auto;
  border-radius: 24px 24px 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
  overscroll-behavior: contain;
}
.dialog::backdrop { background: oklch(0.15 0.02 265 / 0.5); backdrop-filter: blur(2px); }
.dialog-body { display: grid; gap: 18px; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin: -8px -8px -4px 0; }
.dialog-title { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.1; letter-spacing: -0.01em; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.tx-form .dialog-actions { position: sticky; bottom: -20px; margin: 0 -20px -20px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: 0 -1px 0 var(--line); }
@media (prefers-reduced-motion: no-preference) {
  .dialog { transition: opacity 200ms var(--ease), translate 200ms var(--ease), overlay 200ms allow-discrete, display 200ms allow-discrete; opacity: 1; translate: 0 0; }
  .dialog:not([open]) { opacity: 0; translate: 0 16px; }
  @starting-style { .dialog[open] { opacity: 0; translate: 0 16px; } }
  .dialog::backdrop { transition: opacity 200ms var(--ease), display 200ms allow-discrete, overlay 200ms allow-discrete; opacity: 1; }
  .dialog:not([open])::backdrop { opacity: 0; }
  @starting-style { .dialog[open]::backdrop { opacity: 0; } }
}

/* ============================================================ autenticação */
.auth { min-height: 100dvh; display: grid; }
.auth-hero { display: none; }
.auth-panel { display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) var(--gutter) 32px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.brand-compact { display: inline-flex; margin-bottom: 8px; }
.auth-title { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.1; letter-spacing: -0.015em; margin-top: 4px; }
.switch-hint { font-size: 14px; color: var(--ink-2); text-align: center; }
.fatal { padding: 64px var(--gutter); max-width: 460px; margin: auto; display: grid; gap: 12px; justify-items: start; }
.fatal h1 { font-family: var(--font-display); font-weight: 400; font-size: 32px; }
.sample { display: grid; gap: 4px; padding: 10px; border-radius: 22px; background: color-mix(in oklab, var(--surface) 75%, transparent); box-shadow: var(--shadow-card); max-width: 460px; }
.sample-row { display: grid; grid-template-columns: 24px 1fr auto auto; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; }
.sample-row + .sample-row { box-shadow: 0 -1px 0 var(--line); }
.sample-check { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.sample-check.paid { background: var(--paid-solid); box-shadow: none; color: oklch(0.99 0 0); }
.sample-main { display: grid; line-height: 1.25; }
.sample-main small { color: var(--ink-2); font-size: 13px; }
.sample-amt { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; }
.display { font-family: var(--font-display); font-weight: 400; font-size: clamp(48px, 6vw, 80px); line-height: 1; letter-spacing: -0.025em; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 30em; margin-top: 18px; }

/* ============================================================ responsivo (o conteúdo manda) */
@media (min-width: 560px) {
  .invite-form { grid-template-columns: 1fr auto auto; }
  .hero-stats { grid-template-columns: repeat(3, auto); justify-content: start; gap: 40px; }
  .dialog { margin: auto; width: min(100% - 32px, 540px); border-radius: 28px; }
  .dialog-sm { width: min(100% - 32px, 440px); }
  .dialog-body { padding: 28px; }
  .tx-form .dialog-actions { margin: 0 -28px -28px; padding: 16px 28px; bottom: -28px; }
  .toasts { inset-inline: auto 24px; bottom: 24px; justify-items: end; }
  .page-tools .add-btn { position: static; width: auto; height: auto; padding: 0 18px; border-radius: var(--r-ctl); box-shadow: var(--shadow-card); }
  .add-btn span { position: static; width: auto; height: auto; clip-path: none; overflow: visible; }
  .month-nav { width: auto; justify-content: flex-start; }
  .hero-stats > div:last-child { grid-column: auto; }
  #page { padding-inline: 24px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .page-head { grid-template-columns: 1fr auto; align-items: end; }
  .page-tools { justify-content: flex-end; }
  .toolbar { grid-template-columns: 1fr minmax(240px, 320px); align-items: center; }
  .auth-panel { padding-inline: 32px; }
}

@media (min-width: 720px) {
  .grid-painel { grid-template-columns: 1fr 1fr; align-items: start; }
  .hero, .panel-wide { grid-column: 1 / -1; }
  .hero { padding: 32px; }
  .split { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; }
  .stack-sections.account { max-width: 840px; }
  .tx-row {
    grid-template-columns: 28px minmax(0, 1fr) 120px 128px 156px; grid-template-areas: 'check main due amt status'; gap: 16px; padding: 14px 20px;
  }
  .c-check { align-self: center; padding-top: 0; }
  .c-due { font-size: 14px; }
  .c-status { margin-top: 0; justify-self: start; }
  .tx-head {
    display: grid; grid-template-columns: 28px minmax(0, 1fr) 120px 128px 156px; gap: 16px; padding: 12px 20px;
    font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; box-shadow: 0 1px 0 var(--line);
  }
  .tx-head .r { text-align: end; }
  .c-amt { justify-self: end; }
}

@media (min-width: 960px) {
  html { scroll-padding-top: 16px; scroll-padding-bottom: 16px; }
  .shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); }
  .side {
    position: sticky; top: 0; height: 100dvh; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 20px;
    padding: 28px 16px 20px 20px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .switcher { max-width: none; flex: none; }
  .side-nav { display: block; }
  .side-nav ul { display: grid; gap: 2px; }
  .nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 14px; text-decoration: none; font-weight: 600; color: var(--ink-2); transition: background-color 140ms var(--ease), color 140ms var(--ease); }
  .nav-link[aria-current='page'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
  .nav-link[aria-current='page'] svg { color: var(--accent); }
  @media (hover: hover) { .nav-link:not([aria-current='page']):hover { background: var(--surface-2); color: var(--ink); } }
  .side-foot { display: flex; align-items: center; gap: 4px; margin-top: auto; padding-top: 12px; box-shadow: 0 -1px 0 var(--line); }
  .user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 6px; border-radius: 14px; text-decoration: none; }
  .user-text { display: grid; min-width: 0; line-height: 1.25; }
  .user-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-text small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (hover: hover) { .user-chip:hover { background: var(--surface-2); } }
  .tabbar { display: none; }
  #page { padding: 28px 40px 64px; width: 100%; }
  .page-title h1 { font-size: 48px; }
  .auth { grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr); }
  .auth-hero {
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 56px;
    background: radial-gradient(120% 80% at 0% 0%, var(--accent-soft), transparent 60%), var(--surface-2);
  }
  .brand-compact { display: none; }
}

@media (min-width: 1200px) {
  .grid-painel { gap: 20px; }
}

@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
}

@media (forced-colors: active) {
  .check-btn.is-paid, .pill, .progress > span, .bar-track > span, .seg { forced-color-adjust: none; }
  .check-btn { border: 2px solid ButtonText; }
}

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

@media (max-width: 480px) {
  #push-section .field-row { grid-template-columns: 1fr; }
}
