*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273348;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-bg: #1e1b4b;
  --green: #22c55e;
  --green-bg: #052e16;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 16px;
  --nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html {
  background: var(--surface);
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: calc(24px + var(--safe-top)) 20px calc(var(--nav-h) + var(--safe-bottom) + 16px);
}
.screen.active { display: block; }

/* ─── Bottom Nav ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
}
.bottom-nav::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: 0;
  right: 0;
  height: 80px;
  background: var(--surface);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  color: var(--muted);
  transition: color .15s;
}
.nav-item.active { color: var(--accent-light); }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-label { font-size: 9px; font-weight: 600; letter-spacing: .3px; }

/* ─── Screen header ─── */
.screen-header {
  margin-bottom: 28px;
}
.screen-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.4px;
}
.screen-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Form ─── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.valor-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0 18px;
  transition: border-color .2s;
}
.valor-wrap:focus-within { border-color: var(--accent); }
.valor-prefix {
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 8px;
  flex-shrink: 0;
}
.valor-wrap input {
  flex: 1;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 18px 0 !important;
  outline: none;
  color: var(--text);
  caret-color: var(--accent);
  width: 100%;
}
#valor {
  font-size: 32px;
  font-weight: 800;
}
#valor::placeholder { color: var(--border); }
.valor-wrap input:not(#valor) {
  font-size: 20px;
  font-weight: 700;
}

select, input[type=date], input[type=text], input[type=number] {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .2s;
}
select:focus, input[type=date]:focus, input[type=text]:focus {
  border-color: var(--accent);
}
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 42px; }

/* ─── Cartão sub-select ─── */
#cartao-wrap {
  margin-top: 12px;
  display: none;
}
#cartao-wrap.visible { display: block; }

/* ─── Btn lançar ─── */
.btn-primary {
  width: 100%;
  padding: 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity .2s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: .2px;
}
.btn-primary:active { opacity: .85; transform: scale(.98); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
  max-width: calc(100vw - 40px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--red); }

/* ─── Dashboard ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin-bottom: 6px;
}
.card-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.card-value.green { color: var(--green); }
.card-value.red   { color: var(--red); }

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.month-nav span {
  font-size: 18px;
  font-weight: 800;
}
.month-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin: 24px 0 12px;
}

/* ─── Categoria bars ─── */
.cat-item { margin-bottom: 20px; }

/* ─── Simulador ─── */
.sim-divider {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 12px;
}
.sim-mes-section {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.sim-mes-atual {
  border-color: var(--accent);
}
.sim-mes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sim-mes-nome {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sim-badge-atual {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent-light);
  border-radius: 6px;
  padding: 2px 7px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.sim-mes-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--red);
}
.sim-mes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.sim-mini-card {
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px;
}
.sim-mini-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.sim-mini-val.red { color: var(--red); }
.sim-cats { padding-top: 4px; }
.sim-affected {
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 10px;
  margin: 0 -10px;
  background: var(--accent-bg);
}
.cat-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.cat-nome {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.cat-restante {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.4px;
}
.cat-gasto-solo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.cat-detalhe {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
.cat-detalhe span:last-child { font-weight: 600; }
.progress-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width .4s ease;
}
.progress-fill.over { background: var(--red); }
.progress-fill.warn { background: var(--yellow); }

/* ─── Lançamentos recentes ─── */
.lancamento-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.lancamento-item:last-child { border-bottom: none; }
.l-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.l-info { flex: 1; min-width: 0; }
.l-desc { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.l-valor { font-size: 15px; font-weight: 800; color: var(--red); flex-shrink: 0; }

/* ─── Config ─── */
.config-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.config-section-title {
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.config-row:last-child { border-bottom: none; }
.config-row-label { font-size: 15px; font-weight: 600; }
.config-row-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.btn-secondary {
  padding: 8px 16px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: none;
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--accent-bg); }

/* ─── Chip de status sync ─── */
.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: var(--green-bg);
  color: var(--green);
  margin-top: 8px;
}
.sync-chip.pending { background: #2d1a00; color: var(--yellow); }

/* ─── Empty state ─── */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty p { font-size: 14px; line-height: 1.6; }

/* ─── Bottom Sheet ─── */
.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.open { display: flex; }

.sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 430px;
  padding: 0 20px calc(var(--safe-bottom) + 24px);
  max-height: 90dvh;
  overflow-y: auto;
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 14px auto 20px;
}
.sheet h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 20px;
}
.sheet .form-group { margin-bottom: 16px; }
.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.sheet-actions .btn-primary { margin-top: 0; }
.btn-ghost {
  flex: 1;
  padding: 18px;
  background: var(--surface2);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Config lista ─── */
.cfg-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.cfg-list-item:last-child { border-bottom: none; }
.cfg-list-item:active { background: var(--surface2); }
.cfg-list-icon { font-size: 22px; flex-shrink: 0; }
.cfg-list-info { flex: 1; min-width: 0; }
.cfg-list-label { font-size: 15px; font-weight: 700; }
.cfg-list-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cfg-list-arrow { color: var(--muted); font-size: 16px; }

.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: none;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, color .15s;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent-light); }

.btn-danger {
  width: 100%;
  padding: 14px;
  background: none;
  border: 2px solid var(--red);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Preview parcela ─── */
.parcela-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-bg);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 12px;
}
.parcela-preview-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.parcela-preview-valor { font-size: 20px; font-weight: 800; color: var(--accent-light); }

