/* ===== Tema biru langit ===== */
:root {
  --bg: #eef7fd;
  --bg-2: #e0f2fe;
  --card: #ffffff;
  --card-2: #f5fbff;
  --text: #0c2a43;
  --muted: #5b7b93;
  --line: #d6e9f6;
  --sky: #0ea5e9;
  --sky-dark: #0284c7;
  --sky-deep: #0369a1;
  --sky-soft: #e0f2fe;
  --sky-glow: rgba(14, 165, 233, .28);
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --protein: #6366f1;
  --carb: #06b6d4;
  --fat: #f59e0b;
  --hero: linear-gradient(140deg, #38bdf8 0%, #0ea5e9 45%, #2563eb 100%);
  --shadow: 0 1px 2px rgba(12, 74, 110, .06), 0 8px 24px rgba(12, 74, 110, .07);
  --shadow-lg: 0 12px 32px rgba(2, 132, 199, .25);
  --radius: 20px;
  --nav-h: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07131f;
    --bg-2: #0b1d2e;
    --card: #0f2236;
    --card-2: #132a42;
    --text: #e6f3fc;
    --muted: #8eacc4;
    --line: #1d3a55;
    --sky: #38bdf8;
    --sky-dark: #0ea5e9;
    --sky-deep: #7dd3fc;
    --sky-soft: #0c3350;
    --sky-glow: rgba(56, 189, 248, .25);
    --danger-soft: #3b1418;
    --amber-soft: #3a2a0a;
    --hero: linear-gradient(140deg, #0284c7 0%, #0369a1 50%, #1e3a8a 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 50% -200px, var(--bg-2), transparent);
  background-attachment: fixed;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.error:empty { display: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h3 { font-size: 16px; font-weight: 700; }

/* ===== Form ===== */
input, select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* cegah auto-zoom iOS */
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b7b93' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 38px;
}
input:focus, select:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 4px var(--sky-glow); }
input::placeholder { color: var(--muted); opacity: .7; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
label input, label select { margin-top: 6px; }
.row { display: flex; gap: 10px; align-items: end; }
.row > * { flex: 1; min-width: 0; }

/* ===== Tombol ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  transition: transform .1s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 6px 16px var(--sky-glow); }
.btn.soft { background: var(--sky-soft); color: var(--sky-deep); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.danger-text { color: var(--danger); }
.btn.full { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; box-shadow: none; }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--sky-soft); color: var(--sky-deep); border: 0; border-radius: 99px;
  font: inherit; font-size: 13px; font-weight: 700; padding: 7px 12px 7px 9px; cursor: pointer;
}
.link-btn svg { width: 16px; height: 16px; stroke-width: 2.5; }
.round-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); color: #fff; cursor: pointer; backdrop-filter: blur(6px);
}
.round-btn:disabled { opacity: .35; }
.round-btn svg { width: 20px; height: 20px; stroke-width: 2.5; }

/* ===== Layout ===== */
#app { padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
/* Hanya opacity: transform di sini membuat elemen position:fixed (kolom chat) ikut menempel ke tab, bukan ke layar */
.tab { animation: tab-in .25s ease; }
@keyframes tab-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { padding: calc(22px + env(safe-area-inset-top)) 2px 16px; }
.page-head h2 { font-size: 26px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 12px; }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot.sky { background: var(--sky); }
.dot.red { background: var(--danger); }

/* ===== Login ===== */
.screen {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: var(--hero); color: #fff;
}
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box .logo img { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); }
.login-box h1 { font-size: 30px; font-weight: 800; margin-top: 14px; }
.login-box > p { opacity: .9; line-height: 1.5; margin: 8px 0 24px; }
.login-card {
  background: var(--card); color: var(--text); border-radius: 24px; padding: 22px; text-align: left;
  display: grid; gap: 14px; box-shadow: 0 20px 50px rgba(3, 49, 84, .35);
}
.login-card .btn.full { margin-top: 4px; }

/* ===== Hero (Hari ini) ===== */
.hero {
  margin: 0 -16px; padding: calc(18px + env(safe-area-inset-top)) 20px 26px;
  background: var(--hero); color: #fff;
  border-radius: 0 0 32px 32px; box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .1); pointer-events: none;
}
.hero::before { width: 240px; height: 240px; right: -80px; top: -90px; }
.hero::after { width: 160px; height: 160px; left: -60px; bottom: -80px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 1; }
.hello { margin: 0; opacity: .85; font-size: 14px; font-weight: 500; }
.demo-pill {
  display: inline-block; margin: 4px 0 2px; padding: 3px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, .22); font-size: 11.5px; font-weight: 700;
}
.hero-top h2 { font-size: 24px; font-weight: 800; }
.day-nav { display: flex; gap: 8px; }
.hero-body { display: flex; align-items: center; gap: 18px; margin-top: 18px; position: relative; z-index: 1; }
#ring { flex: 0 0 150px; }
#ring svg { width: 150px; height: 150px; stroke: none; fill: initial; }
.hero-stats { flex: 1; display: grid; gap: 10px; }
.stat { background: rgba(255, 255, 255, .16); border-radius: 14px; padding: 9px 12px; backdrop-filter: blur(6px); }
.stat small { display: block; font-size: 11.5px; opacity: .85; font-weight: 500; }
.stat b { font-size: 17px; font-weight: 800; }
.stat b span { font-size: 12px; font-weight: 600; opacity: .8; }

