:root {
  --bg: #0f1216; --bg2: #161b22; --bg3: #1e252e; --line: #2a323d; --text: #e8edf3; --muted: #8b96a5;
  --accent: #3ddc97; --accent2: #4f8cff; --warn: #ffb547; --danger: #ff5c6c; --in: #3ddc97; --out: #ff5c6c;
  --radius: 14px; --tabbar: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, "Segoe UI", Roboto, Inter, sans-serif; }
body { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
input[type=date], input[type=month], input[type=time] { color-scheme: dark; }
select { appearance: none; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); color: #06271a; border-color: var(--accent); font-weight: 700; }
.btn.blue { background: var(--accent2); color: #fff; border-color: var(--accent2); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 8px; width: 38px; height: 38px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }
.page { max-width: 680px; margin: 0 auto; padding: 14px 16px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; padding-top: env(safe-area-inset-top); }
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav .cur { font-weight: 700; min-width: 120px; text-align: center; }
.datenav input { width: auto; padding: 6px 8px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .big { font-size: 26px; font-weight: 800; }
.in { color: var(--in); } .out { color: var(--out); } .warn { color: var(--warn); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.item.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer; background: transparent; }
.check.on { background: var(--accent); border-color: var(--accent); color: #06271a; font-weight: 900; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--line); color: var(--muted); }
.chip.accent { color: var(--accent); border-color: rgba(61,220,151,.3); }
.chip.warn { color: var(--warn); border-color: rgba(255,181,71,.3); }
.bar { height: 10px; border-radius: 999px; background: var(--bg3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.bar.over > i { background: var(--danger); }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--bg3) 0); display: grid; place-items: center; flex: none; }
.ring.over { background: conic-gradient(var(--danger) calc(var(--p) * 1%), var(--bg3) 0); }
.ring > div { width: 96px; height: 96px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(22,27,34,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; z-index: 20; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabbar a .ico { font-size: 22px; line-height: 1; }
.tabbar a.on { color: var(--accent); }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #06271a; border: 0; font-size: 30px; font-weight: 800; box-shadow: 0 8px 24px rgba(61,220,151,.35); cursor: pointer; z-index: 15; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg2); border-radius: 18px 18px 0 0; width: 100%; max-width: 680px; max-height: 92vh; overflow: auto; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h2 { margin-bottom: 8px; }
.seg { display: flex; background: var(--bg3); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 8px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--bg2); color: var(--text); font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + 20px + env(safe-area-inset-bottom)); background: #222b36; border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 12px; z-index: 50; max-width: 92vw; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.sug { position: absolute; left: 0; right: 0; top: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; max-height: 240px; overflow: auto; z-index: 5; }
.sug div { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sug div:last-child { border-bottom: 0; }
.sug div:hover { background: var(--bg2); }
.rel { position: relative; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #06271a; display: grid; place-items: center; font-weight: 900; font-size: 28px; }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.hist > div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.hist > div.over { background: var(--danger); }
.catlist { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; font-size: 14px; }
.photo-prev { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.kcal { font-variant-numeric: tabular-nums; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
