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

:root {
  --bg:       #0c0e0d;
  --surface:  #131614;
  --surface2: #191c1a;
  --surface3: #1f2320;
  --border:   #252a26;
  --accent:   #16925c;
  --accent2:  #107045;
  --green:    #34d399;
  --red:      #f87171;
  --amber:    #fbbf24;
  --pink:     #f472b6;
  --orange:   #fb923c;
  --cyan:     #22d3ee;
  --purple:   #a78bfa;
  --text:     #e6eae7;
  --text2:    #8a958c;
  --text3:    #525e54;
  --radius:   10px;
  --radius-sm: 6px;
  --nav-h:    60px;
  --sidenav-w: 220px;
  --sidenav-w-collapsed: 68px;
}

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'DM Mono', monospace; }
.serif { font-family: 'DM Serif Display', serif; }
.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== VIEWS ===== */
.view { min-height: 100vh; }

/* ===== SELETOR DE PERFIS ===== */
.perfis-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.perfis-titulo {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  margin-bottom: 32px;
  color: var(--text);
}

.perfis-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 400px;
}

.perfil-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.15s;
}
.perfil-card:hover { transform: scale(1.05); }

.perfil-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.perfil-card:hover .perfil-avatar { filter: brightness(1.1); transform: translateY(-2px); }

.novo-av {
  background: var(--surface2) !important;
  border-color: var(--border) !important;
  color: var(--text3) !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 32px;
  font-weight: 300;
}

.perfil-nome {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}

.novo-perfil-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  width: 100%;
  max-width: 280px;
}
.novo-perfil-form input {
  width: 100%;
}
.novo-perfil-form .btn-primary {
  justify-content: center;
}

/* ===== AUTH (setup) ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-logo { font-size: 2.4rem; margin-bottom: 8px; }

.auth-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-title span { color: var(--accent); }

.auth-sub { color: var(--text3); font-size: 12px; margin-bottom: 24px; }

/* ===== FIELDS ===== */
.field { margin-bottom: 14px; }
.field:last-of-type { margin-bottom: 0; }

.senha-input-wrap { position: relative; }
.senha-input-wrap input { padding-right: 42px; width: 100%; }
.senha-toggle-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 8px 10px;
  color: var(--text3);
  line-height: 1;
  transition: color 0.15s;
}
.senha-toggle-btn:hover { color: var(--text); }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text3); }
select option { background: var(--surface2); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-primary.full { width: 100%; justify-content: center; margin-top: 16px; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: var(--surface3); color: var(--text); }

.btn-ghost {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--surface3); }

.btn-outline-sm {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline-sm:hover { background: rgba(22,146,92,0.1); }

.btn-back {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-back:hover { background: var(--surface3); color: var(--text); }

.icon-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface3); color: var(--text); }
.icon-btn.pay-btn:hover { background: rgba(52,211,153,.15); border-color: var(--green); color: var(--green); }
.icon-btn.del-btn:hover { background: rgba(248,113,113,.12); border-color: var(--red); color: var(--red); }

/* ===== SETUP ===== */
.setup-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  margin-bottom: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  gap: 12px;
  transition: border-color 0.15s;
}
.toggle-row:hover { border-color: var(--accent); }

.toggle-info { display: flex; flex-direction: column; gap: 2px; }
.toggle-info strong { font-size: 13px; color: var(--text); font-weight: 500; }
.toggle-info small  { font-size: 11px; color: var(--text3); }

.toggle-check {
  width: 38px; height: 22px;
  flex-shrink: 0;
  appearance: none; -webkit-appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: none; padding: 0; margin: 0;
}
.toggle-check::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.toggle-check:checked { background: var(--accent); }
.toggle-check:checked::after { left: 19px; }

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 12px;
  height: 50px;
}
.screen-header h2 { font-size: 14px; font-weight: 600; flex: 1; text-align: center; }

.screen-body {
  padding: 20px;
  padding-bottom: calc(var(--nav-h) + 20px);
  max-width: 760px;
  margin: 0 auto;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 14px;
}

.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.month-nav-btn:hover { background: var(--surface3); color: var(--text); }