/* ===== Makro ===== */
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.macro { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: var(--shadow); }
.macro .name { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.macro .name i { width: 8px; height: 8px; border-radius: 50%; }
.macro .val { font-size: 18px; font-weight: 800; margin: 4px 0 8px; }
.macro .val span { font-size: 12px; font-weight: 600; color: var(--muted); }
.bar { height: 6px; background: var(--sky-soft); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* ===== Berdua ===== */
.couple { display: flex; gap: 10px; margin-top: 12px; }
.couple:empty { display: none; }
.pill {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--sky-soft); color: var(--sky-deep); font-weight: 800;
}
.pill.me .avatar { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; }
.pill .who { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .kc { font-size: 14px; font-weight: 800; }
.pill .kc span { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ===== Catatan makan ===== */
.meal { padding: 14px 16px 6px; }
.meal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.meal-icon { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; background: var(--sky-soft); }
.meal-head h3 { flex: 1; }
.meal-head .sum { font-weight: 800; color: var(--sky-deep); font-size: 15px; }
.log-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 2px; border-top: 1px dashed var(--line); cursor: pointer; }
.log-item:first-of-type { border-top: 0; }
.log-item .name { font-weight: 600; font-size: 14.5px; }
.log-item .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.log-item .kc { font-weight: 800; white-space: nowrap; }
.log-item .kc span { font-size: 12px; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.badge.ai { background: var(--amber-soft); color: #b45309; }
.empty {
  text-align: center; color: var(--muted); padding: 34px 20px; background: var(--card);
  border: 1.5px dashed var(--line); border-radius: var(--radius); line-height: 1.6;
}
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }
.empty b { color: var(--text); display: block; }

/* ===== Scan ===== */
.camera-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 260px; border-radius: 28px; cursor: pointer; color: #fff; text-align: center;
  background: var(--hero); box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.camera-btn::after { content: ""; position: absolute; inset: 14px; border: 2px dashed rgba(255, 255, 255, .45); border-radius: 20px; pointer-events: none; }
.camera-btn b { font-size: 19px; margin-top: 10px; }
.camera-btn span:last-child { opacity: .85; font-size: 14px; }
.cam-circle {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .22); animation: pulse 2.2s infinite;
}
.cam-circle svg { width: 40px; height: 40px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); } 70% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }
.gallery-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 14px;
  border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: var(--sky-deep);
  font-weight: 700; cursor: pointer; box-shadow: var(--shadow);
}
.hint-label { margin-top: 18px; }
.preview-wrap { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
#scan-preview {
  width: 100%; max-height: 320px; object-fit: contain; display: block; background: var(--card-2); cursor: pointer;
  transition: opacity .18s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
#scan-preview.swap { opacity: 0; transform: scale(.96); }
.crop-badge {
  position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: rgba(3, 49, 84, .65); color: #fff; backdrop-filter: blur(6px); pointer-events: none;
}
.scan-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  background: linear-gradient(transparent 40%, rgba(3, 49, 84, .7)); color: #fff; font-weight: 700;
}
.scanline {
  position: absolute; left: 0; right: 0; height: 3px; top: 0;
  background: linear-gradient(90deg, transparent, #7dd3fc, transparent); box-shadow: 0 0 18px 4px rgba(125, 211, 252, .7);
  animation: scan 1.6s ease-in-out infinite alternate;
}
@keyframes scan { to { top: calc(100% - 3px); } }

/* ===== Hasil scan ===== */
.scan-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--hero); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
  box-shadow: var(--shadow-lg);
}
.sum-main small { display: block; font-size: 12.5px; opacity: .9; font-weight: 600; }
.sum-main b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.sum-main b span { font-size: 14px; font-weight: 600; opacity: .85; }
.sum-macros { display: grid; gap: 4px; font-size: 12.5px; text-align: right; }
.sum-macros span { display: flex; align-items: center; justify-content: flex-end; gap: 6px; opacity: .95; }
.sum-macros i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .8); }
.ai-note {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: var(--sky-soft); color: var(--sky-deep); font-size: 13.5px;
}
.ai-note summary { cursor: pointer; font-weight: 700; list-style: none; }
.ai-note summary::-webkit-details-marker { display: none; }
.ai-note summary::after { content: " · lihat"; font-weight: 500; opacity: .75; }
.ai-note[open] summary::after { content: " · tutup"; }
.ai-note p { margin: 8px 0 2px; line-height: 1.5; }
#scan-list-head { margin-top: 16px; }

