:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f5f1ea;
  --ink: #1a1a1a;
  --ink-soft: #5a5a5a;
  --ink-light: #8a8a8a;
  --accent: #c9805c;
  --accent-deep: #a8623f;
  --accent-soft: #f4e1d2;
  --accent-tint: #fdf6f0;
  --line: #ece7df;
  --success: #6b8e6b;
  --warning: #d4a574;
  --error: #c46666;
  --info: #5a8fa8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --arabic: 'Amiri', serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { overflow-x: hidden; overscroll-behavior-y: contain; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  min-height: 100vh;
  padding-bottom: calc(72px + var(--safe-bottom));
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; cursor: pointer; }

/* ============ APP BAR ============ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: calc(8px + var(--safe-top)) 12px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.appbar.scrolled {
  border-bottom-color: var(--line);
  background: rgba(250, 248, 245, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.appbar-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex: 1;
  text-align: center;
}
.appbar-actions { display: flex; gap: 2px; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: background 0.2s;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ============ PAGES ============ */
.page { display: none; animation: pageEnter 0.25s ease; }
.page.active { display: block; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
.page-content { padding: 8px 20px 32px; }

/* ============ HOME ============ */
.greeting { padding: 20px 0 8px; }
.greeting-small { font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }
.greeting-large {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.greeting-large em { font-style: italic; color: var(--accent); }

.hero-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
  border-radius: 24px;
  padding: 22px;
  margin: 24px 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
  margin-bottom: 4px;
}
.hero-card-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.hero-card-stats { display: flex; gap: 24px; position: relative; z-index: 1; }
.hero-stat .num {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}
.hero-stat .lbl { font-size: 11px; opacity: 0.85; margin-top: 4px; letter-spacing: 0.04em; }

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}
.section-label h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.section-label .see-all {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  background: none;
  border: none;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.quick-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, background 0.15s;
  min-height: 110px;
}
.quick-card:active { transform: scale(0.97); background: var(--surface-2); }
.quick-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--accent-tint);
}
.quick-card:nth-child(2) .quick-card-icon { background: #e8f0e6; }
.quick-card:nth-child(3) .quick-card-icon { background: #e8edf5; }
.quick-card:nth-child(4) .quick-card-icon { background: #f5e8e8; }
.quick-card:nth-child(5) .quick-card-icon { background: #f5f0e8; }
.quick-card:nth-child(6) .quick-card-icon { background: #ede5f5; }
.quick-card-title { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.quick-card-sub { font-size: 12px; color: var(--ink-light); margin-top: auto; }

/* ============ ARTICLE CARDS ============ */
.featured-article, .article-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
  transition: transform 0.15s;
}
.featured-article:active, .article-row:active { transform: scale(0.98); }
.article-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.featured-article h3, .article-row h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
}
.featured-article p, .article-row p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 10px;
}
.featured-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-light);
}

/* ============ FILTER CHIPS ============ */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 20px 16px;
  margin: 0 -20px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: all 0.15s;
}
.chip.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ============ DOA CARDS ============ */
.doa-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 12px;
}
.doa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.doa-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.doa-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.doa-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}
.doa-time {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.doa-arab {
  font-family: var(--arabic);
  font-size: 26px;
  line-height: 2;
  text-align: right;
  margin-bottom: 12px;
  color: var(--ink);
  direction: rtl;
  padding: 16px;
  background: var(--accent-tint);
  border-radius: 12px;
}
.doa-latin {
  font-style: italic;
  font-size: 14px;
  color: var(--accent-deep);
  margin-bottom: 10px;
  line-height: 1.6;
}
.doa-arti {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.doa-arti::before {
  content: 'Artinya: ';
  font-weight: 600;
  color: var(--ink);
}
.doa-reminder-btn {
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: 1px dashed var(--line);
  padding: 8px 12px;
  border-radius: 10px;
  width: 100%;
}
.doa-reminder-btn.active {
  background: var(--accent-tint);
  border-style: solid;
  border-color: var(--accent);
}

/* ============ CALC ============ */
.calc-total-card {
  background: var(--ink);
  color: white;
  border-radius: 24px;
  padding: 24px;
  margin: 16px 0 20px;
  box-shadow: var(--shadow-md);
}
.calc-total-label {
  font-size: 12px;
  opacity: 0.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.calc-total-value {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 8px;
}
.calc-total-detail { font-size: 13px; opacity: 0.7; }

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
}
.form-card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin-bottom: 16px;
}
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 500;
}
.form-label .val { color: var(--accent); font-weight: 600; }

.form-input, .form-select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); }
.form-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--line);
  border-radius: 100px;
  outline: none;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.form-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.breakdown-row:last-child { border: none; }
.breakdown-row .lbl { color: var(--ink-soft); }
.breakdown-row .val { font-weight: 600; font-variant-numeric: tabular-nums; }

.info-tip {
  background: var(--accent-tint);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 12px;
  display: flex;
  gap: 10px;
}
.info-tip-icon { flex-shrink: 0; }

