/* =================================================================
   RESET & BASE
================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --nav:       #010409;
  --surface:   #161b22;
  --surface2:  #1c2128;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --green:     #39d353;
  --green-dim: #196127;
  --accent:    #238636;
  --red:       #da3633;
  --blue:      #1f6feb;
  --blue-soft: #0d419d;
  --water:     #1b6ca8;
  --font:      'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* =================================================================
   TOP NAV
================================================================= */
#topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 56px;
  overflow: hidden;
}

#hamburger {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  color: var(--text); padding: 6px 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
#hamburger:hover { background: var(--surface); }

/* Botão voltar no topnav — mesmo tamanho do hambúrguer */
#btn-back-nav {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  color: var(--text); padding: 6px 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  /* Transição de entrada/saída */
  overflow: hidden;
  max-width: 36px;   /* largura do hambúrguer (SVG 16px + 2×8px padding) */
  opacity: 1;
  transition: max-width .3s ease, opacity .25s ease, padding .3s ease,
              border-color .3s ease, background .15s;
}
#btn-back-nav.hidden {
  max-width: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  border-color: transparent;
  pointer-events: none;
}
#btn-back-nav:hover { background: var(--surface); }
#btn-back-nav img { display: block; flex-shrink: 0; filter: brightness(0) invert(1); }

/* Grupo logo + nome — desliza para a esquerda quando botão voltar some */
#nav-logo-group {
  display: flex; align-items: center; gap: 12px;
  margin-right: auto;
  /* herdado do flex parent, a transição é suave porque o btn-back-nav
     anima seu próprio max-width, empurrando este grupo naturalmente */
}

#logo-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; user-select: none; flex-shrink: 0;
}

#site-name {
  font-weight: 600; font-size: 15px; color: var(--text);
}

#nav-date {
  font-size: 13px; color: var(--muted);
  white-space: nowrap;
}

/* =================================================================
   SUB-TABS
================================================================= */
#subtabs {
  background: var(--nav);
  border-bottom: 1px solid var(--border);
  display: flex; padding: 0 16px; gap: 4px;
  overflow-x: auto;
}
#subtabs::-webkit-scrollbar { height: 0; }

.subtab {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: 13px; color: var(--muted); font-family: var(--font);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: #f78166; }

/* =================================================================
   SIDEBAR
================================================================= */
#overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
}
#overlay.open { display: block; }

#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 201;
  width: 280px; background: var(--nav);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
#sidebar.open { transform: translateX(0); }

#sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
#sidebar-header .logo-group { display: flex; align-items: center; gap: 10px; }

#sidebar-close {
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 4px;
  line-height: 1; border-radius: 4px; transition: color .15s;
}
#sidebar-close:hover { color: var(--text); }

#sidebar nav { padding: 12px 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: var(--muted); font-size: 14px; font-family: var(--font);
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  transition: color .15s, background .15s;
}
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: var(--text); background: var(--surface2); }
.nav-item .nav-icon { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }
.nav-item .nav-label { font-size: 14px; }

/* =================================================================
   PAGES
================================================================= */
#pages { min-height: calc(100vh - 96px); }
.page { display: none; }
.page.active { display: block; }

/* =================================================================
   PAGE: INÍCIO — layout de duas faixas
================================================================= */
#page-inicio { padding: 0; }

#page-inicio-inner {
  padding: 24px 20px;
}

/* Faixa superior: versículo ocupa toda a largura */
.inicio-verse-row {
  max-width: 1200px;
  margin: 0 auto 16px auto;
}

