/* Dapur Kita — light, dominan putih, aksen pastel tipis */
:root {
  --bg: #fbfbfd;
  --card: #ffffff;
  --text: #2b2d42;
  --muted: #8d92a8;
  --line: #eef0f6;
  --primary: #6f7bff;
  --primary-soft: #eef0ff;
  --primary-text: #ffffff;
  --danger: #e5566d;
  --danger-soft: #fff1f3;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(40, 44, 80, 0.04), 0 6px 20px rgba(40, 44, 80, 0.05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 0.95rem; font-weight: 700; margin-top: 18px; }
p { margin: 0 0 12px; }
code { background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 10px; }
.big-emoji { font-size: 2.6rem; line-height: 1.2; margin-bottom: 8px; }

/* ---------- Kartu tengah (login, onboarding) ---------- */
.center-card {
  max-width: 400px;
  margin: 12vh auto 0;
  padding: 32px 24px;
  width: calc(100% - 32px);
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-form { display: flex; gap: 8px; }
.join-form input { flex: 1; text-transform: uppercase; letter-spacing: 0.12em; text-align: center; }

.link-btn {
  margin-top: 18px; background: none; border: none; padding: 4px;
  color: var(--muted); font-size: 0.85rem; cursor: pointer; text-decoration: underline;
}

/* ---------- Tombol & input ---------- */
.btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.soft { background: var(--primary-soft); border-color: var(--primary-soft); color: #4b57d6; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn.danger-soft { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.btn.wide { width: 100%; }

input[type="text"], select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  min-width: 0;
}
input[type="text"]::placeholder { color: #b3b7c8; }
input[type="text"]:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.btn:focus-visible, .tab:focus-visible, .icon-btn:focus-visible, .check:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--muted);
  width: 32px; height: 32px; border-radius: 10px; font-size: 1.3rem; line-height: 1;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--text); }
.icon-btn.round { border: 1px solid var(--line); background: #fff; font-size: 1.2rem; }

/* ---------- Header ---------- */
.topbar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, #8fe3b5, #86cdf7, #c0acf8, #f7a9c6, #f8c294, #f4d978);
}
.brand { font-weight: 800; font-size: 1.15rem; }
.top-actions { display: flex; align-items: center; gap: 12px; }