.month-label {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  min-width: 130px;
  text-align: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 5px 12px 5px 8px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.profile-pill:hover { border-color: var(--accent); }
.pill-avatar { font-size: 18px; }

/* ===== DASHBOARD BODY ===== */
.dash-body {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
  padding-bottom: calc(var(--nav-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== KPI PANELS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
}

.kpi-value {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.kpi-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
}
.kpi-meta-label { color: var(--text3); }
.kpi-pct { color: var(--text2); font-weight: 500; }

.kpi-bar {
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.kpi-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.3s;
}

.kpi-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(52,211,153,.12);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
}
.kpi-badge.over { background: rgba(248,113,113,.12); color: var(--red); }

.kpi-receita {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}
.kpi-receita-input {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
  flex: 1;
  min-width: 0;
}
.kpi-receita-input:focus { border-color: var(--accent); }
.kpi-receita-static strong { color: var(--text); }

/* ===== DASH CARDS (menu summary) ===== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dash-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--dash-accent, var(--text3));
}
.dash-card:hover { background: var(--surface2); }

.dash-card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.dash-card-value {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--dash-accent, var(--text));
}
.dash-card-sub { font-size: 11px; color: var(--text3); margin-top: 5px; }
.dash-card-arrow { position: absolute; top: 16px; right: 14px; color: var(--text3); font-size: 14px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ===== TABLE ===== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.section-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
}
.section-badge.pink   { background: rgba(244,114,182,.12); color: var(--pink); }
.section-badge.orange { background: rgba(251,146,60,.12);  color: var(--orange); }
.section-badge.cyan   { background: rgba(34,211,238,.12);  color: var(--cyan); }
.section-badge.green  { background: rgba(52,211,153,.12);  color: var(--green); }

.section-total {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: var(--text2);
}
.section-total span { color: var(--text); font-weight: 500; }

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr.paid-row { opacity: 0.45; }

td { padding: 11px 16px; vertical-align: middle; }

.bill-name { font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.bill-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.bill-value { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-inst     { background: rgba(251,191,36,.1);  border: 1px solid rgba(251,191,36,.25); color: var(--amber); }
.badge-fixed    { background: rgba(22,146,92,.1);   border: 1px solid rgba(22,146,92,.25);  color: var(--accent); }
.badge-sub      { background: rgba(34,211,238,.1);  border: 1px solid rgba(34,211,238,.25); color: var(--cyan); }
.badge-cat      { }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge.open { background: rgba(248,113,113,.12); color: var(--red); }
.status-badge.paid { background: rgba(52,211,153,.12);  color: var(--green); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state { padding: 48px; text-align: center; color: var(--text3); }
.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.5; }
.empty-state p { font-size: 13px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 30;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-btn:hover { background: var(--surface2); }
.nav-btn-icon  { font-size: 1.15rem; line-height: 1; }
.nav-btn-label { font-size: 10px; font-weight: 600; color: var(--text3); transition: color 0.15s; letter-spacing: 0.3px; }
.nav-btn.active .nav-btn-label { color: var(--accent); }

/* ===== SIDE NAV (desktop) ===== */
.side-nav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidenav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: none;
  flex-direction: column;
  z-index: 30;
  transition: width 0.15s;
}

.side-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.side-nav-brand {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}
.side-nav-brand span { color: var(--accent); }

.side-nav-toggle {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}
.side-nav-toggle:hover { background: var(--surface2); color: var(--text); }

.side-nav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  overflow-y: auto;
}

.side-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.side-nav-btn:hover { background: var(--surface2); color: var(--text); }
.side-nav-btn.active { background: rgba(22,146,92,.12); color: var(--accent); }

.side-nav-icon { font-size: 16px; width: 20px; flex-shrink: 0; text-align: center; }
.side-nav-label { overflow: hidden; }

.side-nav.collapsed { width: var(--sidenav-w-collapsed); }
.side-nav.collapsed .side-nav-top { justify-content: center; padding: 18px 8px; }
.side-nav.collapsed .side-nav-brand,
.side-nav.collapsed .side-nav-label { display: none; }
.side-nav.collapsed .side-nav-btn { justify-content: center; }

@media (min-width: 901px) {
  .side-nav:not(.hidden) { display: flex; }
  body.has-sidenav .bottom-nav { display: none !important; }
  body.has-sidenav .view { padding-left: var(--sidenav-w); }
  body.has-sidenav.sidenav-collapsed .view { padding-left: var(--sidenav-w-collapsed); }
  /* A barra lateral já mostra a marca — some a duplicata no topo do dashboard */
  body.has-sidenav .brand-logo { display: none; }
}

/* ===== CATEGORIAS ===== */
.cat-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.cat-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-nome { flex: 1; font-size: 13px; font-weight: 500; }

.cor-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cor-dot-pick {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.cor-dot-pick:hover { transform: scale(1.1); }
.cor-dot-pick.sel { border-color: var(--text); }

/* ===== CONFIG ===== */
.config-section { margin-top: 20px; margin-bottom: 6px; }

.config-link-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s;
}
.config-link-btn:hover { background: var(--surface2); }
.config-link-btn.danger { color: var(--red); }
.config-link-btn span { color: var(--text3); }

/* ===== CHIPS ===== */
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  color: var(--text2);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: rgba(22,146,92,0.12);
  border-color: rgba(22,146,92,0.5);
  color: var(--accent);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

@media (min-width: 520px) {
  .modal { align-items: center; padding: 16px; }
  .modal-box { border-radius: var(--radius) !important; max-width: 450px; }
  .modal-box.small { max-width: 340px; }
  .modal-box.wide { max-width: 640px; }
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 22px 28px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform 0.2s;
}

