/* Me App — putih & hijau botol, bergaya buku agenda pribadi. */

:root {
  --botol: #0A5C43;        /* hijau botol utama */
  --botol-strong: #084A36;
  --botol-deep: #06412F;   /* header */
  --botol-ink: #05372A;
  --tint: #E9F3EE;         /* permukaan hijau muda */
  --tint-2: #F3F8F5;
  --bg: #F7FAF8;
  --paper: #FFFFFF;
  --ink: #17281F;
  --muted: #5F7269;
  --line: #DBE7E0;
  --cream: #F3FAF6;
  --amber: #94660F; --amber-bg: #FBF2DD; --amber-line: #E8D5A8;
  --red: #A93A30; --red-bg: #FBEBE8; --red-line: #ECC3BC;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(6, 65, 47, .06), 0 6px 18px -8px rgba(6, 65, 47, .12);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: var(--botol-deep);
  color: var(--cream);
}
.brand {
  font-family: var(--display);
  font-size: 22px; letter-spacing: .02em;
}
.brand em { font-style: italic; font-weight: 400; opacity: .85; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid rgba(243, 250, 246, .25);
  background: transparent; color: var(--cream);
}
.icon-btn:hover { background: rgba(243, 250, 246, .12); }

/* ---------- Navigasi ---------- */
.nav {
  position: sticky; top: 62px; z-index: 20;
  display: flex; gap: 6px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.nav-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); white-space: nowrap; font-weight: 500;
}
.nav-item .nav-ico { font-size: 14px; }
.nav-item.active {
  background: var(--botol); border-color: var(--botol); color: #fff;
}

/* ---------- Konten ---------- */
.main { max-width: 1020px; margin: 0 auto; padding: 22px 16px 100px; }

.page-head { margin: 4px 2px 18px; }
.page-date {
  font-family: var(--display);
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.15;
  color: var(--botol-ink);
}
.page-sub { color: var(--muted); margin-top: 2px; }
.rule-double {
  height: 6px; margin-top: 12px;
  border-top: 1px solid var(--botol);
  border-bottom: 1px solid var(--botol);
  opacity: .5;
}

.grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Kartu bergaya halaman agenda: punggung hijau di kiri */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--botol);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-title {
  font-family: var(--display);
  font-size: 18px; color: var(--botol-ink);
  display: flex; align-items: center; gap: 8px;
}
.card-title .emo { font-size: 16px; }

/* ---------- Elemen umum ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink);
  padding: 8px 14px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: var(--tint-2); }
.btn-primary { background: var(--botol); border-color: var(--botol); color: #fff; }
.btn-primary:hover { background: var(--botol-strong); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--botol); }
.btn-ghost:hover { background: var(--tint); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: var(--paper);
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--botol); outline-offset: 1px;
}
textarea { resize: vertical; min-height: 120px; }
label { display: block; font-weight: 600; font-size: 13.5px; color: var(--botol-ink); }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--tint-2); color: var(--muted);
}
.badge-ok { background: var(--tint); border-color: #BFDCCF; color: var(--botol-strong); }
.badge-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.badge-late { background: var(--red-bg); border-color: var(--red-line); color: var(--red); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty {
  color: var(--muted); text-align: center;
  padding: 18px 10px; border: 1.5px dashed var(--line);
  border-radius: 10px; background: var(--tint-2);
}

/* Navigasi tanggal ‹ hari › */
.datebar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.datebar .btn { padding: 7px 11px; }
.datebar input[type="date"] { width: auto; }
.datebar .today-link { margin-left: auto; }

/* ---------- Daftar to-do ---------- */
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: var(--paper);
}
.todo-item.done { background: var(--tint-2); }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-check {
  flex: 0 0 auto; width: 22px; height: 22px;
  border-radius: 7px; border: 2px solid var(--botol);
  background: var(--paper); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; padding: 0;
}
.todo-item.done .todo-check { background: var(--botol); }
.todo-title { flex: 1; word-break: break-word; }
.row-actions { display: flex; gap: 4px; }
.mini-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 4px 6px; border-radius: 7px; font-size: 14px;
}
.mini-btn:hover { background: var(--tint); color: var(--botol-strong); }

.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1; }