/* Faixa inferior: grid de cards de navegação — máximo 3 colunas */
.inicio-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 2 colunas em telas médias */
@media (max-width: 860px) {
  .inicio-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Versículo */
.verse-card {
  background: #1e3a1e;
  border: 1px solid #2d5a2d;
  border-radius: 10px;
  padding: 24px 28px;
  display: flex; gap: 14px;
  width: 100%;
}
.verse-card .v-icon { font-size: 22px; flex-shrink: 0; margin-top: 3px; }
.verse-card p {
  font-size: 14px; line-height: 1.8;
  color: #cde5cd; font-style: italic;
}
.verse-card .v-ref {
  margin-top: 10px; text-align: right;
  font-size: 12px; color: #8fa98f; font-style: normal;
}

/* Nav cards */
.nav-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, transform .15s;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 160px;
}
.nav-card:hover { border-color: #58a6ff; transform: translateY(-2px); }

.nav-card .card-img-placeholder {
  width: 100%; height: 130px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; overflow: hidden;
}
/* imagem de fundo do card ocupa o espaço todo */
.nav-card .card-img-placeholder img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.nav-card .card-body { padding: 14px 16px; flex: 1; }
.nav-card .card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
}
.nav-card .card-subtitle {
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.nav-card .card-bullets { list-style: none; }
.nav-card .card-bullets li {
  font-size: 12px; color: var(--muted); padding: 2px 0;
}
.nav-card .card-bullets li::before { content: "• "; color: var(--green-dim); }

/* Resumo Geral */
.resumo-card {
  background: #3b2a1a;
  border: 1px solid #5a3e22;
  border-radius: 10px;
  padding: 22px 24px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
  min-height: 80px;
  /* ocupa todas as colunas do grid */
  grid-column: 1 / -1;
}
.resumo-card:hover { border-color: #c9a96e; transform: translateY(-2px); }
.resumo-card .r-icon { font-size: 26px; }
.resumo-card .r-title { font-size: 22px; font-weight: 700; }

/* =================================================================
   PAGE: BOLETIM
================================================================= */
#page-boletim { display: none; }
#page-boletim.active { display: block; }

.boletim-view { display: none; }
.boletim-view.active { display: block; }

/* --- Layout desktop: 2 colunas --- */
#bv-main { padding: 0; }

.boletim-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  grid-template-rows: auto auto auto;
  gap: 1px;
  background: var(--border);
  min-height: calc(100vh - 96px);
  /* impede que qualquer filho extravase a largura do grid */
  overflow: hidden;
  width: 100%;
}

.bg-checklist {
  grid-column: 1; grid-row: 1 / 4;
  background: var(--bg); padding: 20px;
  overflow-y: auto;
  /* impede que conteúdo largo (nomes de hábitos) extravase */
  min-width: 0;
}
.bg-agua  { grid-column: 2; grid-row: 1; background: var(--bg); padding: 20px; min-width: 0; overflow: hidden; }
.bg-stats { grid-column: 2; grid-row: 2; background: var(--bg); padding: 20px; min-width: 0; overflow: hidden; }
.bg-painel{ grid-column: 2; grid-row: 3; background: var(--bg); padding: 20px; min-width: 0; overflow: hidden; }

/* Section title */
.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
}

/* =================================================================
   CHECKLIST
================================================================= */
.checklist-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.checklist-nav { display: flex; align-items: center; gap: 6px; }

.cl-nav-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  width: 30px; height: 30px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.cl-nav-btn:hover { background: var(--surface2); }

.cl-day-label {
  font-size: 13px; font-weight: 600; text-align: center; min-width: 80px;
}
.cl-day-badge {
  display: inline-block;
  background: var(--blue-soft); color: #79c0ff;
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 12px; letter-spacing: .5px; margin-top: 3px;
}

.habits-count-badge {
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.habits-count-badge.complete { background: var(--green); color: #000; }

.habit-group { margin-bottom: 16px; }
.hg-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 8px 0;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.hg-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: 1px; text-transform: uppercase;
}
.hg-add-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted);
  width: 22px; height: 22px; cursor: pointer; font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
}
.hg-add-btn:hover { border-color: var(--green); color: var(--green); }

.habit-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; border-radius: 6px;
  transition: background .15s; cursor: pointer;
  /* área de toque maior no mobile */
  -webkit-tap-highlight-color: transparent;
}
.habit-item:hover { background: var(--surface); }
.habit-item:active { background: var(--surface2); }

