/* tracbit — mobile-first, dark theme */
:root {
  --bg1: #1e1b4b;
  --bg2: #0f172a;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.10);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #7c3aed;
  --accent2: #db2777;
  --ok: #22c55e;
  --danger: #ef4444;
  --radius: 18px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding: 16px 14px 48px;
}

.wrap { max-width: 620px; margin: 0 auto; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 13px; color: var(--muted); }
.brand {
  color: var(--text); text-decoration: none; font-weight: 800;
  font-size: 20px; display: flex; align-items: center; gap: 8px;
}
.brand-ico { font-size: 24px; }
.btn-logout {
  background: rgba(255, 255, 255, 0.08); color: var(--muted);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 8px 16px; font-size: 14px; cursor: pointer;
}

/* ── Flash ── */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flash {
  padding: 12px 16px; border-radius: 12px; font-size: 15px;
  background: var(--card); border: 1px solid var(--card-border);
}
.flash-success { border-color: rgba(34, 197, 94, 0.5); color: #bbf7d0; }
.flash-danger  { border-color: rgba(239, 68, 68, 0.5);  color: #fecaca; }
.flash-warning { border-color: rgba(245, 158, 11, 0.5); color: #fde68a; }
.flash-info    { border-color: rgba(96, 165, 250, 0.5); color: #bfdbfe; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
}

/* ── Summary ── */
.summary-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.summary-date { font-weight: 700; font-size: 17px; }
.summary-text { color: var(--muted); font-size: 14px; margin-top: 2px; }
.summary-pct {
  font-size: 26px; font-weight: 800; color: var(--accent2);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.bar {
  height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  margin-top: 12px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s ease;
}

/* ── Add habit ── */
.add-summary {
  font-weight: 700; font-size: 16px; cursor: pointer;
  list-style: none; padding: 4px 0;
}
.add-summary::-webkit-details-marker { display: none; }
.add-card[open] .add-summary { margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field.grow { flex: 1 1 100%; }
.w-emoji { flex: 0 0 74px; }
.w-color { flex: 0 0 62px; }
.w-target { flex: 1 1 120px; }
.lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border); border-radius: 12px;
  color: var(--text); padding: 12px 14px; font-size: 16px; width: 100%;
}
.input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.input-emoji { text-align: center; font-size: 22px; }
.input-color {
  width: 100%; height: 46px; border: none; border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); padding: 4px; cursor: pointer;
}

/* ── Buttons ── */
.btn-primary {
  width: 100%; border: none; cursor: pointer; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 800; font-size: 17px;
  padding: 15px; min-height: 52px;
}
.btn-primary:active { transform: scale(0.98); }
.btn-lg { padding: 18px; font-size: 18px; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.08); color: var(--text);
  border: 1px solid var(--card-border); border-radius: 14px;
  padding: 14px 20px; font-size: 16px; font-weight: 700;
  text-decoration: none; text-align: center; flex: 1;
}
.btn-danger {
  width: 100%; margin-top: 18px; padding: 14px;
  background: rgba(239, 68, 68, 0.12); color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4); border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}

/* ── Habit card ── */
.habit-top { display: flex; align-items: center; gap: 12px; }
.habit-emoji { font-size: 34px; line-height: 1; }
.habit-info { flex: 1; min-width: 0; }
.habit-nama { font-weight: 800; font-size: 17px; word-break: break-word; }
.habit-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.streak { color: #fdba74; }
.dot { opacity: 0.5; margin: 0 4px; }
.habit-edit {
  text-decoration: none; font-size: 18px; opacity: 0.65;
  padding: 8px; border-radius: 10px;
}
.habit-edit:active { background: rgba(255, 255, 255, 0.1); }

.check-btn {
  width: 100%; margin-top: 12px; min-height: 58px;
  border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.25);
  background: transparent; color: var(--muted);
  font-size: 17px; font-weight: 800; cursor: pointer;
}
.check-btn.done {
  border: 2px solid var(--warna);
  background: color-mix(in srgb, var(--warna) 22%, transparent);
  color: var(--text);
}
.check-btn:active { transform: scale(0.98); }

