/* Today's Cup — warm cream + Mr.Brown brown. Mobile-first, 100dvh shell. */
:root{
  --bg:#FAF6F0; --surface:#FFFDF9; --surface2:#F3EADF; --brown:#452619; --brown2:#6B4226;
  --muted:#8A7A6B; --line:#E8DCCB; --accent:#A9713F; --green:#4C7A4E; --red:#B0483A;
  --radius:16px; --shadow:0 2px 12px rgba(69,38,25,.08);
  --tab-h:64px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--brown);
  font-family:"Noto Sans KR",system-ui,-apple-system,sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.serif{font-family:"Cormorant Garamond","Noto Sans KR",serif; letter-spacing:.01em}
button{font:inherit; color:inherit; cursor:pointer}
input,select,textarea{font:inherit; color:inherit}
a{color:var(--brown2)}

#app{height:100dvh; display:flex; flex-direction:column; max-width:560px; margin:0 auto; background:var(--bg)}
#app-header{
  flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:calc(10px + env(safe-area-inset-top, 0px)) 18px 10px; border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:10px}
.brand-mark{display:grid; place-items:center; width:42px; height:42px; border:1.5px solid var(--brown); border-radius:50%; background:var(--surface)}
.brand-title{font-size:24px; font-weight:700; margin:0; line-height:1.05}
.brand-sub{margin:0; font-size:11px; letter-spacing:.22em; text-transform:uppercase; color:var(--muted)}
.offline-pill{font-size:12px; background:#FBE9E2; color:var(--red); border:1px solid #EFC9BE; border-radius:999px; padding:5px 10px; white-space:nowrap}
.hidden{display:none !important}

#view{flex:1 1 auto; overflow-y:auto; overscroll-behavior:contain; padding:16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling:touch}
#view.auth-view{padding-top:8px}

#tabbar{
  flex:0 0 auto; display:flex; border-top:1px solid var(--line); background:var(--surface);
  padding-bottom:env(safe-area-inset-bottom, 0px); min-height:calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
}
.tab{flex:1; border:0; background:none; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:8px 0 6px; font-size:12px; color:var(--muted)}
.tab-ico{font-size:20px; line-height:1}
.tab.active{color:var(--brown); font-weight:700}
.tab.active .tab-ico{color:var(--accent)}

.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; margin-bottom:12px}
.card h2,.card h3{margin:0 0 8px}
.muted{color:var(--muted)} .small{font-size:13px} .tiny{font-size:12px}
.row{display:flex; gap:10px; align-items:center}
.row-between{display:flex; justify-content:space-between; align-items:center; gap:10px}
.wrap{flex-wrap:wrap}
.grow{flex:1; min-width:0}
.mt{margin-top:12px} .mb{margin-bottom:12px} .mb-sm{margin-bottom:6px}

