:root {
  --bg: #06070b;
  --ink: #f3f6fb;
  --muted: #9aa4b4;
  --faint: #646e7e;
  --glass: rgba(255,255,255,.045);
  --glass-2: rgba(255,255,255,.07);
  --hair: rgba(255,255,255,.09);
  --hair-2: rgba(255,255,255,.15);
  --brand1: #9b8cff;   /* violet */
  --brand2: #5b9dff;   /* blue */
  --good: #8f9bff;
  --mid: #ffb13d;
  --low: #ff5d6c;
  --violet: #9b8cff;
  --blue: #5b9dff;
  --teal: #22d3c5;
  --green: #2fe6a0;
  --amber: #ffb13d;
  --red: #ff5d6c;
  --pink: #ff7bd5;
  --r: 22px;
  --r-md: 16px;
  --r-sm: 13px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body {
  font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60% 36% at 16% 0%, rgba(155,140,255,.16), transparent 60%),
    radial-gradient(48% 32% at 96% 6%, rgba(91,157,255,.15), transparent 60%),
    radial-gradient(70% 44% at 50% 102%, rgba(91,157,255,.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
.boot { display: flex; justify-content: center; padding: 40vh 0; }

/* layout */
.shell { max-width: 460px; margin: 0 auto; padding: 0 16px 110px; }
.topbar { max-width: 460px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 22px 16px 14px; }
.brand { display: flex; align-items: center; gap: 11px; }
.mark { width: 38px; height: 38px; border-radius: 12px; position: relative; flex: none;
  background: linear-gradient(145deg, var(--brand1), var(--brand2));
  box-shadow: 0 6px 20px rgba(91,157,255,.35), inset 0 1px 0 rgba(255,255,255,.4); }
.mark::after { content: ""; position: absolute; inset: 0; border-radius: 12px;
  background:
    linear-gradient(transparent 47%, var(--bg) 47%, var(--bg) 53%, transparent 53%),
    radial-gradient(circle at 50% 50%, transparent 24%, var(--bg) 25%, var(--bg) 30%, transparent 31%); }
.wordmark { font-size: 20px; font-weight: 800; letter-spacing: .22em;
  background: linear-gradient(120deg, #fff, #cfd6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtag { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--faint); margin-top: 1px; }
.iconbtn { width: 38px; height: 38px; border-radius: 12px; background: var(--glass); border: 1px solid var(--hair);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 17px; cursor: pointer; }
.iconbtn:hover { background: var(--glass-2); color: var(--ink); }
.greet { font-size: 13.5px; color: var(--muted); margin: 2px 4px 16px; }
.greet b { color: var(--ink); font-weight: 600; }

/* cards */
.card { background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 16px; margin: 12px 0; }
.hero { border-radius: 26px; padding: 22px; margin: 4px 0 14px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(143,155,255,.12), rgba(255,255,255,.028)); border: 1px solid var(--hair-2);
  box-shadow: 0 20px 50px -22px rgba(0,0,0,.7); }
.sec { display: flex; align-items: center; justify-content: space-between; margin: 22px 4px 10px; }
.sec h2 { font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sec .link, .link { font-size: 12.5px; color: var(--blue); text-decoration: none; cursor: pointer; background: none; border: none; }

/* hero */
.hero-row { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; flex: none; }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num .v { font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.ring .num .lbl { font-size: 10px; color: var(--muted); margin-top: 4px; letter-spacing: .16em; }
.hero-meta { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 99px; }
.hero-h { font-size: 17px; font-weight: 700; margin: 11px 0 4px; }
.hero-p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.hero-foot { display: flex; gap: 9px; margin-top: 16px; }
.mini { flex: 1; background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 10px 12px; }
.mini .k { font-size: 10.5px; color: var(--faint); letter-spacing: .03em; }
.mini .n { font-size: 17px; font-weight: 700; margin-top: 3px; }
.mini .n small { font-size: 11px; font-weight: 600; color: var(--muted); }

/* grids + tiles */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tile { background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 13px; position: relative; overflow: hidden; }
.tile .lab { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.tile .dotc { width: 8px; height: 8px; border-radius: 99px; flex: none; }
.tile .val { font-size: 23px; font-weight: 800; margin-top: 8px; letter-spacing: -.01em; }
.tile .val small { font-size: 11.5px; font-weight: 600; color: var(--faint); letter-spacing: 0; }
.tile .delta { font-size: 11px; margin-top: 2px; color: var(--muted); }
.tile .spark { position: absolute; right: 0; bottom: 0; left: 0; height: 26px; opacity: .9; }
.up { color: var(--green); } .down { color: var(--red); }

/* bars */
.bar { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.bar .lab { width: 64px; font-size: 12.5px; color: var(--muted); }
.bar .track { flex: 1; height: 13px; background: rgba(255,255,255,.06); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; }
.bar .v { width: 96px; text-align: right; font-size: 12.5px; font-weight: 600; }

/* sleep stages */
.stages { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin: 12px 0 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* rings row (activity) */
.rings3 { display: flex; gap: 10px; }
.actring { flex: 1; background: var(--glass); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 12px 8px; text-align: center; }
.actring .lbl { font-size: 11px; color: var(--muted); margin-top: 6px; }
.actring .v { font-size: 13px; font-weight: 700; }

/* charts */
.chartbox { position: relative; height: 200px; margin-top: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12.5px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--hair); background: var(--glass); color: var(--muted); cursor: pointer; }
.chip.active { background: linear-gradient(120deg, var(--brand1), var(--brand2)); color: #0a0c14; border-color: transparent; font-weight: 700; }

/* workout list */
.wk { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.wk:last-child { border-bottom: none; }
.wk .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--glass-2); display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.wk .nm { font-weight: 600; font-size: 14px; }
.wk .mt { font-size: 11.5px; color: var(--faint); }
.wk .rt { margin-left: auto; text-align: right; font-size: 13px; }

/* food */
.food-item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.food-item:last-child { border-bottom: none; }
.food-item .meta { font-size: 11.5px; color: var(--faint); }
.meal-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 14px 0 2px; }
.result { padding: 11px 13px; border: 1px solid var(--hair); border-radius: var(--r-sm); margin: 8px 0; cursor: pointer; background: var(--glass); }
.result:hover { background: var(--glass-2); }

/* forms */
button, .btn { font: inherit; cursor: pointer; border-radius: var(--r-sm); border: 1px solid var(--hair); background: var(--glass); color: var(--ink); padding: 10px 15px; font-size: 14px; }
button:hover { background: var(--glass-2); }
button.primary { background: linear-gradient(120deg, var(--brand1), var(--brand2)); border: none; color: #0a0c14; font-weight: 700; }
button.primary:hover { filter: brightness(1.06); }
button.sm { padding: 7px 11px; font-size: 13px; }
button:disabled { opacity: .4; cursor: default; }
input, select { font: inherit; background: rgba(255,255,255,.05); border: 1px solid var(--hair); color: var(--ink); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--brand2); }
label.field { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 5px; }
.dnav { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; }
.dnav .d { font-weight: 700; font-size: 15px; }

/* status / weight rows */
.statline { display: flex; align-items: center; gap: 8px; }
.weightrow { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.weightrow .nm { width: 120px; font-size: 13px; }
.weightrow input[type=range] { flex: 1; accent-color: var(--brand1); }
.weightrow .pct { width: 44px; text-align: right; font-size: 13px; }

/* nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; max-width: 460px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 4px; padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
  background: rgba(10,12,18,.82); border: 1px solid var(--hair); border-bottom: none;
  border-radius: 24px 24px 0 0; backdrop-filter: blur(16px); }
.nav a { flex: 1; text-align: center; font-size: 10px; color: var(--faint); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border-radius: 14px; }
.nav a .ic { font-size: 19px; line-height: 1; }
.nav a.active { color: var(--ink); background: var(--glass-2); }

.muted { color: var(--muted); } .faint { color: var(--faint); font-size: 13px; }
.center { text-align: center; }
.banner { border: 1px solid var(--hair-2); border-radius: var(--r-md); padding: 16px; margin: 12px 0;
  background: linear-gradient(180deg, rgba(143,155,255,.12), rgba(255,255,255,.02)); }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--faint); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bignum { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.login-wrap { max-width: 360px; margin: 18vh auto; padding: 0 20px; text-align: center; }
.login-wrap .mark { width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 18px; }
.login-wrap .mark::after { border-radius: 18px; }