.scan-list { display: grid; gap: 10px; }
.scan-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  overflow: hidden; transition: border-color .2s;
}
.scan-row.open { border-color: var(--sky); }
.row-main {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 12px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row-main .thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--card-2); }
.row-main .num {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--sky-soft); color: var(--sky-deep); font-weight: 800;
}
.row-main .info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-main .info b { font-size: 15.5px; line-height: 1.3; }
.row-main .sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src { font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src.tkpi { color: #059669; }
.src.ai { color: #b45309; }
@media (prefers-color-scheme: dark) { .src.tkpi { color: #34d399; } .src.ai { color: #fbbf24; } }
.row-main .kc { text-align: right; flex-shrink: 0; }
.row-main .kc b { display: block; font-size: 19px; font-weight: 800; color: var(--sky-deep); line-height: 1.1; }
.row-main .kc small { font-size: 11px; color: var(--muted); font-weight: 600; }
.row-main .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.scan-row.open .chev { transform: rotate(90deg); }

.row-edit { padding: 4px 14px 14px; border-top: 1px dashed var(--line); animation: tab-in .2s ease; }
.edit-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 12px 0 8px; }
.stepper { display: flex; gap: 8px; align-items: stretch; }
.stepper > button {
  width: 52px; flex-shrink: 0; border: 0; border-radius: 14px; background: var(--sky-soft); color: var(--sky-deep);
  font: inherit; font-size: 22px; font-weight: 700; cursor: pointer;
}
.stepper label { flex: 1; position: relative; margin: 0; }
.stepper input { margin: 0; text-align: center; font-size: 20px; font-weight: 800; padding-right: 52px; }
.stepper label span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 600; color: var(--muted); }
.portion-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.portion-chips button {
  padding: 8px 0; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card-2); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.portion-chips button.on { border-color: var(--sky); background: var(--sky-soft); color: var(--sky-deep); font-weight: 800; }
.row-edit .hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.row-edit select { font-size: 14px; }
.macro-line { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--card-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.remove-link { margin-top: 10px; background: none; border: 0; color: var(--danger); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 4px 0; }

/* Tombol simpan menempel di bawah layar (di atas navigasi) */
.save-dock {
  position: sticky; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; gap: 8px; margin-top: 14px; padding: 8px; border-radius: 20px;
  background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(12, 74, 110, .18);
}
.save-dock select { flex: 0 0 132px; font-size: 14px; padding: 12px 34px 12px 12px; }
.save-dock .btn { flex: 1; padding: 12px 10px; }

/* ===== Grafik ===== */
#kcal-chart svg, #weight-chart svg { width: 100%; height: auto; stroke: none; fill: initial; display: block; }
svg text { fill: var(--muted); font-size: 10px; font-family: inherit; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }
.weight-sum { display: flex; gap: 10px; margin-top: 12px; }
.weight-sum div { flex: 1; background: var(--card-2); border-radius: 14px; padding: 10px 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
.weight-sum b { display: block; font-size: 17px; color: var(--text); font-weight: 800; }
.weight-sum .down b { color: #059669; }
.weight-sum .up b { color: var(--danger); }

/* ===== Chat ===== */
.chat-log { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
/* Ruang di bawah chat seukuran kolom ketik yang menempel, supaya pesan terakhir tidak tertutup */
#tab-chat { padding-bottom: 84px; }
.bubble { max-width: 85%; padding: 11px 15px; border-radius: 20px; white-space: pre-wrap; line-height: 1.5; font-size: 14.5px; animation: fade .2s ease; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; border-bottom-right-radius: 6px; }
.bubble.assistant { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.bubble.typing { color: var(--muted); letter-spacing: 2px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex-shrink: 0; border: 1.5px solid var(--line); background: var(--card); color: var(--sky-deep);
  border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chat-form {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 0 16px; max-width: 560px; margin: 0 auto; z-index: 5;
}
.chat-form input { border-radius: 99px; padding-left: 18px; box-shadow: var(--shadow); background: var(--card); }
.send-btn {
  width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 6px 16px var(--sky-glow);
}

/* ===== Profil ===== */
.form { display: grid; gap: 14px; }
.target-card { background: var(--hero); color: #fff; border: 0; box-shadow: var(--shadow-lg); }
.target-card h3 { margin-bottom: 4px; }
.target-card .big { font-size: 36px; font-weight: 800; letter-spacing: -.03em; }
.target-card .big span { font-size: 15px; font-weight: 600; opacity: .85; }
.targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.targets div { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 8px 10px; font-size: 11.5px; }
.targets b { display: block; font-size: 15px; font-weight: 800; }
.target-card p { font-size: 12px; opacity: .85; margin: 12px 0 0; }

/* ===== Navigasi bawah ===== */
.bottom-nav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 536px; margin: 0 auto; height: var(--nav-h);
  display: flex; justify-content: space-around; align-items: center;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 10px 30px rgba(12, 74, 110, .15); z-index: 10;
}
.bottom-nav button {
  flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; padding: 6px 0;
}
.bottom-nav button.active { color: var(--sky-dark); }
.bottom-nav button.active svg { stroke-width: 2.4; }
.bottom-nav .scan-tab span {
  display: grid; place-items: center; width: 60px; height: 60px; margin-top: -34px; border-radius: 22px;
  background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; box-shadow: 0 10px 22px var(--sky-glow);
  border: 4px solid var(--bg); transform: rotate(0);
}
.bottom-nav .scan-tab span svg { width: 28px; height: 28px; }
.bottom-nav .scan-tab.active span { box-shadow: 0 10px 26px rgba(2, 132, 199, .5); }

/* ===== Dialog (bottom sheet) ===== */
dialog {
  border: 0; padding: 0; width: 100%; max-width: 560px; background: var(--card); color: var(--text);
  margin: auto auto 0; border-radius: 28px 28px 0 0; max-height: 90dvh;
}
dialog[open] { animation: sheet .25s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog::backdrop { background: rgba(3, 30, 52, .45); backdrop-filter: blur(3px); }
.dialog-inner { padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.grabber { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 6px; }
.dialog-inner .btn.full { margin-top: 0; }
.food-results { max-height: 45dvh; overflow-y: auto; }
.food-results button {
  display: block; width: 100%; text-align: left; padding: 12px 6px; background: none; border: 0;
  border-bottom: 1px solid var(--line); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.food-results small { color: var(--muted); font-weight: 500; }
#food-pick-name { margin: 4px 0; font-size: 16px; }
.pick-kcal { margin: 0; font-size: 22px; font-weight: 800; color: var(--sky-deep); }

@media (min-width: 600px) {
  .hero { margin: 16px 0 0; border-radius: 32px; }
  dialog { border-radius: 28px; margin: auto; }
}
