/* FitLog */
:root {
  --bg: #0B0D10;
  --surface: #15181D;
  --surface-2: #1E222A;
  --surface-3: #272C35;
  --text: #F3F5F7;
  --muted: #9AA3AE;
  --accent: #FF4D5E;
  --accent-ink: #FFFFFF;
  --cal: #FF8A4C;
  --protein: #5AA9FF;
  --carbs: #FFC94D;
  --fat: #FF6FAE;
  --fiber: #8BD86B;
  --danger: #FF6B6B;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --r: 18px;
  --gut: 16px;
  --tabs-h: 62px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
h2 .ic { width: 16px; height: 16px; }
p { margin: 0; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.good { color: var(--fiber); }
.warn { color: var(--cal); }
.danger-text { color: var(--danger) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
.ic { width: 22px; height: 22px; flex: none; }

/* top bar + tabs */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gut) 10px;
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 22px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#back { margin-left: -8px; }
.sync-pill { min-height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: none; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.sync-pill.ok { color: var(--accent); border-color: rgba(255, 77, 94, 0.35); }

main {
  max-width: 640px; margin: 0 auto;
  padding: 14px var(--gut) calc(var(--tabs-h) + env(safe-area-inset-bottom) + 90px);
  display: flex; flex-direction: column; gap: 12px;
}
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(17, 19, 23, 0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.tabs button.on { color: var(--accent); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px; width: 100%;
  border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; }
.btn.big { min-height: 58px; font-size: 17px; border-radius: 16px; }
.btn.sm { white-space: nowrap; min-height: 38px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #1A0505; }
.btn .ic { width: 20px; height: 20px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; }
.icon-btn.sm { width: 36px; height: 36px; color: var(--muted); }
.icon-btn:disabled { opacity: 0.3; }
.icon-btn .ic { width: 20px; height: 20px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; padding: 6px 0; }
.link .ic { width: 16px; height: 16px; }

/* cards + sections */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.section { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.empty { padding: 10px 2px; font-size: 14px; }
.list-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 14px 2px 4px; display: flex; gap: 6px; align-items: center; }
.list-h .ic { width: 14px; height: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field > span { font-weight: 600; }
.field input, .field select, .field textarea, .search, .searchrow input, .title-input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--surface-2); color: var(--text); font-size: 16px;
  outline: none;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .title-input:focus { border-color: var(--accent); }
.field input:disabled { opacity: 0.6; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; padding: 6px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.check .ic { width: 18px; height: 18px; color: var(--carbs); }
.form { display: flex; flex-direction: column; gap: 12px; }
.custom-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }

/* today */
.datebar { display: flex; align-items: center; justify-content: space-between; }
.date-label { position: relative; font-weight: 700; font-size: 17px; padding: 8px 14px; border-radius: 12px; background: var(--surface); }
.date-label input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.summary { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; }
.ring-wrap { position: relative; width: 132px; height: 132px; }
.ring { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ring-fill { fill: none; stroke: var(--cal); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.ring-fill.over { stroke: var(--fat); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-text b { font-size: 28px; line-height: 1; }
.ring-text span { color: var(--muted); font-size: 13px; margin-top: 3px; }
.summary-side { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.kv { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.kv b { color: var(--text); }
.macro-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.macro-top span:last-child { color: var(--text); font-weight: 600; }
.macro-top i { font-style: normal; color: var(--muted); font-weight: 400; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar div { height: 100%; border-radius: 6px; transition: width 0.4s; }

.logbar { display: flex; flex-direction: column; gap: 8px; }
.logbar-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip-btn .ic { color: var(--accent); }

.meal { padding: 10px 12px; }
.meal header { display: flex; align-items: center; gap: 8px; }
.meal h3 { font-size: 16px; flex: 1; }
.meal header .muted { font-size: 14px; }
.entry { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.entry:first-of-type { margin-top: 6px; }
.entry img, .entry-ic { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; flex: none; }
.entry-ic { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.entry-ic .ic { width: 18px; height: 18px; }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-main b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-main small { color: var(--muted); font-size: 12px; }
.entry-cal { font-weight: 700; }

.glances { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.glance { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; cursor: pointer; min-width: 0; }
.glance > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.glance b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance small { color: var(--muted); font-size: 12px; }
.glance-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: none; }
.glance-ic .ic { width: 18px; height: 18px; }

.setup { display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; border-color: rgba(255, 77, 94, 0.4); }

/* sheets */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 640px; max-height: 92dvh;
  padding: 0; border: 0; border-radius: 22px 22px 0 0;
  background: var(--surface); color: var(--text);
  animation: up 0.22s ease-out;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding: 20px var(--gut) calc(env(safe-area-inset-bottom) + 18px); overflow: auto; max-height: 92dvh; }
.sheet-body form { display: flex; flex-direction: column; gap: 12px; }
.sheet h2 { font-size: 15px; }
.confirm-msg { font-size: 17px; padding: 6px 0; }
.menu { display: flex; flex-direction: column; background: var(--surface-2); border-radius: 14px; overflow: hidden; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 16px; cursor: pointer; }
.menu button:last-child { border-bottom: 0; }
.menu button:disabled { opacity: 0.35; }
.menu .ic { color: var(--accent); width: 20px; height: 20px; }
.menu .danger-text .ic { color: var(--danger); }
.snap-preview { width: 100%; max-height: 42dvh; object-fit: cover; border-radius: 16px; }
.fe-thumb { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; }
.ai-note { font-size: 13px; color: var(--muted); background: var(--surface-2); padding: 10px 12px; border-radius: 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 4px; }
.badge.high { background: rgba(255, 77, 94, 0.15); color: var(--accent); }
.badge.medium { background: rgba(255, 201, 77, 0.15); color: var(--carbs); }
.badge.low { background: rgba(255, 138, 76, 0.15); color: var(--cal); }
.item { background: var(--surface-2); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.item-top { display: grid; grid-template-columns: 1fr 96px 36px; gap: 6px; align-items: center; }
.item input { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 16px; outline: none; }
.item input:focus { border-color: var(--accent); }
.item-nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.item-nums label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.item-nums input { padding: 6px; text-align: center; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { min-height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: none; color: var(--text); font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg input { width: 70px; min-height: 38px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); text-align: center; font-size: 16px; }
.fe-total { font-size: 15px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.fe-total b { font-size: 22px; color: var(--cal); }
.fe-total span { display: block; color: var(--muted); font-size: 13px; }
.search { margin-bottom: 4px; }
.searchrow { display: flex; gap: 8px; }
.pick-list { display: flex; flex-direction: column; }
.pick-row { display: flex; align-items: center; }
.pick { flex: 1; display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.pick small { color: var(--muted); font-size: 12px; display: flex; gap: 4px; align-items: center; }
.pick small .ic { width: 13px; height: 13px; color: var(--carbs); }
.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 25% 12%; border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 76px); z-index: 100;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: 14px; background: var(--surface-3); color: var(--text);
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: up 0.2s ease-out; transition: opacity 0.4s;
}
.toast.out { opacity: 0; }

/* charts */
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .goal-line { stroke: var(--muted); stroke-dasharray: 4 4; opacity: 0.7; }
.chart-empty { padding: 26px 0; text-align: center; }

/* workout */
.live { display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; border-color: rgba(255, 77, 94, 0.35); background: linear-gradient(135deg, rgba(255, 77, 94, 0.12), var(--surface)); }
.live > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.live small { color: var(--muted); }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 77, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0); } }
.routine { display: flex; align-items: center; padding: 4px 6px 4px 14px; }
.routine-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 10px 0; border: 0; background: none; text-align: left; cursor: pointer; }
.routine-main small, .srow small { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.srow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer; }
.srow > span:first-child { flex: 1; min-width: 0; }
.vid-count { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.vid-count .ic { width: 16px; height: 16px; }

.session-head { display: flex; flex-direction: column; gap: 4px; }
.title-input { font-size: 20px; font-weight: 700; background: transparent; border-color: transparent; padding-left: 0; }
.ex-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.ex-card header { display: flex; align-items: center; }
.ex-name { flex: 1; text-align: left; border: 0; background: none; color: var(--accent); font-size: 17px; font-weight: 700; padding: 4px 0; cursor: pointer; }
.last { margin-top: -6px; }
.set-grid { display: flex; flex-direction: column; gap: 6px; }
.set-head, .set-row { display: grid; gap: 6px; align-items: center; }
.t-weight .set-head, .t-weight .set-row, .t-reps .set-head, .t-reps .set-row { grid-template-columns: 26px minmax(0, 1fr) 62px 54px 40px 40px; }
.t-time .set-head, .t-time .set-row { grid-template-columns: 26px minmax(0, 1fr) 82px 40px 40px; }
.set-head { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; text-align: center; }
.set-head span:nth-child(2) { text-align: left; }
.set-row { padding: 3px 0; border-radius: 10px; transition: background 0.2s; }
.set-row.done { background: rgba(255, 77, 94, 0.1); }
.set-n { text-align: center; font-weight: 700; color: var(--muted); }
.prev { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-row input { width: 100%; min-height: 40px; padding: 4px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 16px; font-weight: 600; outline: none; -moz-appearance: textfield; }
.set-row input::-webkit-outer-spin-button, .set-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-row input:focus { border-color: var(--accent); }
.set-row input::placeholder { color: rgba(154, 163, 174, 0.55); font-weight: 500; }
.set-check, .set-vid { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--surface-3); color: var(--muted); cursor: pointer; padding: 0; overflow: hidden; }
.set-check .ic, .set-vid .ic { width: 19px; height: 19px; }
.set-row.done .set-check { background: var(--accent); color: var(--accent-ink); }
.set-vid.has { color: var(--accent); outline: 1.5px solid var(--accent); }
.set-vid img { width: 100%; height: 100%; object-fit: cover; }
.vprog { position: absolute; inset: auto 0 0 0; font-style: normal; font-size: 9px; font-weight: 700; background: rgba(0, 0, 0, 0.7); color: #fff; line-height: 14px; }

.h-ex { font-size: 24px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; }
.tile b { font-size: 22px; }
.tile span { color: var(--muted); font-size: 12px; }
.vid-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vid-tile { position: relative; aspect-ratio: 3 / 4; border: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); padding: 0; cursor: pointer; }
.vid-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vid-tile span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); text-align: left; }
.video-sheet .sheet-body { padding-top: 12px; }
.player { width: 100%; max-height: 72dvh; border-radius: 14px; background: #000; }

.finish { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.finish-ic { width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 77, 94, 0.15); color: var(--accent); display: grid; place-items: center; }
.finish-ic .ic { width: 32px; height: 32px; }
.finish-name { font-size: 20px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; }
.stats b { font-size: 17px; }
.stats span { font-size: 11px; color: var(--muted); }

.r-ex { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.r-ex-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.r-ex-btns { display: flex; }
.r-ex-nums { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.r-ex-nums label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.r-ex-nums input { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); font-size: 16px; }

/* rest timer */
.rest {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 15;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 10px);
  width: calc(100% - 24px); max-width: 616px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 16px; border-radius: 16px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.rest-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 77, 94, 0.16); transition: width 0.25s linear; z-index: -1; }
.rest-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.rest b { font-size: 22px; flex: 1; }
.rest button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.08); font-weight: 700; font-size: 14px; cursor: pointer; }
.rest #rest-skip { background: var(--accent); color: var(--accent-ink); }

/* habits */
.weigh { display: flex; flex-direction: column; gap: 6px; }
.weigh.due { border-color: rgba(255, 77, 94, 0.4); }
.weigh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.weigh-big { font-size: 34px; font-weight: 750; line-height: 1.1; margin-top: 6px; }
.weigh-big span { font-size: 16px; color: var(--muted); font-weight: 600; }
.due-note { font-size: 13px; color: var(--accent); }
.weigh .link { align-self: flex-start; }
.habit { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.week-head { display: flex; gap: 4px; padding: 0 15px; font-size: 11px; font-weight: 700; color: var(--muted); }
.week-head span { width: 22px; text-align: center; }
.week-head span:first-child { flex: 1; }
.habit { padding: 10px 14px; }
.habit-check { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line-strong); background: none; color: transparent; display: grid; place-items: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.habit.on .habit-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.habit-name { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 4px 0; }
.habit-name b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.habit-name small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 3px; }
.habit-name small .ic { width: 13px; height: 13px; color: var(--cal); }
.habit-week { display: grid; grid-template-columns: repeat(7, 22px); gap: 4px; }
.dot { width: 22px; height: 22px; border-radius: 7px; border: 0; background: var(--surface-3); cursor: pointer; padding: 0; }
.dot.on { background: var(--accent); }
.cal { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; margin-top: 10px; overflow-x: auto; }
.cal-d { width: 100%; min-width: 18px; aspect-ratio: 1; border: 0; border-radius: 5px; background: var(--surface-3); padding: 0; cursor: pointer; }
.cal-d.on { background: var(--accent); }
.cal-d.today { outline: 1.5px solid var(--text); }

/* me */
.goals { display: flex; flex-direction: column; gap: 10px; }
.goal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.goal-grid div { display: flex; flex-direction: column; }
.goal-grid b { font-size: 22px; }
.goal-grid span { font-size: 12px; color: var(--muted); }

/* sign in */
.signin { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.signin-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.signin-logo { width: 84px; height: 84px; border-radius: 20px; margin: 0 auto; }
.signin-box h1 { font-size: 30px; }
.signin-box input { min-height: 52px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2); font-size: 18px; text-align: center; outline: none; }
.signin-box input:focus { border-color: var(--accent); }
.signin-msg { color: var(--danger); min-height: 20px; font-size: 14px; }

@media (max-width: 380px) {
  .summary { grid-template-columns: 112px 1fr; gap: 12px; }
  .ring-wrap { width: 112px; height: 112px; }
  .habit { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .habit-check { width: 40px; height: 40px; }
  .habit-week { grid-template-columns: repeat(7, 18px); gap: 3px; }
  .dot, .week-head span { width: 18px; }
  .dot { height: 18px; }
  .week-head { gap: 3px; padding: 0 11px; }
}