.habit-cb {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border); border-radius: 4px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.habit-cb.checked { background: var(--green); border-color: var(--green); }
.habit-cb.checked::after { content: "✓"; font-size: 11px; color: #000; font-weight: 700; }

.habit-icon { font-size: 19px; flex-shrink: 0; }
.habit-name { font-size: 14px; flex: 1; }
.habit-name.done { text-decoration: line-through; color: var(--muted); }
.habit-auto-badge {
  background: var(--blue-soft); color: #79c0ff;
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; letter-spacing: .4px; flex-shrink: 0;
}
.no-habits-msg {
  font-size: 13px; color: var(--muted);
  text-align: center; padding: 12px 0; font-style: italic;
}

/* =================================================================
   ÁGUA
================================================================= */
.agua-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  /* impede que botões ou inputs forcem largura maior que o container */
  width: 100%; box-sizing: border-box;
}
.agua-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.agua-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.agua-counter { font-size: 14px; color: var(--muted); }
.agua-counter span { color: #79c0ff; font-weight: 700; }

.agua-bar-wrap {
  background: var(--surface2); border-radius: 6px;
  height: 22px; margin-bottom: 12px; overflow: hidden; position: relative;
}
.agua-bar {
  height: 100%; background: linear-gradient(90deg, #1f6feb, #58a6ff);
  border-radius: 6px; transition: width .4s ease; min-width: 0;
}
.agua-bar-pct {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 700; color: var(--text);
}

.agua-cups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.agua-cup {
  width: 32px; height: 32px; border-radius: 6px;
  border: 2px solid var(--border); background: var(--surface2);
  cursor: pointer; transition: background .15s, border-color .15s;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.agua-cup.filled { background: var(--water); border-color: #58a6ff; }

.agua-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.agua-add-btn {
  background: var(--blue-soft); border: 1px solid #1f6feb;
  color: #79c0ff; border-radius: 6px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: background .15s;
}
.agua-add-btn:hover { background: #1f6feb; color: #fff; }

.agua-reset-btn {
  background: #3d1212; border: 1px solid var(--red);
  color: #f85149; border-radius: 6px; font-family: var(--font);
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background .15s;
}
.agua-reset-btn:hover { background: #5a1a1a; }

.agua-meta-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.agua-meta-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font);
  padding: 5px 8px; font-size: 13px; width: 80px;
  outline: none; text-align: center;
}
.agua-meta-input:focus { border-color: var(--blue); }

/* =================================================================
   ESTATÍSTICAS
================================================================= */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px; text-align: center;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--green);
  line-height: 1; margin-bottom: 6px;
}
.stat-label { font-size: 13px; color: var(--muted); }

/* =================================================================
   PAINEL ANUAL — heatmap estilo GitHub
================================================================= */
.painel-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
}
.painel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.painel-year-nav { display: flex; align-items: center; gap: 8px; }

.py-btn {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  width: 28px; height: 28px; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.py-btn:hover { background: var(--border); }
.py-year { font-size: 14px; font-weight: 600; min-width: 44px; text-align: center; }

.heatmap-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heatmap-table { border-collapse: collapse; font-size: 10px; color: var(--muted); }
/* garante que a tabela não extravase o container */
.painel-card { overflow: hidden; }
.heatmap-table td,
.heatmap-table th { padding: 1px 2px; vertical-align: middle; }
.heatmap-table th {
  font-weight: 400; color: var(--muted);
  font-size: 10px; padding-bottom: 4px; text-align: left;
}
.hm-day-label {
  font-size: 10px; color: var(--muted);
  padding-right: 6px; white-space: nowrap; min-width: 24px;
}
.hm-cell {
  width: 11px; height: 11px; border-radius: 2px;
  background: var(--surface2); border: 1px solid transparent;
  cursor: default; transition: transform .1s;
}
.hm-cell:hover { transform: scale(1.3); }
.hm-cell.today { border-color: #f78166; }
.hm-cell.l1 { background: #0e4429; }
.hm-cell.l2 { background: #196127; }
.hm-cell.l3 { background: #2ea043; }
.hm-cell.l4 { background: #39d353; }

.heatmap-legend {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 10px; font-size: 11px; color: var(--muted);
}
.legend-cell { width: 11px; height: 11px; border-radius: 2px; }
.legend-cell.l0 { background: var(--surface2); }
.legend-cell.l1 { background: #0e4429; }
.legend-cell.l2 { background: #196127; }
.legend-cell.l3 { background: #2ea043; }
.legend-cell.l4 { background: #39d353; }

/* =================================================================
   GERENCIAR HÁBITOS
================================================================= */
#bv-gerenciar { padding: 20px; }

.gerenciar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.gerenciar-title { font-size: 17px; font-weight: 700; }

.btn-back {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); cursor: pointer;
  padding: 8px 14px; font-size: 13px; font-family: var(--font);
  display: flex; align-items: center; gap: 6px; transition: background .15s;
}
.btn-back:hover { background: var(--surface2); }

.btn-primary {
  background: var(--accent); border: 1px solid #2ea043;
  border-radius: 6px; color: #fff; cursor: pointer; font-family: var(--font);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; transition: background .15s;
}
.btn-primary:hover { background: #2ea043; }

.manage-list { display: flex; flex-direction: column; gap: 8px; }
.manage-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
}
.manage-item .mi-icon { font-size: 22px; flex-shrink: 0; }
.manage-item .mi-info { flex: 1; min-width: 0; }
.manage-item .mi-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-item .mi-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mi-actions { display: flex; gap: 6px; flex-shrink: 0; }

.mi-edit-btn, .mi-del-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  padding: 6px 12px; font-size: 12px;
  transition: background .15s, color .15s, border-color .15s;
}
.mi-edit-btn { color: #79c0ff; }
.mi-edit-btn:hover { background: #1f6feb22; border-color: #1f6feb; }
.mi-del-btn { color: #f85149; }
.mi-del-btn:hover { background: #da363322; border-color: var(--red); }

/* =================================================================
   MODAL
================================================================= */
#modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.75);
  align-items: center; justify-content: center;
  padding: 16px;
}
#modal-overlay.open { display: flex; }

#modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  margin-bottom: 6px; letter-spacing: .6px; text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--font);
  padding: 10px 12px; font-size: 14px; outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--surface2); }

.emoji-picker-row { display: flex; align-items: center; gap: 10px; }
.emoji-display {
  font-size: 26px; width: 48px; height: 48px; flex-shrink: 0;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .15s;
}
.emoji-display:hover { border-color: var(--blue); }

.emoji-grid {
  display: none; flex-wrap: wrap; gap: 4px;
  margin-top: 8px; padding: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; max-height: 180px; overflow-y: auto;
}
.emoji-grid.open { display: flex; }
.emoji-opt {
  font-size: 22px; padding: 5px; cursor: pointer;
  border-radius: 4px; transition: background .1s;
}
.emoji-opt:hover { background: var(--border); }

.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.btn-cancel {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted); cursor: pointer; font-family: var(--font);
  padding: 9px 16px; font-size: 14px; transition: border-color .15s, color .15s;
}
.btn-cancel:hover { border-color: var(--text); color: var(--text); }
.btn-save {
  background: var(--accent); border: 1px solid #2ea043;
  border-radius: 6px; color: #fff; cursor: pointer; font-family: var(--font);
  padding: 9px 18px; font-size: 14px; font-weight: 600; transition: background .15s;
}
.btn-save:hover { background: #2ea043; }

/* =================================================================
   ANOTAÇÕES
================================================================= */
#bv-anotacoes { padding: 20px; }
.notes-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.notes-area {
  width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.75;
  padding: 18px; outline: none;
  resize: vertical; min-height: 420px;
  transition: border-color .15s;
}
.notes-area:focus { border-color: var(--blue); }
.notes-saved-msg {
  font-size: 12px; color: var(--green);
  opacity: 0; transition: opacity .4s;
}
.notes-saved-msg.show { opacity: 1; }

/* =================================================================
   PÁGINAS PLACEHOLDER
================================================================= */
.empty-page {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: calc(100vh - 200px);
  gap: 16px; color: var(--muted); padding: 24px;
}
.empty-page .ep-icon { font-size: 56px; }
.empty-page h2 { font-size: 20px; font-weight: 600; color: var(--text); }
.empty-page p { font-size: 14px; max-width: 320px; text-align: center; line-height: 1.6; }

/* =================================================================
   TOOLTIP
================================================================= */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 120%; left: 50%;
  transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); font-size: 11px;
  padding: 4px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none; z-index: 50;
}

/* =================================================================
   UTILITY
================================================================= */
.w-full { width: 100%; }
.justify-center { justify-content: center; }

/* =================================================================
   RESPONSIVO — Tablet (≤ 860px)
   Boletim colapsa para 1 coluna
================================================================= */
@media (max-width: 860px) {
  .boletim-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    background: var(--bg);
    gap: 0;
    min-height: unset;
  }
  .bg-checklist {
    grid-column: 1; grid-row: auto;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  .bg-agua  { grid-column: 1; grid-row: auto; border-bottom: 1px solid var(--border); }
  .bg-stats { grid-column: 1; grid-row: auto; border-bottom: 1px solid var(--border); }
  .bg-painel{ grid-column: 1; grid-row: auto; }

  /* botões de água dividem espaço igualmente */
  .agua-btns { flex-wrap: wrap; }
  .agua-add-btn { flex: 1; }

  /* nomes de hábitos não extravasam */
  .habit-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* views internas */
  #bv-gerenciar { padding: 16px; }
  #bv-anotacoes { padding: 16px; }
  .notes-area { min-height: 350px; }
}

/* =================================================================
   RESPONSIVO — Mobile (≤ 640px)
================================================================= */
@media (max-width: 640px) {

  /* Nav */
  #topnav { height: 48px; padding: 0 12px; gap: 8px; }
  #site-name { font-size: 14px; }
  #nav-date { display: none; }

  /* Sub-tabs */
  #subtabs { padding: 0 8px; }
  .subtab { padding: 8px 10px; font-size: 12px; }

  /* Início */
  #page-inicio-inner { padding: 14px 12px; }
  .inicio-verse-row { margin-bottom: 12px; }
  .inicio-cards-grid { gap: 10px; grid-template-columns: 1fr; }
  .verse-card { padding: 16px; }
  .verse-card p { font-size: 13px; line-height: 1.7; }
  .resumo-card { padding: 16px; min-height: 70px; }
  .resumo-card .r-title { font-size: 18px; }
  .nav-card .card-img-placeholder { height: 100px; font-size: 32px; }

  /* Boletim — seções */
  .bg-checklist,
  .bg-agua,
  .bg-stats,
  .bg-painel { padding: 14px 12px; }

  /* Checklist */
  .checklist-header { gap: 6px; }
  .cl-day-label { font-size: 12px; min-width: 64px; }

  /* Água */
  .agua-btns { gap: 6px; }
  .agua-add-btn { flex: 1; padding: 10px 6px; font-size: 13px; text-align: center; }
  .agua-reset-btn { padding: 10px 10px; font-size: 13px; }
  .agua-cups { gap: 5px; }
  .agua-cup { width: 30px; height: 30px; font-size: 13px; }

  /* Estatísticas */
  .stat-card { padding: 14px 10px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12px; }

  /* Painel anual */
  .hm-cell { width: 9px; height: 9px; }
  .legend-cell { width: 9px; height: 9px; }

  /* Gerenciar */
  #bv-gerenciar { padding: 14px 12px; }
  .gerenciar-header { flex-wrap: wrap; gap: 8px; align-items: flex-start; }
  .gerenciar-title { width: 100%; text-align: center; order: -1; font-size: 16px; }
  .manage-item { flex-wrap: wrap; }
  .manage-item .mi-info { min-width: 0; }
  .mi-actions { width: 100%; justify-content: flex-end; margin-top: 4px; }
  .mi-edit-btn, .mi-del-btn { flex: 1; text-align: center; padding: 8px 6px; }

  /* Modal */
  #modal-overlay { padding: 12px; align-items: flex-end; }
  #modal {
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
    max-height: 95vh;
  }
  .modal-title { font-size: 15px; }
  .emoji-display { width: 44px; height: 44px; font-size: 24px; }

  /* Anotações */
  #bv-anotacoes { padding: 14px 12px; }
  .notes-area { min-height: 300px; }

  /* Empty pages */
  .empty-page { min-height: calc(100vh - 150px); gap: 12px; }
  .empty-page .ep-icon { font-size: 44px; }
  .empty-page h2 { font-size: 17px; }
  .empty-page p { font-size: 13px; }
}

/* =================================================================
   RESPONSIVO — Mobile pequeno (≤ 380px)
================================================================= */
@media (max-width: 380px) {
  .agua-add-btn { font-size: 12px; padding: 9px 4px; }
  .agua-reset-btn { font-size: 12px; padding: 9px 8px; }
  .stat-value { font-size: 20px; }
  .hm-cell { width: 7px; height: 7px; }
  .legend-cell { width: 7px; height: 7px; }
  .nav-card .card-img-placeholder { height: 80px; font-size: 28px; }
}