.avatars { display: flex; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #fff; margin-left: -8px;
  object-fit: cover; background: var(--primary-soft);
}
.avatars .avatar:first-child { margin-left: 0; }
.avatar.initial { display: inline-grid; place-content: center; font-weight: 800; font-size: 0.85rem; color: #4a4e69; }

/* ---------- Tab ---------- */
.tabs {
  display: flex; gap: 8px; justify-content: center;
  padding: 12px 16px 0; max-width: 760px; margin: 0 auto;
}
.tab {
  flex: 1; max-width: 260px;
  padding: 10px 14px; border-radius: 14px;
  border: 1.5px solid transparent; background: transparent;
  color: var(--muted); font-weight: 700; cursor: pointer;
}
.tab:hover { background: #f4f5fa; }
.tab.active { background: var(--primary-soft); color: #4b57d6; }

.container { max-width: 760px; margin: 0 auto; padding: 16px 16px 80px; }

/* ---------- Kategori (warna pastel) ---------- */
[data-cat="sayur"]   { --cat-bg: #e4f7ec; --cat-fg: #2f8a58; }
[data-cat="lauk"]    { --cat-bg: #ffeae1; --cat-fg: #c0592f; }
[data-cat="susu"]    { --cat-bg: #e4f2ff; --cat-fg: #2f6fb0; }
[data-cat="roti"]    { --cat-bg: #fff4d4; --cat-fg: #9a7410; }
[data-cat="bumbu"]   { --cat-bg: #f1e9ff; --cat-fg: #7050bd; }
[data-cat="camilan"] { --cat-bg: #ffe7f1; --cat-fg: #b94874; }
[data-cat="anak"]    { --cat-bg: #dff7f6; --cat-fg: #218580; }
[data-cat="rumah"]   { --cat-bg: #eef0f6; --cat-fg: #5e647c; }
[data-cat="lain"]    { --cat-bg: #f3f3f6; --cat-fg: #707489; }

/* ---------- Belanja ---------- */
.add-card {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.add-card .grow-2 { flex: 1 1 100%; }
.add-card .qty-input { flex: 1 1 90px; }
.add-card select { flex: 2 1 140px; }
.add-card .btn { flex: 1 1 100px; }
@media (min-width: 640px) {
  .add-card .grow-2 { flex: 3 1 200px; }
  .add-card .qty-input { flex: 1 1 90px; max-width: 110px; }
  .add-card select { flex: 1 1 150px; }
  .add-card .btn { flex: 0 0 auto; }
}

.progress-row { display: grid; gap: 6px; margin: 16px 2px 8px; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, #86cdf7, #c0acf8);
  transition: width 0.3s;
}
.progress-bar.done { background: linear-gradient(90deg, #8fe3b5, #6fd3cf); }

.group { margin-top: 18px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.chip {
  background: var(--cat-bg); color: var(--cat-fg);
  padding: 4px 12px; border-radius: 99px; font-weight: 800; font-size: 0.85rem;
}
.count { color: var(--muted); font-size: 0.8rem; font-weight: 700; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px 10px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px;
}
.item-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.qty {
  font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 99px;
  background: var(--cat-bg); color: var(--cat-fg);
}
.by { font-size: 0.75rem; color: var(--muted); }
.item .del { opacity: 0.45; }
.item:hover .del, .item .del:focus-visible { opacity: 1; }
.item.is-done .item-name { text-decoration: line-through; color: var(--muted); }
.item.is-done { background: #fcfcfe; }

.check {
  appearance: none; -webkit-appearance: none;
  width: 24px; height: 24px; border-radius: 50%; margin: 0; flex: none; cursor: pointer;
  border: 2px solid var(--cat-fg, #b8bccc); background: #fff;
  display: grid; place-content: center;
}
.check::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px); opacity: 0;
}
.check:checked { background: var(--cat-fg, #8d92a8); }
.check:checked::after { opacity: 1; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

.done-box { margin-top: 24px; padding: 4px 14px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.done-box summary { cursor: pointer; font-weight: 700; padding: 10px 0; color: var(--muted); }
.done-box .items { margin-bottom: 12px; }

/* ---------- Menu mingguan ---------- */
.week-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.week-label { flex: 1; min-width: 140px; text-align: center; display: grid; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }

.day-0 { --day: #8fe0b5; --day-bg: #f0faf5; }
.day-1 { --day: #86cdf7; --day-bg: #f0f8ff; }
.day-2 { --day: #c0acf8; --day-bg: #f6f2ff; }
.day-3 { --day: #f7a9c6; --day-bg: #fff0f6; }
.day-4 { --day: #f8c294; --day-bg: #fff5ed; }
.day-5 { --day: #f4d978; --day-bg: #fffaea; }
.day-6 { --day: #78d8d3; --day-bg: #ecfaf9; }

.day-card {
  background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--day);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.day-card.is-today { box-shadow: 0 0 0 2px var(--day), var(--shadow); }
.day-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; background: var(--day-bg); }
.day-head h3 { margin: 0; font-size: 1rem; }
.day-date { color: var(--muted); font-size: 0.8rem; flex: 1; }
.today-badge { font-size: 0.7rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: var(--day); color: #fff; }

.slot { display: grid; gap: 4px; padding: 8px 14px; }
.slot:last-child { padding-bottom: 14px; }
.slot-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.slot input { width: 100%; background: #fafbfe; border-color: transparent; }
.slot input:hover { border-color: var(--line); }
.slot input:focus { background: #fff; }

/* ---------- Dialog ---------- */
dialog {
  border: none; border-radius: 24px; padding: 24px;
  width: calc(100% - 32px); max-width: 380px;
  box-shadow: 0 20px 60px rgba(30, 32, 60, 0.18);
  color: var(--text);
}
dialog::backdrop { background: rgba(30, 32, 60, 0.25); }
.code-box { display: grid; gap: 10px; justify-items: center; margin: 14px 0; }
.code {
  width: 100%; text-align: center; font-size: 1.9rem; font-weight: 800;
  letter-spacing: 0.18em; padding: 14px 8px; border-radius: 16px;
  background: var(--primary-soft); color: #4b57d6;
}
.member-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.member-list li { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.member-list .avatar { margin-left: 0; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 18px; border-radius: 14px; background: #fff; color: var(--text);
  border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(30, 32, 60, 0.15);
  font-weight: 700; font-size: 0.9rem; z-index: 50;
}

@media (max-width: 420px) {
  .brand { font-size: 1rem; }
  .topbar { padding-inline: 14px; }
}