/* ============ SEGMENT CONTROL ============ */
.segment-control {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============ TAB ROW ============ */
.tab-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  margin: 12px 0 16px;
}
.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.anak-tab, .keu-tab { display: none; }
.anak-tab.active, .keu-tab.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ CHECKLIST ============ */
.action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.progress-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin: 16px 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.progress-ring { width: 64px; height: 64px; flex-shrink: 0; position: relative; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .bg-circle { stroke: var(--line); stroke-width: 6; fill: none; }
.progress-ring .fill-circle {
  stroke: var(--accent);
  stroke-width: 6;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-ring .text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}
.progress-info h4 { font-family: var(--serif); font-size: 17px; font-weight: 500; margin-bottom: 2px; }
.progress-info p { font-size: 13px; color: var(--ink-soft); }

.check-section { margin-bottom: 24px; }
.check-section-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-section-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 4px;
}
.check-section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.check-item:last-child { border-bottom: none; }
.check-item:active { background: var(--surface-2); }
.check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 7px;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}
.check-box:checked { background: var(--accent); border-color: var(--accent); }
.check-box:checked::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-label { flex: 1; font-size: 14px; line-height: 1.4; }
.check-item.done .check-label { text-decoration: line-through; color: var(--ink-light); }

/* ============ JOURNAL ============ */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-tint);
  color: var(--accent-deep);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0;
}
.journal-prompt-card {
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--accent-soft) 100%);
  border-radius: 18px;
  padding: 18px;
  margin: 12px 0;
}
.journal-prompt-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  margin-bottom: 6px;
  font-weight: 600;
}
.journal-prompt-text {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink);
}
.journal-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
}
.journal-input {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 16px;
  background: transparent;
  margin-bottom: 12px;
  font-weight: 600;
}
.journal-input:focus { outline: none; border-color: var(--accent); }
.journal-input::placeholder { color: var(--ink-light); font-weight: 500; }

.mood-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.mood-row::-webkit-scrollbar { display: none; }
.mood-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mood-btn.selected {
  background: var(--accent-tint);
  border-color: var(--accent);
  transform: scale(1.08);
}
.journal-textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  resize: vertical;
}
.journal-textarea:focus { outline: none; border-color: var(--accent); }
.journal-actions { display: flex; gap: 8px; margin-top: 12px; }

.entry-list-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 8px 0 12px;
}
.entry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: transform 0.15s;
  cursor: pointer;
}
.entry-card:active { transform: scale(0.98); }
.entry-card.active { border-color: var(--accent); background: var(--accent-tint); }
.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.entry-date { font-size: 11px; color: var(--ink-light); letter-spacing: 0.04em; }
.entry-mood { font-size: 16px; }
.entry-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.entry-preview {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-light);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ============ TRACKER ============ */
.week-display {
  background: linear-gradient(135deg, #f5e6d8 0%, var(--accent-soft) 100%);
  border-radius: 24px;
  padding: 28px 24px;
  margin: 16px 0 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.week-display::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  border-radius: 50%;
}
.week-number {
  font-family: var(--serif);
  font-size: 96px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  position: relative;
  z-index: 1;
}
.week-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.week-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.08);
  position: relative;
  z-index: 1;
}
.week-stat .stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  margin-bottom: 2px;
}
.week-stat .stat-val { font-family: var(--serif); font-size: 15px; font-weight: 500; }
.week-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}
.week-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 18px;
  flex-shrink: 0;
}
.week-nav-btn:active { background: var(--surface-2); }