/* ── 30-day grid ── */
.grid30 {
  display: grid; grid-template-columns: repeat(15, 1fr);
  gap: 4px; margin-top: 14px;
}
.cell {
  aspect-ratio: 1; border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
}
.cell.done { background: var(--warna); }
.cell.today { outline: 2px solid rgba(255, 255, 255, 0.75); outline-offset: 1px; }

/* ── Empty ── */
.empty { text-align: center; padding: 40px 20px; }
.empty-ico { font-size: 48px; margin-bottom: 10px; }
.empty p { color: var(--muted); font-size: 15px; line-height: 1.6; }

/* ── Login ── */
.login-card {
  max-width: 400px; margin: 12vh auto 0; text-align: center;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 24px; padding: 36px 24px;
}
.login-ico { font-size: 56px; }
.login-title { font-size: 30px; font-weight: 800; margin-top: 8px; }
.login-sub { color: var(--muted); font-size: 15px; margin: 6px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.pin-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border); border-radius: 14px;
  color: var(--text); font-size: 28px; letter-spacing: 0.5em;
  text-align: center; padding: 16px; width: 100%;
}
.pin-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-alt { margin-top: 18px; font-size: 14px; color: var(--muted); }
.login-alt a { color: #c4b5fd; text-decoration: none; font-weight: 700; }

/* ── Edit ── */
.edit-title { font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.edit-actions { display: flex; gap: 10px; margin-top: 6px; }
.toggle-field { margin-bottom: 16px; }

/* ── XP / Level ── */
.xp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.xp-level { display: flex; align-items: center; gap: 10px; }
.level-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 800; font-size: 15px;
  padding: 6px 14px; border-radius: 999px;
}
.xp-num { font-weight: 800; font-size: 17px; }
.xp-stats { display: flex; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.xp-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.xp-next { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── Badges ── */
.badges { margin-top: 14px; }
.badges summary {
  cursor: pointer; list-style: none; font-weight: 700; font-size: 14px;
  padding: 6px 0; color: var(--muted);
}
.badges summary::-webkit-details-marker { display: none; }
.badge-count {
  background: rgba(255,255,255,0.1); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; margin-left: 6px;
}
.badges-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.badge {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 10px 4px;
}
.badge-emoji { font-size: 24px; line-height: 1; }
.badge-nama { font-size: 11px; color: var(--muted); text-align: center; }
.badge.locked { opacity: 0.45; filter: grayscale(0.8); }

/* ── Coach AI ── */
.fab {
  position: fixed; right: 18px; bottom: 22px; z-index: 60;
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 27px; font-weight: 800;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(0.94); }

.coach-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  max-width: 620px; margin: 0 auto;
  background: #16132b; border: 1px solid var(--card-border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  transform: translateY(105%); transition: transform 0.28s ease;
  display: flex; flex-direction: column;
  max-height: min(78vh, 640px);
}
.coach-sheet.open { transform: translateY(0); }
.coach-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--card-border);
}
.coach-title { font-weight: 800; font-size: 16px; }
.coach-close {
  background: rgba(255,255,255,0.08); border: none; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%; font-size: 14px; cursor: pointer;
}
.chips { display: flex; gap: 8px; padding: 10px 14px; overflow-x: auto; }
.chip {
  flex: 0 0 auto; background: rgba(255,255,255,0.07);
  border: 1px solid var(--card-border); border-radius: 999px;
  color: var(--text); font-size: 13px; padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.chip:active { background: rgba(124,58,237,0.3); }
.coach-msgs {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 120px;
}
.msg {
  max-width: 86%; padding: 10px 14px; border-radius: 16px;
  font-size: 14.5px; line-height: 1.5; word-break: break-word;
}
.msg p { margin: 4px 0; }
.msg ul { margin: 4px 0 4px 18px; padding: 0; }
.msg li { margin: 3px 0; }
.msg strong { color: #fff; }
.msg.user {
  align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; border-bottom-right-radius: 6px;
}
.msg.ai {
  align-self: flex-start; background: rgba(255,255,255,0.08);
  border: 1px solid var(--card-border); border-bottom-left-radius: 6px;
}
.msg.typing { display: flex; gap: 5px; align-items: center; padding: 14px; }
.msg.typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite;
}
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.coach-form {
  display: flex; gap: 8px; padding: 10px 14px 16px;
  border-top: 1px solid var(--card-border);
}
.coach-form .input { flex: 1; }
.coach-send {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; color: #fff; border-radius: 12px;
  width: 52px; min-height: 52px; font-size: 18px; cursor: pointer;
}

/* ── Confetti ── */
.confetti {
  position: fixed; top: -14px; z-index: 100;
  width: 9px; height: 14px; border-radius: 2px;
  animation-name: confetti-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.6; }
}

