/* ============================================================
   Denário$ — design tokens (fiéis ao protótipo aprovado)
   ============================================================ */
:root {
  --sage: #3A5A54;
  --sage-dark: #2E4A45;
  --gold: #C9A24B;
  --terra: #B5673F;
  --green: #4E8C6A;
  --ink: #1F2A2E;
  --bg: #FCFCFB;
  --card: #FFFFFF;
  --border: #EFEDE8;
  --muted: #8A857A;
  --muted-2: #7A756C;
  --soft: #F5F3EE;
  --nav-inactive-text: #5C625F;
  --nav-inactive-icon-bg: #F2F0EA;
  --tab-inactive: #A8A296;
  --list-row-border: #F4F2EC;
  --bar-track: #F1EFE9;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
}

a { color: var(--sage); text-decoration: none; }
a:hover { color: var(--gold); }

input, select, textarea, button {
  font-family: 'Inter', system-ui, sans-serif;
}

::placeholder { color: #A8A296; }

button { cursor: pointer; }

.serif {
  font-family: 'Fraunces', serif;
}

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Sidebar (desktop only) ---------- */
.sidebar {
  display: none;
  width: 260px;
  flex: none;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  flex-direction: column;
  gap: 28px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding-left: 8px;
}

.logo-denario {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.logo-cifrao {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: var(--gold);
}

.sidebar .logo-denario,
.sidebar .logo-cifrao {
  font-size: 28px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: none;
  border-radius: 12px;
  text-align: left;
  background: transparent;
  color: var(--nav-inactive-text);
  font-size: 15px;
  font-weight: 500;
}

.nav-item.active {
  background: var(--sage);
  color: #FFFFFF;
}

.nav-icon {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--nav-inactive-icon-bg);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-tithe {
  margin-top: auto;
  padding: 18px;
  border-radius: 16px;
  background: var(--soft);
  border: 1px solid var(--border);
}

.sidebar-tithe-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.sidebar-tithe-value {
  font-family: 'Inter', sans-serif;
  font-size: clamp(20px, 1.9vw, 26px);
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sidebar-tithe-sub {
  font-size: 13px;
  color: var(--muted-2);
  margin-top: 2px;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.main { padding-top: 76px; }

.resumo-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.resumo-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.resumo-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.resumo-valor {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--ink);
}

.resumo-valor--entradas { color: var(--green); }
.resumo-valor--saidas { color: var(--terra); }

.resumo-valor--saldo {
  font-size: 16px;
  font-weight: 800;
}

.resumo-valor--saldo.negative { color: var(--terra); }

.resumo-item--saldo {
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mobile-logo {
  display: flex;
  align-items: baseline;
  gap: 1px;
  margin-bottom: 10px;
}

.mobile-logo .logo-denario,
.mobile-logo .logo-cifrao {
  font-size: 26px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.page-title {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.btn-header-lancar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--sage);
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(58, 90, 84, 0.22);
}

.btn-header-lancar:hover { background: var(--sage-dark); }

.btn-header-lancar .plus {
  font-size: 18px;
  line-height: 1;
}

/* ============================================================
   Views
   ============================================================ */
.view { display: flex; flex-direction: column; gap: 22px; }
.view.hidden { display: none; }

/* ---------- Versículo ---------- */
.verse-block {
  padding: 8px 4px 22px;
  border-bottom: 1px solid var(--border);
}

.verse-text {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  max-width: 26ch;
  text-wrap: pretty;
}

.verse-ref {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
}

/* ---------- Stat cards ---------- */
.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 10px;
  box-shadow: 0 1px 2px rgba(31, 42, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.stat-icon--green { background: #EAF2ED; color: var(--green); }
.stat-icon--terra { background: #F8EDE7; color: var(--terra); }
.stat-icon--sage  { background: #EDF1F0; color: var(--sage); }

.stat-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.stat-value {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
}

.stat-value.negative { color: var(--terra); }

.stat-spark {
  height: 52px;
  margin: 0 -6px -4px;
}

.stat-spark svg { display: block; width: 100%; height: 100%; }

/* ---------- Hero + categorias ---------- */
.hero-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.hero-card {
  border-radius: 20px;
  padding: 24px;
  background: linear-gradient(135deg, #C9A24B 0%, #A88742 38%, #3A5A54 100%);
  color: #FFFFFF;
  box-shadow: 0 14px 34px rgba(58, 90, 84, 0.24);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 210px;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hero-icon {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.hero-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.9;
  line-height: 1.3;
}

.hero-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  white-space: nowrap;
  flex: none;
}

.hero-value {
  font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  white-space: nowrap;
}

.hero-sub {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.88;
}

.hero-progress {
  margin-top: 14px;
}

.hero-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.hero-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #FFFFFF;
}

.hero-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.92;
}

.hero-footer-joy {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 400;
}

.hero-block {
  display: flex;
  flex-direction: column;
}

.hero-block--ofertas {
  gap: 6px;
}

.hero-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
  margin: 2px 0;
}

.hero-block-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.85;
}

.hero-ofertas-text {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.4;
  opacity: 0.95;
}

.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(31, 42, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.category-rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.category-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
}

.category-name {
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-value {
  font-weight: 600;
  color: var(--muted-2);
  white-space: nowrap;
}

.category-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* ---------- Categorias (tela de gerenciar) ---------- */
.categorias-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.categoria-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(31, 42, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.categoria-card-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.categoria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--list-row-border);
}

.categoria-row:last-child { border-bottom: none; }

.categoria-nome {
  font-size: 15px;
  font-weight: 500;
}

.categoria-badge-fixa {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--soft);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Últimos lançamentos / lista ---------- */
.recent-section, .list-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.recent-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.recent-link {
  background: none;
  border: none;
  color: var(--sage);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 2px;
  white-space: nowrap;
  flex: none;
}

.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(31, 42, 46, 0.04);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--list-row-border);
}

.list-row:last-child { border-bottom: none; }

.list-icon {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.list-icon--green { background: #EAF2ED; color: var(--green); }
.list-icon--terra { background: #F8EDE7; color: var(--terra); }
.list-icon--gold  { background: #F7F0DF; color: #9A7C33; }

.list-body { flex: 1; min-width: 0; }

.list-desc {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.list-value {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.list-value--green { color: var(--green); }
.list-value--terra { color: var(--terra); }
.list-value--gold  { color: var(--gold); }

.list-delete {
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-delete:hover { background: #F8EDE7; color: var(--terra); }

.list-empty, .list-loading, .list-error {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.list-error { color: var(--terra); }

/* ============================================================
   Tela Lançar
   ============================================================ */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(31, 42, 46, 0.04);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 560px;
}

.type-selector {
  display: flex;
  gap: 8px;
  padding: 5px;
  background: var(--soft);
  border-radius: 14px;
}

.type-btn {
  flex: 1;
  padding: 11px 8px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
}

.type-btn.active {
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31, 42, 46, 0.12);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.value-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

.value-currency {
  font-size: 26px;
  font-weight: 600;
  color: var(--muted);
}

.value-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ink);
  background: transparent;
  min-width: 0;
}

.text-input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 16px;
  outline: none;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--nav-inactive-text);
}

.chip.active {
  border-color: var(--sage);
  background: var(--sage);
  color: #FFFFFF;
}

.filter-chip {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--nav-inactive-text);
}

.filter-chip.active {
  border-color: var(--sage);
  background: var(--sage);
  color: #FFFFFF;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.list-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 30px 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background-color: #FFFFFF;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%238A857A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 10px 6px;
  color: var(--nav-inactive-text);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--sage);
}

.btn-save {
  margin-top: 4px;
  background: var(--sage);
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(58, 90, 84, 0.22);
}

.btn-save:hover { background: var(--sage-dark); }

.btn-save:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.save-msg {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.save-msg.error {
  color: var(--terra);
  font-style: normal;
  font-weight: 600;
}

/* ============================================================
   Mobile bottom nav + FAB
   ============================================================ */
.mobile-bottom-spacer { height: 96px; }

.fab {
  position: fixed;
  right: 20px;
  bottom: 96px;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  border: none;
  background: var(--sage);
  color: #FFFFFF;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 10px 26px rgba(58, 90, 84, 0.34);
  z-index: 20;
}

.bottom-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 10px 12px 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--tab-inactive);
}

.tab-btn.active { color: var(--sage); }

.tab-glyph { font-size: 19px; line-height: 1; }

.tab-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============================================================
   Breakpoints
   ============================================================ */
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .mobile-logo, .fab, .bottom-tabbar, .mobile-bottom-spacer { display: none; }
  .btn-header-lancar { display: flex; }

  .main { padding: 34px 40px; }
  .main { padding-top: 102px; }

  .resumo-bar { left: 260px; padding: 14px 40px; gap: 40px; }
  .resumo-label { font-size: 11px; }
  .resumo-valor { font-size: 16px; }
  .resumo-valor--saldo { font-size: 19px; }

  .verse-text { font-size: 30px; }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1.15fr 1fr; }
}

@media (min-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