/* ---------- Blok waktu ---------- */
.block-list { display: grid; gap: 8px; }
.block-item {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--paper);
}
.block-item.done { background: var(--tint-2); }
.block-item.done .block-title { text-decoration: line-through; color: var(--muted); }
.block-time {
  flex: 0 0 auto; text-align: center; min-width: 58px;
  font-variant-numeric: tabular-nums;
  border-right: 2px solid var(--tint); padding-right: 12px;
  color: var(--botol-strong); font-weight: 700; font-size: 13.5px;
}
.block-time .sep { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.block-body { flex: 1; }
.block-title { font-weight: 600; }
.block-note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.block-form {
  display: grid; gap: 10px; grid-template-columns: 1fr 1fr;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.block-form .full { grid-column: 1 / -1; }

/* ---------- Jurnal ---------- */
.mood-row { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.mood-btn {
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 10px; padding: 6px 10px; font-size: 18px;
}
.mood-btn.active { border-color: var(--botol); background: var(--tint); }
.journal-day-list { display: grid; gap: 8px; margin-top: 14px; }
.journal-day {
  display: flex; gap: 12px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); padding: 10px 12px;
  cursor: pointer;
}
.journal-day:hover { background: var(--tint-2); }
.journal-day.selected { border-color: var(--botol); background: var(--tint); }
.journal-day .jd-date { font-weight: 700; color: var(--botol-strong); min-width: 72px; font-size: 13.5px; }
.journal-day .jd-prev {
  flex: 1; color: var(--muted); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.save-note { font-size: 12.5px; color: var(--muted); }

/* ---------- Tagihan ---------- */
.bill-list { display: grid; gap: 10px; }
.bill-item {
  border: 1px solid var(--line); border-left: 4px solid var(--botol);
  border-radius: 12px; background: var(--paper); padding: 12px 14px;
}
.bill-item.paid { border-left-color: #9CC5B3; }
.bill-item.warn { border-left-color: var(--amber); }
.bill-item.late { border-left-color: var(--red); }
.bill-item.inactive { opacity: .6; border-left-color: var(--line); }
.bill-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bill-name { font-weight: 700; font-size: 15.5px; }
.bill-cat { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.bill-amount { margin-left: auto; font-weight: 700; color: var(--botol-ink); font-variant-numeric: tabular-nums; }
.bill-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.bill-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.bill-history { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.bill-history table { width: 100%; border-collapse: collapse; }
.bill-history td { padding: 3px 0; border-bottom: 1px solid var(--tint); }
.bill-history td:last-child { text-align: right; }

.bill-form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.bill-form .full { grid-column: 1 / -1; }

/* ---------- Pengaturan ---------- */
.settings-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .settings-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--tint); font-size: 14px; }
.kv b { color: var(--botol-ink); }
.notif-log { display: grid; gap: 8px; }
.notif-item {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: var(--paper); font-size: 13px;
}
.notif-item pre {
  margin: 6px 0 0; white-space: pre-wrap; word-break: break-word;
  font: 12.5px/1.5 var(--body); color: var(--ink);
  background: var(--tint-2); border-radius: 8px; padding: 8px 10px;
}

/* ---------- Auth ---------- */
.auth {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 380px at 85% -10%, rgba(10, 92, 67, .16), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--paper); border: 1px solid var(--line);
  border-top: 5px solid var(--botol);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 26px 24px;
}
.auth-brand {
  font-family: var(--display); font-size: 32px; color: var(--botol-ink);
  text-align: center;
}
.auth-brand em { font-style: italic; color: var(--botol); }
.auth-sub { text-align: center; color: var(--muted); margin: 6px 0 18px; }
.auth-card label { margin-bottom: 12px; }
.auth-error {
  background: var(--red-bg); border: 1px solid var(--red-line); color: var(--red);
  border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 0 0 12px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  z-index: 100;
  background: var(--botol-ink); color: #fff;
  border-radius: 999px; padding: 10px 18px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(5, 55, 42, .35);
  max-width: min(92vw, 480px); text-align: center;
}
.toast.error { background: #7E2B23; }

/* ---------- Mobile: navigasi di bawah ---------- */
@media (max-width: 700px) {
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    border-top: 1px solid var(--line); border-bottom: none;
    background: var(--paper);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-between; gap: 2px;
  }
  .nav-item {
    flex: 1; flex-direction: column; gap: 2px;
    padding: 6px 2px; font-size: 10.5px; border: none; background: transparent;
    color: var(--muted); border-radius: 10px;
  }
  .nav-item .nav-ico { font-size: 18px; }
  .nav-item.active { background: var(--tint); color: var(--botol-strong); }
  .main { padding-bottom: 130px; }
  .block-form, .bill-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .card { transition: box-shadow .15s ease; }
  .toast { animation: pop .18s ease; }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }
}