.btn{display:inline-flex; align-items:center; justify-content:center; gap:6px; border-radius:999px; border:1.5px solid var(--brown); background:var(--brown); color:#FFF8EF; padding:12px 20px; font-weight:700; font-size:15px; text-decoration:none}
.btn.secondary{background:var(--surface); color:var(--brown)}
.btn.ghost{background:transparent; border-color:var(--line); color:var(--brown)}
.btn.danger{background:var(--surface); border-color:var(--red); color:var(--red)}
.btn.block{width:100%}
.btn:disabled{opacity:.5; cursor:not-allowed}
.btn-sm{padding:8px 14px; font-size:13px}
.linkbtn{border:0; background:none; color:var(--brown2); text-decoration:underline; padding:4px}

label{display:block; font-size:13px; font-weight:700; margin:14px 0 5px}
label:first-child{margin-top:0}
input[type=text],input[type=email],input[type=password],input[type=number],input[type=date],select,textarea{
  width:100%; border:1.5px solid var(--line); border-radius:12px; background:#fff; padding:12px 14px; font-size:15px; outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--accent)}
textarea{min-height:76px; resize:vertical}
.hint{font-size:12px; color:var(--muted); margin-top:4px}

.chips{display:flex; flex-wrap:wrap; gap:6px}
.chip{border:1.5px solid var(--line); background:var(--surface2); border-radius:999px; padding:5px 11px; font-size:13px}
.chip.sel{background:var(--brown); color:#FFF8EF; border-color:var(--brown)}
.chip-btn{cursor:pointer}
button.chip{font:inherit}

.bean-card{cursor:pointer; text-align:left; width:100%; padding:0; border:1px solid var(--line); background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:12px}
.bean-card .inner{padding:16px}
.bean-name{font-family:"Cormorant Garamond",serif; font-size:22px; font-weight:700; line-height:1.15}
.stock{font-size:13px; font-weight:700}
.stock.low{color:var(--red)}
.badge{display:inline-block; font-size:12px; font-weight:700; border-radius:999px; padding:3px 9px; background:var(--surface2); border:1px solid var(--line)}
.badge.amber{background:#FBF0DC; border-color:#E8C98F; color:#7A5518}
.badge.green{background:#E7F0E5; border-color:#B9D2B8; color:var(--green)}
.badge.brown{background:var(--brown); color:#FFF8EF}

.banner{border-radius:12px; padding:12px 14px; font-size:14px; margin-bottom:12px; border:1px solid}
.banner.info{background:#F3EBDD; border-color:#E0CFAE}
.banner.warn{background:#FBE9E2; border-color:#EFC9BE; color:#7A2E22}
.banner.ok{background:#E7F0E5; border-color:#B9D2B8}

.kv{display:grid; grid-template-columns:auto 1fr; gap:4px 14px; font-size:14px}
.kv dt{color:var(--muted)} .kv dd{margin:0}
.facts{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px 0}
.fact{background:var(--surface2); border-radius:12px; padding:10px; text-align:center}
.fact b{display:block; font-size:19px} .fact span{font-size:12px; color:var(--muted)}

.seg{display:flex; gap:8px; flex-wrap:wrap}
.seg button{flex:1; min-width:100px; border:1.5px solid var(--line); background:var(--surface); border-radius:12px; padding:12px 8px; font-weight:700}
.seg button.sel{background:var(--brown); color:#FFF8EF; border-color:var(--brown)}

input[type=checkbox]{width:18px; height:18px; accent-color:var(--brown)}
.toggle-row{display:flex; justify-content:space-between; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line)}
.toggle-row:last-child{border-bottom:0}

/* Timer */
.timer-clock{font-family:"Cormorant Garamond",serif; font-size:76px; font-weight:700; line-height:1; text-align:center; letter-spacing:.02em}
.timer-sub{text-align:center; color:var(--muted); font-size:14px; margin-top:4px}
.weight-big{text-align:center; font-size:44px; font-weight:700; line-height:1.1}
.weight-big small{font-size:18px; color:var(--muted)}
.flow{font-size:15px; font-weight:700; text-align:center}
.step-list{list-style:none; margin:12px 0 0; padding:0}
.step-list li{display:flex; gap:10px; align-items:center; padding:11px 4px; border-bottom:1px solid var(--line); font-size:15px}
.step-list li:last-child{border-bottom:0}
.step-list li.done{color:var(--muted); text-decoration:line-through}
.step-list li.now{font-weight:700}
.step-list .dot{width:26px; height:26px; flex:0 0 26px; border-radius:50%; border:1.5px solid var(--brown); display:grid; place-items:center; font-size:13px}
.step-list li.done .dot{background:var(--brown); color:#fff}
#graph{width:100%; height:150px; display:block; background:#fff; border:1px solid var(--line); border-radius:12px}
.weight-pad{display:flex; gap:8px; align-items:center; justify-content:center; margin-top:10px}
.weight-pad button{width:52px; height:52px; border-radius:50%; border:1.5px solid var(--brown); background:var(--surface); font-size:24px; font-weight:700}
.minibar{position:sticky; top:0; z-index:5; background:var(--brown); color:#FFF8EF; border-radius:12px; padding:10px 14px; display:flex; justify-content:space-between; font-weight:700; margin-bottom:12px; box-shadow:var(--shadow)}
.minibar span:last-child{font-weight:400; opacity:.9}

/* Stats */
.bars{display:flex; align-items:flex-end; gap:8px; height:110px; padding:6px 2px 0}
.bar-col{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:4px; height:100%}
.bar-col .bar{width:100%; max-width:34px; background:var(--accent); border-radius:6px 6px 0 0; min-height:3px}
.bar-col .lbl{font-size:11px; color:var(--muted)}
.badges{display:grid; grid-template-columns:repeat(3,1fr); gap:8px}
.badge-cell{background:var(--surface2); border:1px solid var(--line); border-radius:12px; padding:10px 8px; text-align:center; font-size:12px}
.badge-cell .medal{font-size:26px; line-height:1}
.badge-cell.earned{background:#F3E7D3; border-color:#D9B98A}
.badge-cell .prog{font-size:11px; color:var(--muted)}
.feedback-row{display:grid; grid-template-columns:repeat(5,1fr); gap:6px}
.feedback-row button{border:1.5px solid var(--line); background:var(--surface); border-radius:12px; padding:10px 4px; font-size:13px; font-weight:700}
.feedback-row button.sel{background:var(--brown); color:#FFF8EF; border-color:var(--brown)}

/* Sheet / toast */
.sheet-backdrop{position:fixed; inset:0; background:rgba(69,38,25,.45); z-index:50; display:flex; align-items:flex-end; justify-content:center}
.sheet{background:var(--bg); width:100%; max-width:560px; max-height:85dvh; overflow-y:auto; border-radius:20px 20px 0 0; padding:20px 18px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow:0 -4px 24px rgba(0,0,0,.2)}
.sheet h2{margin:0 0 10px; font-size:26px}
.sheet-actions{display:flex; flex-direction:column; gap:8px; margin-top:16px}
.toast{position:fixed; left:50%; transform:translateX(-50%); bottom:calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px)); z-index:60; background:var(--brown); color:#FFF8EF; border-radius:999px; padding:10px 18px; font-size:14px; max-width:90vw; text-align:center; box-shadow:var(--shadow)}
.toast.err{background:var(--red)}

.autocomplete{position:relative}
.suggest{position:absolute; left:0; right:0; top:100%; z-index:10; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); max-height:220px; overflow-y:auto; margin-top:4px}
.suggest button{display:block; width:100%; text-align:left; border:0; background:none; padding:11px 14px; font-size:14px; border-bottom:1px solid var(--line)}
.suggest button:last-child{border-bottom:0}
.dimmed{opacity:.38}
.gear-group h3{margin:16px 0 6px; font-size:18px}
.gear-item{display:flex; justify-content:space-between; align-items:center; gap:10px; padding:12px 4px; border-bottom:1px solid var(--line); font-size:15px}
.empty{border:1.5px dashed var(--line); border-radius:var(--radius); padding:28px 16px; text-align:center; color:var(--muted)}
.splash-mark{display:grid; place-items:center; width:96px; height:96px; margin:18px auto 6px; border:2px solid var(--brown); border-radius:50%; background:var(--surface)}
.splash-title{text-align:center; font-size:40px; margin:6px 0 0}
.splash-sub{text-align:center; letter-spacing:.28em; text-transform:uppercase; color:var(--muted); font-size:12px; margin:0 0 18px}
@media (max-width:360px){ .timer-clock{font-size:60px} .feedback-row button{font-size:11px} }
