:root { --bg:#0f1115; --card:#191c23; --fg:#e8eaed; --muted:#8a90a0; --accent:#4f8cff; --good:#3ddc97; --bad:#ff6b6b; --line:#232730; }
* { box-sizing:border-box; }
html,body { margin:0; height:100%; }
body { font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--fg); }
.hidden { display:none !important; }
.err { color:var(--bad); font-size:13px; min-height:18px; margin-top:8px; }

.login { max-width:360px; margin:18vh auto; padding:0 20px; }
.login input { width:100%; padding:12px; font-size:16px; border-radius:10px; border:1px solid #2a2f3a; background:#11141a; color:var(--fg); }
.login button { width:100%; margin-top:14px; padding:13px; font-size:16px; font-weight:600; border:none; border-radius:10px; background:var(--accent); color:#fff; }

#app { max-width:680px; margin:0 auto; padding:16px 16px 92px; min-height:100%; }
.view { }
.card { background:var(--card); border-radius:14px; padding:16px; margin-bottom:16px; }
h1 { font-size:20px; font-weight:600; margin:6px 0 16px; }

.bottomnav { position:fixed; left:0; right:0; bottom:0; height:64px; display:flex; align-items:center; justify-content:space-around;
  background:#12151c; border-top:1px solid var(--line); max-width:680px; margin:0 auto; }
.navbtn { background:none; border:none; color:var(--muted); font-size:22px; padding:8px 14px; cursor:pointer; }
.navbtn.active { color:var(--accent); }
.logbtn { width:56px; height:56px; border-radius:50%; border:none; background:var(--accent); color:#fff; font-size:28px; margin-top:-20px; cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,.4); }

.scrim { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:10; }
.sheet { position:fixed; left:0; right:0; bottom:0; z-index:11; background:var(--card); border-radius:18px 18px 0 0; padding:20px 16px 28px; max-width:680px; margin:0 auto; }

table { width:100%; border-collapse:collapse; font-size:14px; }
th,td { text-align:left; padding:8px 6px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:500; }
button.del { background:none; color:var(--muted); border:none; cursor:pointer; }

.ranges { display:flex; gap:6px; margin-bottom:10px; }
.range { background:#12151c; color:var(--muted); border:1px solid var(--line); border-radius:8px; padding:6px 10px; font-size:13px; cursor:pointer; }
.range.active { color:#fff; background:var(--accent); border-color:var(--accent); }
.readout { font-size:15px; color:var(--good); margin-bottom:10px; }

/* Log sheet form */
.sheet label { display:block; font-size:13px; color:var(--muted); margin:12px 0 4px; }
.sheet input { width:100%; padding:12px; font-size:16px; border-radius:10px; border:1px solid #2a2f3a; background:#11141a; color:var(--fg); }
.sheet .primary { width:100%; margin-top:16px; padding:13px; font-size:16px; font-weight:600; border:none; border-radius:10px; background:var(--accent); color:#fff; cursor:pointer; }

/* Ruler picker */
.rulerwrap { text-align:center; }
.rulerval { font-size:34px; font-weight:700; margin-bottom:8px; }
.rulerval small { font-size:14px; color:var(--muted); }
.ruler { position:relative; overflow-x:scroll; height:64px; scrollbar-width:none; }
.ruler::-webkit-scrollbar { display:none; }
/* padding:0 50% means each side = 50% of .ruler's own width.
   This puts tick[0] (MIN=30kg) exactly under the center pin at scrollLeft=0.
   scrollLeft = ((weight - MIN) / STEP) * PX_PER_TICK places any weight under the pin. */
.rulerinner { position:relative; height:64px; padding:0 50%; box-sizing:content-box; }
.tick { position:absolute; top:16px; width:1px; height:18px; background:#3a4150; }
.tick.major { height:30px; background:#5b6473; }
.tick span { position:absolute; top:32px; left:50%; transform:translateX(-50%); font-size:11px; color:var(--muted); white-space:nowrap; }
.rulerpin { position:absolute; top:10px; left:50%; width:2px; height:40px; background:var(--accent); transform:translateX(-50%); pointer-events:none; }

/* Settings view */
.muted{color:var(--muted);font-size:13px;margin-top:8px;}
hr{border:none;border-top:1px solid var(--line);margin:16px 0;}
.sheet input, #app input{}
#app input{width:100%;padding:10px;border-radius:8px;border:1px solid #2a2f3a;background:#11141a;color:var(--fg);}
#app .primary{width:100%;margin-top:14px;padding:12px;border:none;border-radius:10px;background:var(--accent);color:#fff;font-weight:600;cursor:pointer;}

/* Analytics view */
.cards2 { display:flex; gap:12px; }
.cards2 .stat { flex:1; text-align:center; }
.stat .big { font-size:24px; font-weight:700; margin:4px 0; }
.toggle { display:flex; gap:6px; margin-bottom:12px; flex-wrap:wrap; }
.toggle button { background:#12151c; color:var(--muted); border:1px solid var(--line); border-radius:8px; padding:6px 12px; cursor:pointer; }
.toggle button.active { background:var(--accent); color:#fff; border-color:var(--accent); }