.info-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
}
.info-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 700;
}
.info-block ul { list-style: none; }
.info-block ul li {
  padding: 6px 0 6px 20px;
  position: relative;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.info-block ul li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 14px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.info-block.warning { background: #fff8e6; border-color: #ffe5a3; }
.info-block.warning .info-block-title { color: #b58917; }
.info-block.warning ul li::before { background: #b58917; }

/* ============ BOTTOM NAV ============ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
  z-index: 100;
}
.nav-item {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--ink-light);
  transition: color 0.15s;
  border-radius: 12px;
}
.nav-item:active { background: var(--surface-2); }
.nav-item.active { color: var(--accent); }
.nav-icon { width: 24px; height: 24px; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: translateY(-2px); }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }

/* ============ DRAWER ============ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 80%;
  max-width: 320px;
  background: var(--bg);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding: calc(20px + var(--safe-top)) 0 20px;
  overflow-y: auto;
  box-shadow: 8px 0 32px rgba(0,0,0,0.1);
}
.drawer.active { transform: translateX(0); }
.drawer-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-logo { display: flex; align-items: baseline; margin-bottom: 6px; }
.drawer-nav { padding: 12px 0; }
.drawer-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 24px;
  background: none;
  border: none;
  font-size: 15px;
  color: var(--ink);
  transition: background 0.15s;
}
.drawer-item:active { background: var(--surface-2); }
.drawer-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 24px;
}

/* ============ SHEET ============ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.sheet-overlay.active { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  z-index: 201;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: calc(24px + var(--safe-bottom));
}
.sheet.active { transform: translateY(0); }
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--line);
  border-radius: 100px;
  margin: 10px auto 16px;
}
.sheet-content { padding: 0 24px 24px; }
.sheet-content h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 8px;
}
.sheet-meta { font-size: 12px; color: var(--ink-light); margin-bottom: 20px; }
.sheet-content p {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 16px;
}
.sheet-content h3 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 20px 0 10px;
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s;
  box-shadow: var(--shadow-lg);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ============ QUIZ ============ */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  margin: 16px 0;
}
.quiz-bar {
  height: 6px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 20px;
}
.quiz-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.quiz-num {
  font-size: 12px;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
  font-weight: 600;
}
.quiz-q {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 20px;
}
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  transition: all 0.15s;
  line-height: 1.4;
}
.quiz-opt:active {
  background: var(--accent-tint);
  border-color: var(--accent);
  transform: scale(0.99);
}
.quiz-result { text-align: center; padding: 16px 0; }
.quiz-score-num {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin: 20px 0;
}
.quiz-level { font-family: var(--serif); font-size: 24px; font-weight: 500; margin-bottom: 20px; }
.quiz-feedback {
  background: var(--accent-tint);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ============ BUTTONS ============ */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:active { background: var(--accent-deep); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-small { padding: 10px 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============ INSTALL BANNER ============ */
.install-banner {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  background: var(--ink);
  color: white;
  padding: 14px 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 150;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.4s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.install-banner-text { flex: 1; }
.install-banner-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.install-banner-sub { font-size: 12px; opacity: 0.7; }

/* ============ GROWTH CHART ============ */
.growth-result-card {
  padding: 20px;
  border-radius: 18px;
  margin-bottom: 12px;
  text-align: center;
}
.growth-result-card.normal { background: #e8f5e9; border: 1px solid #a5d6a7; }
.growth-result-card.warning { background: #fff3e0; border: 1px solid #ffcc80; }
.growth-result-card.alert { background: #ffebee; border: 1px solid #ef9a9a; }
.growth-status {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}
.growth-percentile {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ============ TABLET ============ */
@media (min-width: 600px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    min-height: 100vh;
  }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .install-banner { max-width: 448px; left: 50%; transform: translateX(-50%); }
  .sheet { max-width: 480px; left: 50%; transform: translateX(-50%) translateY(100%); }
  .sheet.active { transform: translateX(-50%) translateY(0); }
  .drawer { max-width: 320px; }
  .fab-container { right: calc(50% - 220px); }
}

/* ============ FINANCE ============ */
.finance-tab { display: none; }
.finance-tab.active { display: block; animation: fadeIn 0.25s ease; }

.month-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 16px;
  margin: 12px 0 16px;
}
.month-selector .month-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 16px;
  flex-shrink: 0;
}
.month-selector .month-label {
  flex: 1;
  text-align: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.finance-balance-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: white;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}
.finance-balance-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
  margin-bottom: 6px;
}
.finance-balance-value {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.finance-balance-value.negative { color: #ffd6d6; }
.finance-balance-detail { font-size: 12px; opacity: 0.85; margin-top: 6px; }

.finance-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.finance-stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.finance-stat-card.income { border-left: 3px solid var(--success); }
.finance-stat-card.expense { border-left: 3px solid var(--error); }
.finance-stat-icon { font-size: 20px; margin-bottom: 6px; }
.finance-stat-label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.finance-stat-value { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-top: 2px; }

/* Transaction list */
.tx-day-group { margin-bottom: 16px; }
.tx-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px 8px;
  font-size: 13px;
}
.tx-day-label { color: var(--ink-soft); font-weight: 500; }
.tx-day-net { font-weight: 700; font-variant-numeric: tabular-nums; }
.tx-day-net.positive { color: var(--success); }
.tx-day-net.negative { color: var(--error); }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 6px;
  transition: transform 0.15s, background 0.15s;
  cursor: pointer;
}
.tx-item:active { transform: scale(0.98); background: var(--surface-2); }
.tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-label { font-weight: 600; font-size: 14px; }
.tx-note { font-size: 12px; color: var(--ink-light); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--error); }

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cat-btn {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-btn.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
  transform: scale(1.04);
}
.cat-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin: 0 auto 4px;
}
.cat-btn-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}

/* FAB (Floating Action Button) Expandable */
.fab-container {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  right: 20px;
  z-index: 90;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.fab-container.show { display: flex; }

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 300;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.fab:active { transform: scale(0.92); }
.fab.expanded { transform: rotate(45deg); background: var(--ink); }

.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(8px) scale(0.95);
  transform-origin: bottom right;
}
.fab-menu.expanded {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.fab-action {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 8px 16px 8px 8px;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s;
}
.fab-action:active { transform: scale(0.96); }
.fab-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.fab-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
