/* =========================================================
   Meu Planner — design system (inspirado no CheckPlanner)
   Paleta creme + nude, tipografia serifada elegante.
   ========================================================= */

:root {
  --bg: #FAF6F1;
  --bg-2: #F3ECE3;
  --surface: #FFFFFF;
  --surface-2: #FBF7F2;
  --text: #43392F;
  --text-soft: #8C7F72;
  --muted: #B4A899;
  --line: #ECE3D8;
  --line-strong: #E0D5C7;
  --primary: #C98A8E;
  --primary-soft: #F5E4E3;
  --primary-ink: #8A5A5D;
  --green: #9DBE9A;
  --green-soft: #E6EFE3;
  --amber: #D8A657;
  --amber-soft: #F6EBD6;
  --blue: #8FADC7;
  --blue-soft: #E3ECF3;
  --danger: #C97A72;
  --shadow: 0 8px 30px rgba(120, 96, 70, .09);
  --shadow-sm: 0 2px 10px rgba(120, 96, 70, .07);
  --radius: 20px;
  --radius-sm: 14px;
  --sidebar-w: 244px;
  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ----- temas ----- */
[data-theme="lavanda"] { --primary:#9B8CC4; --primary-soft:#ECE7F5; --primary-ink:#6A5C96; }
[data-theme="oceano"]  { --primary:#6FA6BD; --primary-soft:#E1EFF3; --primary-ink:#3F7488; }
[data-theme="matcha"]  { --primary:#9DBE7E; --primary-soft:#EBF2E1; --primary-ink:#5F7E44; }
[data-theme="grafite"] { --primary:#7E8794; --primary-soft:#E9EBEE; --primary-ink:#4C525C; }
[data-theme="terra"]   { --primary:#C08457; --primary-soft:#F3E5D8; --primary-ink:#8A5A34; }

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

/* tamanho padrão de ícones (evita SVG gigante quando sem classe) */
svg { width: 16px; height: 16px; flex-shrink: 0; }
.section-label svg { width: 15px; height: 15px; }
.page-eyebrow svg { width: 14px; height: 14px; }
.stat .k svg { width: 14px; height: 14px; }
.stat-ico svg { width: 17px; height: 17px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; border: 3px solid var(--bg); }

/* =========================================================
   Layout
   ========================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 18px;
}
.brand-logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-ink));
  display: grid; place-items: center; color: #fff; font-family: var(--serif); font-weight: 700; font-size: 17px;
}
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 19px; }
.brand-name b { color: var(--primary-ink); font-weight: 600; }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 12px;
  color: var(--text-soft); font-size: 14px; font-weight: 500;
  width: 100%; text-align: left; transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.nav-item .badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 600; border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav-spacer { flex: 1; }

/* conteúdo */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-mobile { display: none; }

.content { padding: 30px 40px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 26px; }
.page-eyebrow { color: var(--primary-ink); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; display:flex; align-items:center; gap:7px; }
.page-title { font-size: 34px; line-height: 1.1; margin: 6px 0 2px; }
.page-sub { color: var(--text-soft); font-size: 15px; }

/* =========================================================
   Componentes
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-soft { background: var(--surface-2); box-shadow: none; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 14px; }
.between { display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .k { font-size: 12px; color: var(--text-soft); display:flex; align-items:center; gap:7px; }
.stat .v { font-size: 30px; font-family: var(--serif); font-weight: 600; }
.stat .v small { font-size: 15px; color: var(--muted); }
.stat-ico { width: 30px; height: 30px; border-radius: 9px; display:grid; place-items:center; }

.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-bottom: 12px; display:flex; align-items:center; gap:8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 40px; font-weight: 600; font-size: 14px;
  background: var(--primary); color: #fff; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-soft); }
.btn-icon:hover { background: var(--primary-soft); color: var(--primary-ink); }
.btn-icon svg { width: 16px; height: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 30px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--line);
}
.chip.active { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.tag { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.tag-green { background: var(--green-soft); color: #5f7e44; }
.tag-amber { background: var(--amber-soft); color: #96702a; }
.tag-blue  { background: var(--blue-soft);  color: #3f6a88; }
.tag-rose  { background: var(--primary-soft); color: var(--primary-ink); }
.tag-red   { background: #F6E1DE; color: #a8534a; }

/* itens de lista */
.item {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-size: 14.5px; }
.item .sub { font-size: 12.5px; color: var(--text-soft); }
.item.done .title { text-decoration: line-through; color: var(--muted); }

.check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-strong);
  flex-shrink: 0; display: grid; place-items: center; transition: .15s; background: var(--surface);
}
.check.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.check svg { width: 13px; height: 13px; opacity: 0; }
.check.on svg { opacity: 1; }
.check.round { border-radius: 50%; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .emoji { font-size: 30px; display:block; margin-bottom: 8px; opacity:.8; }

.progress { height: 8px; background: var(--bg-2); border-radius: 20px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 20px; transition: width .4s; }

/* streak dots */
.streak-row { display: flex; gap: 5px; }
.streak-dot { width: 15px; height: 15px; border-radius: 5px; background: var(--bg-2); }
.streak-dot.on { background: var(--green); }

/* saudação / hero do início */
.hero-greet {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
}

/* =========================================================
   Modal
   ========================================================= */
.overlay {
  position: fixed; inset: 0; background: rgba(60, 48, 38, .32);
  backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 60;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 24px; width: 100%; max-width: 460px;
  padding: 26px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
  animation: pop .18s ease;
}
.modal h3 { font-size: 22px; margin-bottom: 4px; }
.modal .sub { color: var(--text-soft); font-size: 13.5px; margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: var(--surface-2); outline: none; transition: border .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 84px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 11px 20px; border-radius: 30px;
  font-size: 13.5px; font-weight: 500; z-index: 80; box-shadow: var(--shadow); animation: pop .2s;
}

/* donut (gastos por categoria) */
.donut { width: 130px; height: 130px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after {
  content: ""; position: absolute; inset: 22px; background: var(--surface); border-radius: 50%;
}
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.donut-legend .li { display: flex; align-items: center; gap: 8px; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; }

/* mood picker (diário) */
.mood-row { display: flex; gap: 8px; }
.mood { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 20px; display:grid; place-items:center; transition: .15s; }
.mood.sel { background: var(--primary-soft); border-color: var(--primary); transform: scale(1.08); }

/* calendário */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / .92; border: 1px solid var(--line); border-radius: 12px; padding: 7px 8px;
  background: var(--surface); display: flex; flex-direction: column; gap: 3px; overflow: hidden; cursor: pointer; transition: .12s;
}
.cal-cell:hover { border-color: var(--primary); }
.cal-cell.out { opacity: .38; }
.cal-cell.today { background: var(--primary-soft); border-color: var(--primary); }
.cal-cell .d { font-size: 13px; font-weight: 600; }
.cal-ev { font-size: 10.5px; padding: 1px 5px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* retrospectiva */
.wrapped {
  background: linear-gradient(150deg, var(--primary-ink), var(--primary));
  color: #fff; border-radius: 24px; padding: 30px; text-align: center;
}
.wrapped .big { font-family: var(--serif); font-size: 52px; line-height: 1; margin: 8px 0; }
.wrapped-grid { display:grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin-top: 22px; }
.wrapped-stat { background: rgba(255,255,255,.14); border-radius: 16px; padding: 16px; }
.wrapped-stat .n { font-family: var(--serif); font-size: 30px; }
.wrapped-stat .l { font-size: 12px; opacity: .85; }

/* =========================================================
   Responsivo
   ========================================================= */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 70; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open::after { content:""; position: fixed; inset:0; background: rgba(60,48,38,.3); z-index: 65; }
  .topbar-mobile {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
  }
  .content { padding: 20px 16px 90px; }
  .page-title { font-size: 27px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .hide-mobile { display: none !important; }
}