/* ─── Badge tipo cartão ─── */
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.badge-fisico  { background: var(--surface2); color: var(--muted); }
.badge-virtual { background: var(--accent-bg); color: var(--accent-light); }

/* ─── Planejador ─── */
.plan-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.plan-header {
  display: grid;
  grid-template-columns: 1fr 70px 80px 70px;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
}

.plan-row {
  display: grid;
  grid-template-columns: 1fr 70px 80px 70px;
  gap: 6px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.plan-row:last-of-type { border-bottom: none; }

.plan-col-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.plan-cat-icon { font-size: 18px; flex-shrink: 0; }
.plan-cat-nome {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-col-num {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.plan-valor {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.plan-valor-comprometido { color: var(--yellow); }
.plan-valor-sugerido     { color: var(--green); }
.plan-valor-zero         { color: var(--border); }

.plan-warn {
  font-size: 10px;
  color: var(--yellow);
  opacity: .8;
}

.plan-parcs {
  padding: 0 14px 12px;
  border-bottom: 1px solid var(--border);
  margin-top: -8px;
}
.plan-parc-item {
  font-size: 11px;
  color: var(--muted);
  padding: 3px 0;
}

/* ─── Contas a pagar/receber ─── */
.contas-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}
.plan-contas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}
.btn-add-inline {
  background: none;
  border: 2px solid var(--accent);
  border-radius: 10px;
  color: var(--accent-light);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.plan-contas-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}
.plan-contas-grupo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.conta-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: opacity .2s;
}
.conta-item:last-child { border-bottom: none; }
.conta-item.conta-paga { opacity: .45; }

.conta-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s;
}
.conta-check.checked { background: var(--green); border-color: var(--green); }
.conta-check.receber.checked { background: var(--accent); border-color: var(--accent); }

.conta-info { flex: 1; min-width: 0; }
.conta-desc {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.conta-cat {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.conta-venc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.conta-valor { font-size: 14px; font-weight: 800; flex-shrink: 0; }
.conta-valor.red   { color: var(--red); }
.conta-valor.green { color: var(--green); }
.conta-edit {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 0 0 4px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Analytics ─── */
.analytics-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.analytics-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  margin-bottom: 12px;
}
.analytics-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}
.analytics-chart-wrap {
  position: relative;
  width: 100%;
  height: 200px;
}
.analytics-var-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.analytics-var-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.analytics-var-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analytics-var-table tr:last-child td { border-bottom: none; }
.var-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.var-pos-bom  { background: #052e16; color: #22c55e; }
.var-pos-ruim { background: #450a0a; color: #ef4444; }
.var-neg-bom  { background: #052e16; color: #22c55e; }
.var-neg-ruim { background: #450a0a; color: #ef4444; }
.analytics-bar-row {
  margin-bottom: 12px;
}
.analytics-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
  color: var(--text);
}
.analytics-bar-pct {
  font-size: 11px;
  color: var(--muted);
}
.analytics-bar-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 6px;
  overflow: hidden;
}
.analytics-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .4s;
}

@media (min-width: 430px) and (max-width: 767px) {
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* sidebar brand: hidden on mobile */
.sidebar-brand { display: none; }

/* ─── PWA standalone: sem safe-area no rodapé ─── */
body.pwa-standalone .bottom-nav {
  height: var(--nav-h);
  padding-bottom: 0;
}
body.pwa-standalone .screen {
  padding-bottom: calc(var(--nav-h) + 16px);
}
body.pwa-standalone .toast {
  bottom: calc(var(--nav-h) + 16px);
}

/* ─── Desktop Layout (sidebar) ─── */
@media (min-width: 768px) {
  :root {
    --sidebar-w: 220px;
    --nav-h: 0px;
    --safe-bottom: 0px;
    --safe-top: 0px;
  }

  #app {
    max-width: 100%;
    flex-direction: row;
    align-items: stretch;
    height: 100dvh;
    overflow: hidden;
  }

  /* Sidebar */
  .bottom-nav {
    position: relative;
    left: auto;
    bottom: auto;
    top: auto;
    transform: none;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 28px 12px;
    border-top: none;
    border-right: 1px solid var(--border);
    border-left: none;
    gap: 2px;
    order: -1;
    flex-shrink: 0;
    overflow: hidden;
  }

  .sidebar-brand {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    padding: 0 16px 20px;
    letter-spacing: -.3px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
  }

  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 12px;
    transition: background .15s, color .15s;
    width: 100%;
  }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { background: var(--accent-bg); color: var(--accent-light); }

  .nav-icon { font-size: 18px; }
  .nav-label { font-size: 14px; font-weight: 600; letter-spacing: 0; }

  /* Content area */
  .screen {
    flex: 1;
    overflow-y: auto;
    padding: 40px 48px 48px;
  }

  /* Month nav: remove safe-top padding */
  .month-nav { padding-top: 0; }

  /* Analytics charts taller */
  .analytics-chart-wrap { height: 280px; }

  /* Toast: offset for sidebar */
  .toast {
    left: calc(50% + var(--sidebar-w) / 2);
    bottom: 24px;
  }

  /* Bottom sheets → centered modals */
  .sheet-overlay.open {
    align-items: center;
    justify-content: center;
  }
  .sheet {
    border-radius: 20px;
    max-width: 500px;
    padding: 0 28px 28px;
  }
  .sheet-handle { display: none; }
  .sheet h2 { padding-top: 24px; }
}