.modal-handle {
  width: 36px; height: 3px;
  background: var(--border);
  border-radius: 999px;
  margin: 7px auto 16px;
}

.modal-box h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== ERROR ===== */
.error-msg {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12px;
  margin-top: 10px;
}

/* ===== THREE-COL FIELD ROW ===== */
.field-row.three-col { grid-template-columns: 1fr 80px 1fr; }

/* ===== DASH FILTER BAR ===== */
.dash-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== COL DIA ===== */
.col-dia { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text3); white-space: nowrap; }

/* ===== SUMMARY CARDS (cartão / shopee) ===== */
.sum-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
}

.sum-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.sum-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
.sc-pink::before   { background: var(--pink); }
.sc-orange::before { background: var(--orange); }
.sc-amber::before  { background: var(--amber); }
.sc-cyan::before   { background: var(--cyan); }
.sc-green::before  { background: var(--green); }

.sum-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}
.sum-value {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.5px;
}
.sum-value.pink   { color: var(--pink); }
.sum-value.orange { color: var(--orange); }
.sum-value.amber  { color: var(--amber); }
.sum-value.cyan   { color: var(--cyan); }
.sum-value.green  { color: var(--green); }
.sum-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ===== PROGRESS PILL ===== */
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pp-nums {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.25);
  color: var(--amber);
  padding: 2px 7px;
  border-radius: 20px;
}
.pp-track {
  width: 36px; height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.pp-fill { height: 100%; background: var(--amber); border-radius: 2px; }

/* ===== FILTER TABS ===== */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 5px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.filter-tab:hover { color: var(--text); border-color: var(--text3); }
.filter-tab.active {
  background: rgba(22,146,92,.1);
  border-color: rgba(22,146,92,.4);
  color: var(--accent);
}

/* ===== BILL SUBTITLE ===== */
.bill-sub { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: 'DM Mono', monospace; }

/* ===== DESTINO BADGES ===== */
.badge-dest-mensal  { background: rgba(34,211,238,.1); border: 1px solid rgba(34,211,238,.25); color: var(--cyan); }
.badge-dest-adiant  { background: rgba(22,146,92,.1);  border: 1px solid rgba(22,146,92,.25);  color: var(--accent); }
.badge-entrada { background: rgba(52,211,153,.1);  border: 1px solid rgba(52,211,153,.25); color: var(--green); }
.badge-saida    { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: var(--red); }

/* ===== SECTION LABEL SM ===== */
.section-label-sm {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

/* ===== TIPO CARDS (modal) ===== */
.tipo-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.tipo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: 'DM Sans', sans-serif;
  width: 100%;
}
.tipo-card:hover { border-color: var(--text3); }
.tipo-card.active { border-color: var(--orange); background: rgba(251,146,60,.1); }
.tipo-card-icon { font-size: 22px; }
.tipo-card-label { font-size: 12px; font-weight: 600; color: var(--text); }
.tipo-card-sub { font-size: 10px; color: var(--text3); text-align: center; }

/* ===== CICLO CARDS (modal) ===== */
.ciclo-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.ciclo-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  width: 100%;
}
.ciclo-card:hover { border-color: var(--text3); }
.ciclo-card.active { border-color: var(--orange); background: rgba(251,146,60,.1); }
.ciclo-card-icon { font-size: 20px; }
.ciclo-card-info { display: flex; flex-direction: column; gap: 2px; }
.ciclo-card-label { font-size: 13px; font-weight: 600; color: var(--text); }
.ciclo-card-sub { font-size: 11px; color: var(--text3); }

/* ===== PARCELA RESUMO ===== */
.parcela-resumo {
  background: rgba(251,146,60,.06);
  border: 1px solid rgba(251,146,60,.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text2);
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  line-height: 1.6;
}

/* ===== DASH SECTION LABEL ===== */
.dash-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 20px 0 10px;
}

/* ===== CHART ===== */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ===== ANÁLISES (gasto por categoria) ===== */
.analises-body {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
  padding-bottom: calc(var(--nav-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.analises-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.analises-kpi-row .kpi-card { min-width: 0; }
.cat-donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.cat-donut-wrap canvas {
  max-width: 220px;
  max-height: 220px;
  flex-shrink: 0;
}
.cat-legend {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cat-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.cat-legend-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.cat-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-legend-value { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); white-space: nowrap; }
.cat-legend-bar-track { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.cat-legend-bar-fill { height: 100%; border-radius: 3px; }

/* ===== BTN NOVA CONTA ===== */
.btn-nova-conta {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-nova-conta:hover { background: var(--accent2); }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .topbar { padding: 0 14px; }
  .dash-body { padding: 14px; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .analises-body { padding: 14px; }
  .field-row.three-col { grid-template-columns: 1fr 1fr; }
  .field-row.three-col .field:last-child { grid-column: span 2; }
  thead th:nth-child(2), td:nth-child(2) { display: none; }
}