/* ══════════════ Pengeluaran ══════════════ */
.topbar-link {
  text-decoration: none; font-size: 20px; line-height: 1;
  padding: 6px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--card-border);
}
.topbar-link:active { background: rgba(124, 58, 237, 0.3); }

.card-title { font-weight: 800; font-size: 16px; margin-bottom: 12px; }

.spend-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.spend-big {
  font-size: 34px; font-weight: 800; line-height: 1.15; margin: 4px 0 2px;
  background: linear-gradient(135deg, #34d399, #22d3ee);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.spend-big-sm { font-size: 23px; font-weight: 800; margin: 2px 0; color: #6ee7b7; }
.spend-sub { color: var(--muted); font-size: 13px; }
.spend-over-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.spend-target { font-size: 12px; color: var(--muted); margin-top: 6px; }
.spend-target-edit { color: #c4b5fd; font-weight: 700; text-decoration: none; margin-left: 4px; }

.spend-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-val { font-weight: 800; font-size: 15px; }

.spend-mini {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-left: 3px solid #34d399;
}
.spend-mini-info { min-width: 0; }
.spend-link { flex: 0 0 auto; text-decoration: none; padding: 10px 16px; }

.chart-tracks { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 116px; }
.chart-track {
  flex: 1; height: 100%; border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: flex; align-items: flex-end; overflow: hidden;
}
.chart-bar {
  width: 100%; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #22d3ee, #0ea5e9);
  min-height: 2px; transition: height 0.35s ease;
}
.chart-bar.active { background: linear-gradient(180deg, #34d399, #10b981); }
.chart-days { display: flex; gap: 4px; margin-top: 6px; }
.chart-day { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.chart-day.active { color: #6ee7b7; font-weight: 800; }
.avg-line { position: absolute; left: 0; right: 0; border-top: 1px dashed rgba(255, 255, 255, 0.45); pointer-events: none; }
.avg-line span {
  position: absolute; right: 0; top: 0; transform: translateY(-50%);
  background: #16132b; border: 1px solid var(--card-border); border-radius: 999px;
  padding: 1px 8px; font-size: 10px; color: var(--muted); white-space: nowrap;
}
.chart-note { font-size: 11px; color: var(--muted); margin-top: 10px; text-align: center; }

.kat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kat-chip input { position: absolute; opacity: 0; pointer-events: none; }
.kat-chip span {
  display: inline-block; background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border); border-radius: 999px;
  color: var(--text); font-size: 13.5px; padding: 9px 14px; cursor: pointer;
}
.kat-chip input:checked + span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; font-weight: 700;
}
.input-nominal { font-size: 22px; font-weight: 800; letter-spacing: 0.02em; }
.w-date { flex: 0 0 150px; }

.riwayat-hari { margin-bottom: 14px; }
.riwayat-hari:last-child { margin-bottom: 0; }
.riwayat-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 6px; border-bottom: 1px dashed var(--card-border); margin-bottom: 6px;
}
.riwayat-tgl { font-weight: 700; font-size: 13.5px; }
.riwayat-total { font-weight: 800; font-size: 13.5px; color: #6ee7b7; }
.riwayat-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.riwayat-emoji { font-size: 20px; line-height: 1; }
.riwayat-info { flex: 1; min-width: 0; }
.riwayat-kat {
  font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.riwayat-nom { font-weight: 700; font-size: 14px; white-space: nowrap; }
.row-del {
  background: rgba(239, 68, 68, 0.12); color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35); border-radius: 10px;
  width: 34px; height: 34px; font-size: 13px; cursor: pointer;
}
.row-del:active { transform: scale(0.94); }

.empty-inline { color: var(--muted); font-size: 14px; line-height: 1.6; text-align: center; padding: 10px 0; }
.spend-back { text-align: center; margin-top: 4px; }
.spend-back a { color: #c4b5fd; text-decoration: none; font-weight: 700; font-size: 14px; }

/* ── Pengeluaran v2: quick chips, breakdown, edit ── */
.quick-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.quick-chip {
  flex: 1; min-width: 60px; background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.25); border-radius: 12px;
  color: var(--text); font-size: 14px; font-weight: 700;
  padding: 10px 0; cursor: pointer;
}
.quick-chip:active { background: rgba(124, 58, 237, 0.35); }
.quick-clear { flex: 0 0 52px; font-weight: 400; }

.spend-compare { margin-top: 8px; font-size: 13px; font-weight: 600; }
.spend-compare.up { color: #fca5a5; }
.spend-compare.down { color: #6ee7b7; }
.stat-delta { font-size: 10.5px; font-weight: 600; }
.stat-delta.up { color: #fca5a5; }
.stat-delta.down { color: #6ee7b7; }

.bd-list { display: flex; flex-direction: column; gap: 10px; }
.bd-row { display: flex; align-items: center; gap: 10px; }
.bd-emoji { font-size: 20px; line-height: 1; }
.bd-info { flex: 1; min-width: 0; }
.bd-top { display: flex; justify-content: space-between; font-size: 13.5px; }
.bd-label { font-weight: 600; }
.bd-amount { font-weight: 700; }
.bd-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); margin-top: 5px; overflow: hidden; }
.bd-fill { height: 100%; border-radius: 999px; }
.bd-pct { font-size: 11.5px; color: var(--muted); width: 36px; text-align: right; }

.insight {
  margin-top: 12px; font-size: 12.5px; color: var(--muted);
  background: rgba(255, 255, 255, 0.04); border: 1px dashed var(--card-border);
  border-radius: 12px; padding: 9px 12px;
}

.edit-note { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; }
.edit-note a { color: #c4b5fd; font-weight: 700; text-decoration: none; }

.riwayat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.csv-link {
  font-size: 12px; color: #c4b5fd; text-decoration: none; font-weight: 700;
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 5px 12px; background: rgba(255, 255, 255, 0.06);
}
.row-edit {
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--card-border);
  border-radius: 10px; width: 34px; height: 34px; font-size: 14px;
  color: var(--text); cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
}
.row-edit:active { background: rgba(124, 58, 237, 0.35); }

/* ══════════════ Agenda ══════════════ */
.agenda-big {
  font-size: 26px; font-weight: 800; line-height: 1.2; margin: 4px 0 2px;
  background: linear-gradient(135deg, #c4b5fd, #f0abfc);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.agenda-overdue-txt { color: #fca5a5; font-weight: 700; }

.agenda-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--card-border);
}
.agenda-item:last-of-type { border-bottom: none; padding-bottom: 0; }
.agenda-check {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.25);
  color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1;
}
.agenda-check:active { transform: scale(0.94); }
.agenda-check.checked {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: transparent; color: #fff; font-weight: 800;
}
.agenda-item.done .agenda-judul { text-decoration: line-through; color: var(--muted); }
.agenda-info { flex: 1; min-width: 0; }
.agenda-judul { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.agenda-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.agenda-tgl.overdue { color: #fca5a5; font-weight: 700; }
.agenda-catatan { overflow-wrap: anywhere; }

.agenda-late-card { border-color: rgba(239, 68, 68, 0.4); }

.agenda-mini {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-left: 3px solid #c4b5fd;
}
.agenda-mini-info { min-width: 0; flex: 1; }
.agenda-mini-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.agenda-mini-list li { display: flex; gap: 8px; padding: 2px 0; min-width: 0; }
.agenda-mini-when { color: #c4b5fd; font-weight: 700; white-space: nowrap; }
.agenda-mini-judul { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-mini-overdue { margin-top: 6px; font-size: 12.5px; color: #fca5a5; font-weight: 700; }

/* ── Agenda v2: grup per hari (beberapa agenda dalam sehari = list) ── */
.agenda-grup { margin-bottom: 14px; }
.agenda-grup:last-child { margin-bottom: 0; }
.agenda-grup-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding-bottom: 6px; border-bottom: 1px dashed var(--card-border); margin-bottom: 2px;
}
.agenda-grup-when { font-weight: 700; font-size: 13.5px; }
.agenda-grup-head.overdue .agenda-grup-when { color: #fca5a5; }
.agenda-grup-count { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.agenda-grup .agenda-item { border-bottom: none; padding: 7px 0; }
.agenda-grup .agenda-item:last-of-type { padding-bottom: 0; }
.agenda-grup .agenda-item:first-of-type { padding-top: 4px; }

.agenda-mini-groups { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 0; }
.agenda-mini-group { min-width: 0; }
.agenda-mini-count { color: var(--muted); font-weight: 600; }
.agenda-mini-items { list-style: none; margin: 2px 0 0; padding: 0; font-size: 13px; }
.agenda-mini-items li { display: flex; gap: 6px; padding: 1px 0; min-width: 0; }
.agenda-mini-items li::before { content: "•"; color: var(--muted); flex: 0 0 auto; }
.agenda-mini-item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-mini-more { color: var(--muted); font-size: 12px; }

/* ── Agenda v3: jam, kartu hari ini, tombol pindah, badge topbar ── */
.agenda-today { border-left: 3px solid #a78bfa; }
.agenda-jam { color: #c4b5fd; font-weight: 700; }
.agenda-grup-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.agenda-move {
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--card-border);
  border-radius: 999px; color: #c4b5fd; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; cursor: pointer; white-space: nowrap;
}
.agenda-move:active { background: rgba(124, 58, 237, 0.35); }
.topbar-link { position: relative; }
.topbar-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: #fff; font-size: 10px; font-weight: 800; line-height: 16px;
  text-align: center; border-radius: 999px;
}
.input-area { min-height: 110px; resize: vertical; font-family: inherit; }
.w-time { flex: 0 0 110px; }

/* ── Agenda v4: tab tambah (Satu/Beberapa) + hint pengingat ── */
.add-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.add-tab {
  flex: 1; padding: 11px 8px; border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05); color: var(--muted);
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.add-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff;
}
.add-tab:active { transform: scale(0.98); }
#form-satu[hidden], #form-banyak[hidden] { display: none; }
.jam-hint {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--card-border);
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.jam-hint strong { color: #c4b5fd; }
.notif-test { margin-top: 8px; }

/* ── Agenda v5: berulang, penting, strip 7 hari, cari/filter, tanggal cepat ── */
.strip {
  display: flex; gap: 7px; margin-top: 12px; overflow-x: auto;
  padding-bottom: 2px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.05);
  color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none;
}
.strip-chip.today { border-color: rgba(167, 139, 250, 0.65); color: #c4b5fd; }
.strip-chip.ada { background: rgba(124, 58, 237, 0.22); color: #ddd6fe; }
.strip-chip.today.ada { background: rgba(124, 58, 237, 0.35); }
.strip-jumlah {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}
.sorot { animation: sorot 1.6s ease-out; }
@keyframes sorot {
  from { background-color: rgba(167, 139, 250, 0.30); }
  to { background-color: transparent; }
}
.agenda-grup, .agenda-today, #tambah { scroll-margin-top: 12px; }

.quick-dates { display: flex; gap: 7px; margin-top: 8px; flex-wrap: wrap; }
.qdate {
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 700;
}
.qdate.active {
  border-style: solid; border-color: rgba(167, 139, 250, 0.7);
  background: rgba(124, 58, 237, 0.25); color: #ddd6fe;
}
.qdate:active { transform: scale(0.97); }

.row-opsi { align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.w-ulang { flex: 1 1 130px; min-width: 120px; }
.fcheck {
  display: flex; align-items: center; gap: 7px; padding: 10px 12px;
  border: 1px solid var(--card-border); border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
  flex: 0 0 auto;
}
.fcheck input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.fcheck:has(input:checked) {
  color: #e2d9ff; border-color: rgba(167, 139, 250, 0.55);
  background: rgba(124, 58, 237, 0.18);
}

.tag-penting { color: #fda4af; font-weight: 800; margin-right: 2px; }
.tag-ulang {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: rgba(56, 189, 248, 0.16); color: #7dd3fc;
  font-size: 11px; font-weight: 700;
}

.today-head { display: flex; align-items: center; justify-content: space-between; }
.today-progress { font-size: 12.5px; font-weight: 800; color: #c4b5fd; }
.today-bar { margin: 2px 0 10px; }

.cari-card .input { margin-bottom: 9px; }
.filter-chips {
  display: flex; gap: 7px; overflow-x: auto;
  scrollbar-width: none; padding-bottom: 2px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--card-border); background: rgba(255, 255, 255, 0.05);
  color: var(--muted); font-size: 12.5px; font-weight: 700;
}
.filter-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff;
}
.filter-chip:active { transform: scale(0.97); }
.cari-info { margin-top: 9px; font-size: 12.5px; color: #c4b5fd; font-weight: 700; }

/* ══════════════════════════════════════════════════════════
   BERANDA «Hari Ini» — gabungan kebiasaan + pengeluaran + agenda
   ══════════════════════════════════════════════════════════ */
.hero-today { padding: 18px 16px; }
.hero-hello { font-size: 14.5px; color: var(--muted); margin-top: 2px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero-stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--card-border);
  border-radius: 14px; padding: 10px 6px; text-decoration: none; color: var(--text);
  transition: transform 0.12s ease, background 0.12s ease;
}
.hero-stat:active { transform: scale(0.97); background: rgba(124, 58, 237, 0.16); }
.hs-ico { font-size: 18px; line-height: 1.2; }
.hs-val { font-weight: 800; font-size: 16px; }
.hs-val-sm { font-size: 13.5px; }
.hs-lbl { font-size: 10.5px; color: var(--muted); text-align: center; }

.b-sec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.b-sec-title { font-weight: 800; font-size: 15.5px; }
.b-sec-link { font-size: 13px; color: #c4b5fd; text-decoration: none; font-weight: 700; white-space: nowrap; }
.b-sec-link:active { opacity: 0.7; }

.b-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.b-progress-row .bar { flex: 1; margin: 0; }
.b-progress-txt { font-size: 12.5px; font-weight: 800; color: #c4b5fd; flex: 0 0 auto; }

.q-list { list-style: none; margin: 0; padding: 0; }
.habit-q {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.habit-q:last-child { border-bottom: none; }
.habit-q form { flex: 0 0 auto; display: flex; }
.q-check {
  width: 36px; height: 36px; border-radius: 50%; padding: 0;
  border: 2px solid var(--warna, var(--accent)); background: transparent;
  color: var(--warna, var(--accent)); font-size: 17px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.q-check:active { transform: scale(0.9); }
.habit-q.done .q-check { background: var(--warna, var(--accent)); color: #0b1020; }
.habit-q.done .q-nama { text-decoration: line-through; color: var(--muted); }
.q-emoji { font-size: 18px; flex: 0 0 auto; }
.q-info { flex: 1; min-width: 0; }
.q-nama { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.q-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty-note { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.empty-note a { color: #c4b5fd; font-weight: 700; text-decoration: none; }

.mini-check-form { display: inline-flex; flex: 0 0 auto; }
.mini-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(167, 139, 250, 0.7);
  background: transparent; color: #c4b5fd; font-size: 12px; font-weight: 800;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
}
.mini-check:active { transform: scale(0.88); }

.mini-add { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.07); padding-top: 9px; }
.mini-add summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: #c4b5fd; list-style: none; }
.mini-add summary::-webkit-details-marker { display: none; }
.mini-add[open] summary { margin-bottom: 10px; }

.b-spend-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.b-entries {
  list-style: none; margin: 9px 0 0; padding: 0; font-size: 13px;
  display: flex; flex-direction: column; gap: 4px;
}
.b-entries li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.be-tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.be-nom { font-weight: 700; flex: 0 0 auto; }

@media (max-width: 359px) {
  .hs-val-sm { font-size: 11.5px; }
  .hs-lbl { font-size: 9.5px; }
}

/* ── v6: rekap uang di beranda ── */
.b-rekap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.br-item {
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.br-lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.br-val { font-weight: 800; font-size: 13.5px; overflow-wrap: anywhere; }
.br-sub { font-size: 10.5px; color: var(--muted); }

/* ── v6: per bulan (halaman pengeluaran) ── */
.stat-note { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.bulan-list { display: flex; flex-direction: column; gap: 13px; }
.bulan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; }
.bulan-label { font-weight: 700; }
.bulan-amount { font-weight: 800; }
.bulan-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); margin-top: 6px; overflow: hidden; }
.bulan-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.bulan-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ── v6: rekap minggu di halaman kebiasaan ── */
.summary-week { font-size: 12.5px; color: #c4b5fd; font-weight: 700; margin-top: 6px; }

/* ── v6: tombol geser agenda (⏩ / →) ── */
.row-geser {
  background: rgba(124, 58, 237, 0.18); border: 1px solid rgba(167, 139, 250, 0.45);
  color: #ddd6fe; border-radius: 10px; padding: 5px 9px;
  font-size: 13px; line-height: 1; cursor: pointer;
}
.row-geser:active { transform: scale(0.93); }

/* ══════════════════════════════════════════════════════════
   v7 — MEMPERMUDAH: backfill tanggal, ulang terakhir, semua beres
   ══════════════════════════════════════════════════════════ */
.semua-form { margin-top: 10px; }
.btn-semua { width: 100%; }
.backfill { margin-top: 8px; }
.backfill summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--muted);
  list-style: none; padding: 2px 0;
}
.backfill summary::-webkit-details-marker { display: none; }
.backfill[open] summary { color: #c4b5fd; margin-bottom: 8px; }
.backfill-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.backfill-form .input-date { flex: 1 1 140px; padding: 9px 10px; font-size: 14px; }
.backfill-form .btn-ghost { flex: 0 0 auto; padding: 9px 12px; font-size: 13px; }
.ulang-row { margin-bottom: 10px; }
.btn-ulang { display: block; text-align: center; font-size: 13px; padding: 9px 12px; }
.be-edit { color: var(--muted); text-decoration: none; font-size: 14px; flex: 0 0 auto; }
.be-edit:active { opacity: 0.6; }
.be-del-form { flex: 0 0 auto; display: flex; }
.be-del { background: none; border: none; color: #f87171; font-size: 14px; cursor: pointer; padding: 0 2px; }
.quick-ulang { font-weight: 700; }

/* ── P0: jadwal habit, libur, backup (19 Okt 2026) ───────── */
.hari-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.chip-hari { position: relative; cursor: pointer; }
.chip-hari input { position: absolute; opacity: 0; pointer-events: none; }
.chip-hari span {
  display: inline-block; padding: 7px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--card-border);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.chip-hari input:checked + span {
  background: rgba(124,58,237,0.35); border-color: var(--accent); color: var(--text);
}
.tag-jadwal {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: rgba(124,58,237,0.18); font-size: 11px; color: #c4b5fd;
}
.libur-form { margin-top: 8px; }
.btn-libur {
  width: 100%; padding: 9px 12px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px dashed var(--card-border);
  color: var(--muted); font-size: 13px; font-weight: 600; font-family: inherit;
}
.btn-libur.active { background: rgba(34,197,94,0.16); border-color: var(--ok); color: #bbf7d0; }
.q-libur { margin-left: auto; }
.q-libur-btn {
  background: none; border: 0; font-size: 16px; padding: 4px 6px; cursor: pointer;
  opacity: 0.35; border-radius: 8px;
}
.q-libur-btn.active { opacity: 1; background: rgba(34,197,94,0.18); }

.backup-link-card { text-align: center; margin-top: 14px; }
.backup-link-card .btn-ghost { display: inline-block; text-decoration: none; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 8px; }
.hint-aman { border-top: 1px solid var(--card-border); padding-top: 10px; }
.backup-card { margin-bottom: 14px; }
.ringkas-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.ringkas-item {
  background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px 6px;
  text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.ringkas-n { font-size: 20px; font-weight: 800; }
.ringkas-l { font-size: 11px; color: var(--muted); }
.btn-blok { display: block; text-align: center; text-decoration: none; }
.preview-box { margin-top: 12px; }
.preview-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.preview-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 13px; }
.preview-table th, .preview-table td {
  padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--card-border);
}
.preview-table th { color: var(--muted); font-weight: 600; }
.fcheck { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
