/* ==========================================================================
   FitFile · 健身会员档案
   ========================================================================== */

:root {
  --bg: #f2efe7;
  --bg-deep: #eae6db;
  --surface: #ffffff;
  --surface-2: #faf8f2;
  --ink: #17221c;
  --ink-2: #334039;
  --muted: #737b73;
  --muted-2: #9aa199;
  --line: #e4e0d4;
  --line-strong: #d5d0c1;
  --green: #123f33;
  --green-2: #1a5a48;
  --green-3: #26735c;
  --lime: #d8f06d;
  --lime-soft: #eef7c3;
  --coral: #cc6743;
  --coral-soft: #f8e7df;
  --amber: #b57b28;
  --amber-soft: #f8eeda;
  --blue: #47568c;
  --blue-soft: #e9ebf4;
  --shadow-sm: 0 1px 2px rgba(23, 34, 28, 0.04), 0 3px 10px -6px rgba(23, 34, 28, 0.12);
  --shadow-md: 0 2px 4px rgba(23, 34, 28, 0.04), 0 18px 40px -28px rgba(23, 34, 28, 0.3);
  --shadow-lg: 0 30px 80px -30px rgba(18, 63, 51, 0.35);
  --radius: 20px;
  --radius-sm: 13px;
  --radius-xs: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --num: "SF Pro Display", "DIN Alternate", "Avenir Next", -apple-system, BlinkMacSystemFont, sans-serif;
  --topbar-h: 66px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--lime); color: var(--green); }

h1, h2, h3, h4, p { margin: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--green-3);
  outline-offset: 2px;
}

.app-root { min-height: 100vh; min-height: 100dvh; }
.muted { color: var(--muted); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.hide { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Boot / login ---------- */
.boot-screen {
  min-height: 100vh; display: grid; place-content: center; justify-items: center;
  gap: 16px; color: var(--muted); font-size: 14px;
}
.boot-mark {
  width: 54px; height: 54px; border-radius: 16px; background: var(--green);
  color: var(--lime); display: grid; place-content: center;
  font: 800 26px/1 var(--num); letter-spacing: -0.04em;
  box-shadow: var(--shadow-md);
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: translateY(-3px); opacity: 0.82; } }

.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(216, 240, 109, 0.35), transparent 60%),
    radial-gradient(700px 500px at -10% 100%, rgba(18, 63, 51, 0.14), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 26px;
  padding: 34px 30px 30px; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.6);
  position: relative;
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo .logo-tile { width: 42px; height: 42px; border-radius: 12px; }
.login-card h1 { font-size: 25px; letter-spacing: -0.03em; margin-bottom: 6px; }
.login-card > p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-card .btn { width: 100%; }
.login-foot { margin-top: 22px; font-size: 12px; color: var(--muted-2); text-align: center; line-height: 1.7; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(242, 239, 231, 0.82);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid rgba(228, 224, 212, 0.8);
  padding-top: var(--safe-top);
}
.topbar-inner {
  max-width: 1140px; margin: 0 auto; height: var(--topbar-h);
  padding: 0 26px; display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-tile {
  width: 36px; height: 36px; border-radius: 10px; background: var(--green);
  display: grid; place-content: center; color: var(--lime);
  font: 800 19px/1 var(--num); letter-spacing: -0.05em; flex: none;
  position: relative; overflow: hidden;
}
.logo-tile::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(216, 240, 109, 0.16); right: -4px; bottom: -4px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; letter-spacing: -0.02em; font-weight: 750; }
.brand-text span { font-size: 10.5px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; display: grid; place-content: center; color: var(--ink-2);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  flex: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.72); border-color: var(--line); color: var(--ink); }
.icon-btn.ghost-line { border-color: var(--line); background: rgba(255,255,255,.55); }
.icon { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.editor-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 999px; background: rgba(255,255,255,.62); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2); white-space: nowrap; transition: background .16s;
}
.editor-chip:hover { background: #fff; }
.editor-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-3); }
.editor-chip .who { max-width: 108px; overflow: hidden; text-overflow: ellipsis; }
.editor-chip .who.placeholder { color: var(--muted); }

.save-state { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.save-state .spin { width: 10px; height: 10px; border: 1.5px solid var(--line-strong); border-top-color: var(--green-3); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.back-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px;
  color: var(--muted); height: 36px; padding: 0 8px 0 4px; border-radius: 9px; border: 0; background: none;
  white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis;
}
.back-link:hover { color: var(--ink); background: rgba(255,255,255,.6); }

/* ---------- Page ---------- */
.page { max-width: 1140px; margin: 0 auto; padding: 30px 26px 80px; }
.page > * + * { margin-top: 26px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; color: #f6f8ef;
  background:
    radial-gradient(760px 420px at 92% -18%, rgba(216, 240, 109, 0.3), transparent 60%),
    radial-gradient(520px 380px at 6% 118%, rgba(38, 115, 92, 0.65), transparent 60%),
    linear-gradient(135deg, #0d3229 0%, #123f33 55%, #164a3b 100%);
  padding: 38px 38px 32px; box-shadow: 0 30px 60px -40px rgba(18, 63, 51, 0.7);
  min-height: 252px; display: flex; flex-direction: column; justify-content: space-between;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(105deg, transparent 20%, #000 70%);
  mask-image: linear-gradient(105deg, transparent 20%, #000 70%);
}
.hero::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -120px; top: -180px;
  border-radius: 50%; border: 1px solid rgba(216, 240, 109, 0.22);
  box-shadow: 0 0 0 46px rgba(216, 240, 109, 0.045), 0 0 0 94px rgba(216, 240, 109, 0.03);
  pointer-events: none;
}
.hero-main { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; flex-wrap: wrap; }
.hero-copy { max-width: 560px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 650;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--lime); margin-bottom: 12px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--lime); opacity: 0.7; }
.hero h1 { font-size: clamp(34px, 5vw, 46px); line-height: 1.04; letter-spacing: -0.05em; font-weight: 780; }
.hero h1 em { font-style: normal; color: var(--lime); }
.hero-sub { margin-top: 12px; font-size: 13.5px; color: rgba(246, 248, 239, 0.64); max-width: 430px; line-height: 1.7; }
.hero-side { display: flex; align-items: flex-end; gap: 26px; position: relative; z-index: 1; }
.hero-stats { display: flex; gap: 0; }
.hero-stat { padding: 0 22px; border-left: 1px solid rgba(255, 255, 255, 0.15); }
.hero-stat:first-child { padding-left: 0; border-left: 0; }
.hero-stat b { display: block; font: 650 28px/1.15 var(--num); letter-spacing: -0.03em; color: #fff; }
.hero-stat span { display: block; font-size: 11.5px; color: rgba(246, 248, 239, 0.52); margin-top: 5px; letter-spacing: 0.02em; }
.hero-cta { display: flex; gap: 9px; flex-wrap: wrap; position: relative; z-index: 1; margin-top: 26px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 17px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: transform .12s ease, background .16s ease, border-color .16s, box-shadow .16s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--muted-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-2); border-color: var(--green-2); }
.btn-lime { background: var(--lime); border-color: var(--lime); color: #142a20; }
.btn-lime:hover { background: #e4f884; border-color: #e4f884; }
.btn-soft { background: var(--surface-2); border-color: var(--line); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(255,255,255,.7); border-color: var(--line); }
.btn-danger { background: #fff; border-color: #ecc9bb; color: #a84524; }
.btn-danger:hover { background: var(--coral-soft); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; gap: 5px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.link-btn { border: 0; background: none; padding: 0; font-size: 13px; color: var(--green-3); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Section ---------- */
.section-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 15px; flex-wrap: wrap; }
.section-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 7px; }
.section-title { font-size: 21px; letter-spacing: -0.03em; font-weight: 750; line-height: 1.2; }
.section-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.section-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Coach cards ---------- */
.coach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.coach-card {
  position: relative; display: flex; align-items: center; gap: 13px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 17px;
  padding: 16px 16px; transition: border-color .16s, box-shadow .18s, transform .18s;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.coach-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.coach-card.active { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), var(--shadow-md); }
.coach-card.active::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 64px; height: 64px;
  background: var(--lime); border-radius: 50%; opacity: .35;
}
.coach-avatar {
  width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-content: center;
  color: #fff; font: 700 17px/1 var(--num); letter-spacing: -0.02em; position: relative;
}
.coach-avatar::after {
  content: attr(data-tag); position: absolute; right: -4px; bottom: -4px;
  width: 17px; height: 17px; border-radius: 6px; background: var(--lime); color: var(--green);
  font: 750 9.5px/17px var(--num); text-align: center; border: 2px solid var(--surface); box-sizing: content-box;
}
.coach-info { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.coach-name { font-size: 14.5px; font-weight: 680; display: flex; align-items: center; gap: 6px; }
.coach-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-count { margin-left: auto; text-align: right; flex: none; }
.coach-count b { font: 650 19px/1 var(--num); color: var(--green); display: block; }
.coach-count span { font-size: 10px; color: var(--muted-2); }
.coach-add {
  border: 1px dashed var(--line-strong); background: transparent; color: var(--muted);
  box-shadow: none; justify-content: center; min-height: 78px; gap: 8px; font-size: 13px;
}
.coach-add:hover { color: var(--green-3); border-color: var(--green-3); background: rgba(255,255,255,.4); }
.coach-add .plus-ring { width: 30px; height: 30px; border-radius: 50%; border: 1px dashed var(--line-strong); display: grid; place-content: center; }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search {
  position: relative; flex: 1; min-width: 190px; max-width: 330px;
}
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 17px; height: 17px; }
.search input {
  width: 100%; height: 41px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(255,255,255,.72); padding: 0 14px 0 39px; font-size: 13.5px;
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.search input:focus { outline: none; background: #fff; border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(38,115,92,.09); }
.search input::placeholder { color: var(--muted-2); }
.result-count { font-size: 12px; color: var(--muted-2); margin-left: auto; white-space: nowrap; }

/* ---------- Member list ---------- */
.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-list-head {
  display: grid; grid-template-columns: 40px minmax(130px, 1.45fr) 92px 104px 88px 108px 72px 18px;
  gap: 14px; padding: 0 18px 4px; font-size: 10.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-2); font-weight: 650;
}
.member-row {
  display: grid; grid-template-columns: 40px minmax(130px, 1.45fr) 92px 104px 88px 108px 72px 18px;
  gap: 14px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px 18px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.member-row:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.mem-avatar {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-content: center;
  background: var(--surface-2); color: var(--green); font-weight: 700; font-size: 15px;
  border: 1px solid var(--line); flex: none;
}
.mem-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mem-name { display: flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 680; line-height: 1.35; }
.mem-name .sex { font-size: 10px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; line-height: 16px; }
.mem-sub { font-size: 11px; color: var(--muted-2); }
.mem-goal { justify-self: start; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.pill.green { background: #eaf3ed; border-color: #d3e6da; color: #236349; }
.pill.amber { background: var(--amber-soft); border-color: #eedcba; color: #8b5d19; }
.pill.coral { background: var(--coral-soft); border-color: #f0d2c6; color: #a54a2b; }
.pill.blue { background: var(--blue-soft); border-color: #d9ddec; color: #445184; }
.mem-metric { min-width: 0; line-height: 1.25; }
.mem-metric b { font: 640 14px/1.2 var(--num); color: var(--ink); display: block; letter-spacing: -0.01em; }
.mem-metric b .u { font-size: 9.5px; color: var(--muted); font-weight: 500; margin-left: 1px; }
.mem-metric span { font-size: 10px; color: var(--muted-2); display: block; margin-top: 3px; }
.mem-coach { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.coach-mini { width: 20px; height: 20px; border-radius: 6px; color: #fff; display: grid; place-content: center; font: 700 9px/1 var(--num); flex: none; }
.mem-updated { font-size: 11px; color: var(--muted-2); text-align: right; }
.row-chev { color: var(--line-strong); }
.member-row:hover .row-chev { color: var(--green-3); }

/* ---------- Empty ---------- */
.empty {
  border: 1px dashed var(--line-strong); border-radius: 18px; padding: 46px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: rgba(255,255,255,.35); color: var(--muted);
}
.empty-art { width: 52px; height: 52px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; place-content: center; color: var(--muted-2); margin-bottom: 13px; box-shadow: var(--shadow-sm); }
.empty h3 { font-size: 15px; color: var(--ink-2); font-weight: 650; margin-bottom: 4px; }
.empty p { font-size: 12.5px; max-width: 320px; line-height: 1.65; }
.empty .btn { margin-top: 17px; }

/* ---------- Member header ---------- */
.member-page { padding-top: 18px; }
.member-head {
  display: flex; align-items: center; gap: 18px; padding: 4px 2px 20px;
}
.member-avatar-lg {
  width: 68px; height: 68px; border-radius: 20px; display: grid; place-content: center;
  background: linear-gradient(150deg, var(--green-2), var(--green)); color: var(--lime);
  font: 700 27px/1 var(--num); flex: none; box-shadow: var(--shadow-md);
  border: 1px solid rgba(255,255,255,.2); position: relative;
}
.member-avatar-lg::after {
  content: ""; position: absolute; inset: 6px; border-radius: 14px; border: 1px solid rgba(255,255,255,.14);
}
.member-identity { min-width: 0; }
.member-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.member-title h1 { font-size: clamp(25px, 3.6vw, 32px); letter-spacing: -0.04em; line-height: 1.15; font-weight: 780; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px;
  border-radius: 7px; font-size: 11px; font-weight: 650; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.badge .coach-dot { width: 7px; height: 7px; border-radius: 50%; }
.member-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.member-meta span { display: inline-flex; align-items: center; gap: 5px; }
.member-meta .icon { width: 13px; height: 13px; color: var(--muted-2); }
.member-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }

/* ---------- Quick strip ---------- */
.quick-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px;
}
.qs-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px 15px 11px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  min-width: 0;
}
.qs-label { font-size: 10.5px; color: var(--muted); letter-spacing: .03em; display: flex; align-items: center; gap: 5px; }
.qs-value { display: flex; align-items: baseline; gap: 3px; margin-top: 3px; font: 650 23px/1.15 var(--num); letter-spacing: -0.03em; }
.qs-value .u { font-size: 10.5px; color: var(--muted); font-family: var(--font); font-weight: 500; }
.qs-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 5px; }
.qs-delta { font-size: 10.5px; font-weight: 650; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.qs-delta.good { color: #207450; }
.qs-delta.warn { color: #bd682f; }
.qs-delta.flat { color: var(--muted-2); }
.spark { width: 62px; height: 24px; flex: none; overflow: visible; }
.spark path.line { fill: none; stroke: var(--green-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: url(#sparkFill); opacity: .55; }
.spark circle { fill: var(--surface); stroke: var(--green-3); stroke-width: 1.3; }

/* ---------- Tabs ---------- */
.tabs-wrap {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 30;
  margin: 0 -26px; padding: 0 26px;
  background: rgba(242, 239, 231, 0.9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.tabs { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; max-width: 1140px; margin: 0 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; border: 0; background: none; padding: 13px 13px 12px; font-size: 13.5px;
  color: var(--muted); white-space: nowrap; font-weight: 550; display: flex; align-items: center; gap: 6px;
  transition: color .15s;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); font-weight: 680; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--green); border-radius: 2px 2px 0 0; }
.tab .count-dot { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 5px; background: var(--bg-deep); color: var(--muted); font: 650 9.5px/16px var(--num); text-align: center; }
.tab.active .count-dot { background: var(--green); color: var(--lime); }

.panel { padding-top: 24px; animation: fadein .22s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.panel-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-title { font-size: 19px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.25; }
.panel-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.panel-head .section-actions { margin-left: auto; padding-top: 3px; }
.panel-footnote { margin-top: 12px; font-size: 11.5px; color: var(--muted-2); display: flex; align-items: center; gap: 6px; line-height: 1.6; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 11.5px; font-weight: 650; color: var(--muted); letter-spacing: .02em; display: flex; align-items: center; gap: 5px; }
.field > label .opt { font-weight: 500; color: var(--muted-2); font-size: 10.5px; }
input[type="text"], input[type="date"], input[type="number"], input[type="tel"], input[type="search"], input[type="password"],
select, textarea {
  width: 100%; height: 42px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); padding: 0 12px; font-size: 13.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737b73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green-3); box-shadow: 0 0 0 3px rgba(38, 115, 92, 0.09);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
.field-hint { font-size: 10.5px; color: var(--muted-2); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.form-grid .span-2 { grid-column: span 2; }
.form-row { display: flex; gap: 10px; }

.info-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.info-card + .info-card { margin-top: 14px; }
.info-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.info-card-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.info-card-head .icon-box { width: 30px; height: 30px; border-radius: 9px; background: #eef3ea; color: var(--green-3); display: grid; place-content: center; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-grid .span-2 { grid-column: span 2; }
.info-grid .span-3 { grid-column: span 3; }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: none; height: 30px; padding: 0 13px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); font-weight: 550;
}
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 650; }
.goal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.goal-chips button {
  height: 29px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 11.5px; color: var(--muted); transition: all .14s;
}
.goal-chips button:hover { border-color: var(--green-3); color: var(--green-3); }
.goal-chips button.active { background: var(--green); color: #fff; border-color: var(--green); }

/* ---------- Data table ---------- */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmp-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
.cmp-table th, .cmp-table td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid #efecE3; }
.cmp-table th:last-child, .cmp-table td:last-child { border-right: 0; }
.cmp-table tr:last-child td { border-bottom: 0; }
.cmp-table thead th { background: #fbfaf5; position: sticky; top: 0; z-index: 2; }
.cmp-corner {
  width: 126px; min-width: 126px; text-align: left; padding: 13px 14px !important;
  position: sticky; left: 0; z-index: 4; background: #fbfaf5;
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); font-weight: 650;
}
.cmp-corner small { display: block; font-size: 10px; letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--muted-2); margin-top: 2px; }
.cmp-record-head {
  padding: 9px 8px 8px !important; text-align: center; vertical-align: top; background: transparent; border: 0; width: 86px; min-width: 86px; cursor: pointer;
}
.cmp-record-head:hover .rec-date { color: var(--green-3); }
.cmp-record-head:hover .rec-edit { opacity: 1; }
.rec-inner { display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 9px; padding: 4px 2px; transition: background .15s; }
.cmp-record-head:hover .rec-inner { background: #f2f6ef; }
.rec-no { font-size: 9px; color: var(--muted-2); letter-spacing: .05em; }
.rec-date { font: 620 11.5px/1.3 var(--num); color: var(--ink-2); white-space: nowrap; }
.rec-edit { font-size: 9px; color: var(--green-3); opacity: 0; transition: opacity .15s; display: flex; align-items: center; gap: 2px; }
.rec-empty { font-size: 15px; color: var(--line-strong); line-height: 1.6; }
.cmp-record-head.is-empty .rec-inner { border: 1px dashed var(--line); }
.cmp-record-head.is-empty:hover .rec-edit { opacity: 1; }
.cmp-metric {
  width: 126px; min-width: 126px; position: sticky; left: 0; z-index: 3; background: #fbfaf5;
  padding: 11px 14px !important; text-align: left;
}
.cmp-metric b { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.cmp-metric span { font-size: 9.5px; color: var(--muted-2); }
.cmp-value { text-align: center; padding: 10px 6px !important; font: 560 14px/1.3 var(--num); color: var(--ink); letter-spacing: -0.01em; }
.cmp-value.is-empty { color: #c8c3b5; font-family: var(--font); font-size: 12px; }
.cmp-value .u { font-size: 9px; color: var(--muted-2); margin-left: 1px; font-family: var(--font); }
.cmp-value.best { color: var(--green-3); font-weight: 700; }
.cmp-value .sub { display: block; font-size: 9px; color: var(--muted-2); font-family: var(--font); font-weight: 500; margin-top: 1px; }
.cmp-table.dense { min-width: 982px; }
.cmp-table.dense .cmp-metric { width: 118px; min-width: 118px; }
.cmp-table.dense .cmp-record-head, .cmp-table.dense .cmp-value { width: 72px; min-width: 72px; }

/* ---------- Delta cards ---------- */
.delta-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 2px 12px; flex-wrap: wrap; }
.delta-head h3 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.delta-head h3 .icon { color: var(--green-3); }
.delta-legend { font-size: 10.5px; color: var(--muted-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legend-dot { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.legend-dot.good { color: #207450; }
.legend-dot.warn { color: #bd682f; }
.delta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.delta-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
  padding: 13px 14px 12px; box-shadow: var(--shadow-sm); min-width: 0;
}
.delta-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.delta-name { font-size: 11.5px; color: var(--muted); font-weight: 550; }
.delta-big { display: flex; align-items: baseline; gap: 3px; margin-top: 4px; font: 650 22px/1.15 var(--num); letter-spacing: -0.03em; }
.delta-big .u { font-size: 10px; color: var(--muted-2); font-family: var(--font); font-weight: 500; }
.delta-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: 2px; }
.delta-base { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.delta-chip {
  display: inline-flex; align-items: center; gap: 3px; font: 650 11px/1 var(--num);
  padding: 4px 7px; border-radius: 6px; white-space: nowrap;
}
.delta-chip.good { background: #e9f4ed; color: #1d7049; }
.delta-chip.warn { background: var(--coral-soft); color: #b2552f; }
.delta-chip.flat { background: var(--surface-2); color: var(--muted); }
.delta-chart { display: flex; justify-content: flex-end; margin-top: 4px; height: 24px; }
.delta-chart svg { width: 100%; height: 24px; overflow: visible; }

/* ---------- Photos ---------- */
.photo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.photo-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 17px;
  padding: 12px; box-shadow: var(--shadow-sm);
}
.photo-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 2px 9px; }
.photo-date { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; }
.photo-date .seq { font: 650 9.5px/1 var(--num); color: var(--muted-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 3px 4px; }
.photo-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-thumb {
  position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo-thumb:hover img { transform: scale(1.03); }
.photo-thumb .thumb-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted-2); font-size: 9.5px; }
.photo-thumb .thumb-empty .icon { width: 17px; height: 17px; }
.photo-thumb .angle-tag {
  position: absolute; left: 5px; bottom: 5px; background: rgba(13, 30, 23, .62); color: #fff;
  font-size: 8.5px; padding: 1px 5px; border-radius: 4px; letter-spacing: .04em;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.photo-thumb .replace-hint {
  position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.65));
  color: #fff; font-size: 9px; padding: 14px 4px 4px; opacity: 0; transition: opacity .18s; text-align: center;
}
.photo-thumb:hover .replace-hint { opacity: 1; }
.photo-thumb.is-uploading { pointer-events: none; }
.photo-thumb.is-uploading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite;
}
.photo-add {
  border: 1px dashed var(--line-strong); border-radius: 17px; min-height: 190px;
  background: rgba(255,255,255,.35); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 7px; color: var(--muted); font-size: 12.5px; padding: 20px;
}
.photo-add:hover { border-color: var(--green-3); color: var(--green-3); background: rgba(255,255,255,.55); }
.photo-add .plus-ring { width: 38px; height: 38px; border-radius: 50%; border: 1px dashed var(--line-strong); display: grid; place-content: center; }
.photo-add small { font-size: 10px; color: var(--muted-2); }

.compare-shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; max-width: 920px; margin-left: auto; margin-right: auto; }
.compare-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.compare-bar .spacer { flex: 1; }
.compare-select { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.compare-select select { width: auto; min-width: 130px; height: 36px; font-size: 12.5px; }
.compare-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-col { min-width: 0; }
.compare-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 7px; font-size: 11px; color: var(--muted); }
.compare-label b { color: var(--ink-2); font-size: 12px; font-weight: 650; }
.compare-img {
  aspect-ratio: 3 / 4; border-radius: 13px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted-2); font-size: 11.5px;
  position: relative;
}
.compare-img img { width: 100%; height: 100%; object-fit: contain; background: #f7f5ee; }
.compare-img[data-action] { cursor: zoom-in; }
.compare-img .cmp-tag {
  position: absolute; left: 8px; top: 8px; background: rgba(13,30,23,.58); color: #fff;
  font-size: 9.5px; padding: 2px 6px; border-radius: 5px; letter-spacing: .04em;
}
.compare-note { margin-top: 13px; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.compare-angle { display: inline-flex; }
.compare-hint { font-size: 10.5px; color: var(--muted-2); display: flex; align-items: center; gap: 5px; }

/* ---------- Training ---------- */
.phase-stack { display: flex; flex-direction: column; gap: 14px; }
.phase-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.phase-head { display: flex; align-items: center; gap: 12px; padding: 17px 20px 13px; }
.phase-num {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-content: center;
  background: var(--surface-2); border: 1px solid var(--line); font: 700 11px/1 var(--num);
  color: var(--green-3); flex: none; letter-spacing: .02em;
}
.phase-card:nth-child(2) .phase-num { background: #eef4e6; border-color: #dae6cc; }
.phase-card:nth-child(3) .phase-num { background: #f4efe2; border-color: #e8ddc4; color: #8a6520; }
.phase-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.phase-en { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }
.phase-count { margin-left: auto; font-size: 10.5px; color: var(--muted-2); }
.phase-body { padding: 0 20px 16px; }
.phase-note {
  display: flex; align-items: flex-start; gap: 7px; background: #fbfaf5; border: 1px solid #efecE3;
  border-radius: 10px; padding: 8px 11px; margin-bottom: 10px; font-size: 11.5px; color: var(--ink-2);
  line-height: 1.6; cursor: text;
}
.phase-note .icon { color: var(--muted-2); flex: none; margin-top: 2px; }
.phase-note.is-blank { color: var(--muted-2); }
.phase-note input {
  border: 0; background: transparent; padding: 0; height: auto; font-size: 11.5px; line-height: 1.6;
  box-shadow: none; border-radius: 0;
}
.phase-note input:focus { box-shadow: none; }
.plan-rows { display: flex; flex-direction: column; gap: 7px; }
.plan-row {
  display: grid; grid-template-columns: minmax(120px, 1.7fr) 62px 74px 92px 78px minmax(90px, 1fr) 30px;
  gap: 6px; align-items: center; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface); transition: border-color .14s;
}
.plan-row:hover { border-color: var(--line-strong); }
.plan-row input { height: 33px; border-color: transparent; background: var(--surface-2); border-radius: 7px; font-size: 11.5px; padding: 0 8px; }
.plan-row input:hover { border-color: var(--line); }
.plan-row input:focus { background: #fff; }
.plan-row .plan-exercise { background: transparent; font-weight: 600; font-size: 12px; }
.plan-cell { display: block; min-width: 0; }
.plan-row .row-num { font: 600 9px/1 var(--num); color: var(--muted-2); text-align: center; }
.plan-delete {
  width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent;
  color: var(--muted-2); display: grid; place-content: center; opacity: .55;
}
.plan-row:hover .plan-delete { opacity: 1; }
.plan-delete:hover { background: var(--coral-soft); color: #a84524; }
.plan-empty { padding: 16px; border: 1px dashed var(--line); border-radius: 11px; text-align: center; font-size: 11.5px; color: var(--muted-2); }
.plan-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.plan-foot .spacer { flex: 1; }
.plan-label-row {
  display: grid; grid-template-columns: minmax(120px, 1.7fr) 62px 74px 92px 78px minmax(90px, 1fr) 30px;
  gap: 6px; padding: 0 8px 1px; font-size: 9px; color: var(--muted-2); letter-spacing: .05em;
}
.plan-foot .link-btn { font-size: 11.5px; }

/* ---------- Diet ---------- */
.diet-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.diet-head { padding: 18px 20px 12px; display: flex; align-items: center; gap: 10px; }
.diet-head h3 { font-size: 15.5px; font-weight: 700; }
.diet-head .spacer { flex: 1; }
.diet-list { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 7px; }
.diet-label-row { display: grid; grid-template-columns: 96px 76px minmax(160px, 2fr) 100px minmax(90px, 1fr) 30px; gap: 6px; padding: 0 8px 1px; font-size: 9px; color: var(--muted-2); letter-spacing: .05em; }
.diet-row {
  display: grid; grid-template-columns: 96px 76px minmax(160px, 2fr) 100px minmax(90px, 1fr) 30px;
  gap: 6px; align-items: center; padding: 7px 8px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--surface);
}
.diet-row input { height: 33px; border-color: transparent; background: var(--surface-2); border-radius: 7px; font-size: 11.5px; padding: 0 8px; }
.diet-row input:hover { border-color: var(--line); }
.diet-row input:focus { background: #fff; }
.diet-row input.meal-input { background: transparent; font-weight: 650; font-size: 12px; }
.diet-row:hover { border-color: var(--line-strong); }
.diet-empty { padding: 22px 16px; border: 1px dashed var(--line); border-radius: 11px; text-align: center; font-size: 11.5px; color: var(--muted-2); }
.diet-foot { padding: 0 20px 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diet-note { margin: 0 20px 14px; }
.diet-note textarea { min-height: 66px; font-size: 12px; background: #fbfaf5; }

/* ---------- Settings ---------- */
.settings-page { max-width: 820px; }
.settings-head { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.settings-head h1 { font-size: 30px; letter-spacing: -0.04em; font-weight: 780; }
.settings-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.setting-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.setting-card + .setting-card { margin-top: 14px; }
.setting-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 17px; }
.setting-card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.setting-card-head p { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.6; }
.setting-card-head .icon-box { width: 32px; height: 32px; border-radius: 9px; background: #eef3ea; color: var(--green-3); display: grid; place-content: center; flex: none; }
.coach-manage-list { display: flex; flex-direction: column; gap: 8px; }
.coach-manage-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-2);
}
.coach-manage-row .coach-avatar { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.coach-manage-row .coach-avatar::after { width: 14px; height: 14px; line-height: 14px; font-size: 8px; right: -3px; bottom: -3px; }
.coach-manage-info { min-width: 0; line-height: 1.35; }
.coach-manage-info b { font-size: 13px; font-weight: 650; display: block; }
.coach-manage-info span { font-size: 10.5px; color: var(--muted-2); }
.coach-manage-actions { margin-left: auto; display: flex; gap: 2px; }
.url-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.url-box input { flex: 1; min-width: 200px; font-size: 12px; background: var(--surface-2); }
.qr-share { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 15px; padding-top: 16px; border-top: 1px dashed var(--line); }
.qr-frame { width: 138px; height: 138px; border-radius: 13px; background: #fff; border: 1px solid var(--line); padding: 9px; flex: none; display: grid; place-items: center; }
.qr-frame svg { width: 100%; height: 100%; display: block; }
.qr-copy { min-width: 200px; flex: 1; }
.qr-copy h4 { font-size: 13px; font-weight: 650; margin-bottom: 4px; }
.qr-copy p { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.qr-copy .btn { margin-top: 10px; }
.share-steps { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.share-steps li { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.share-steps .step-n { width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: var(--lime); font: 650 9px/16px var(--num); text-align: center; flex: none; margin-top: 1px; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-row:first-child { padding-top: 0; }
.setting-row-info { min-width: 0; flex: 1; }
.setting-row-info b { font-size: 12.5px; font-weight: 600; display: block; }
.setting-row-info span { font-size: 10.5px; color: var(--muted); display: block; margin-top: 1px; line-height: 1.5; }
.danger-zone { border-color: #edd3c7; background: #fffaf7; }
.danger-zone .setting-card-head .icon-box { background: var(--coral-soft); color: #a84524; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.about-line { font-size: 11px; color: var(--muted-2); margin-top: 10px; line-height: 1.7; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(16, 26, 21, 0.42);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: overlayIn .18s ease;
}
@keyframes overlayIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px; max-height: min(88vh, 780px); overflow: auto;
  background: var(--surface); border-radius: 22px; box-shadow: 0 40px 100px -30px rgba(10, 30, 22, .5);
  animation: modalIn .22s cubic-bezier(.2, .8, .2, 1); border: 1px solid rgba(255,255,255,.5);
}
.modal.wide { max-width: 680px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 0; }
.modal-head h2 { font-size: 18px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.3; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.modal-close { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--surface-2); color: var(--muted); display: grid; place-content: center; flex: none; }
.modal-close:hover { background: var(--bg-deep); color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 14px 24px 20px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal-foot .spacer { flex: 1; }
.modal-foot .btn { min-width: 76px; }
.modal-note { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; line-height: 1.65; margin-top: 14px; }
.modal-note strong { color: var(--ink-2); }

.record-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.record-grid .span-2 { grid-column: span 2; }
.record-field { position: relative; }
.record-field label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.record-field label .unit { font-weight: 500; color: var(--muted-2); font-size: 9.5px; }
.record-field input { height: 40px; font-family: var(--num); font-size: 15px; letter-spacing: 0.01em; }
.record-field .auto-hint { font-size: 9px; color: var(--green-3); margin-top: 3px; }
.date-field { max-width: 200px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 8px; background: #16251d; color: #f5f7ef;
  font-size: 12.5px; padding: 10px 15px; border-radius: 999px; box-shadow: 0 14px 30px -12px rgba(0,0,0,.45);
  animation: toastIn .24s cubic-bezier(.2,.8,.2,1); max-width: 100%;
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast .icon { width: 15px; height: 15px; color: var(--lime); flex: none; }
.toast.error .icon { color: #ffb49b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(7px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(4px); } }

/* ---------- Banner ---------- */
.sync-banner {
  display: flex; align-items: center; gap: 9px; background: var(--lime-soft); border: 1px solid #dfeaa6;
  color: #42501a; border-radius: 11px; padding: 9px 13px; font-size: 11.5px; margin-bottom: 16px;
}
.sync-banner .btn { margin-left: auto; }
.sync-banner .icon { width: 15px; height: 15px; flex: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 150; background: rgba(9, 16, 12, 0.92);
  display: flex; flex-direction: column; animation: overlayIn .18s; padding: 20px;
}
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.7); font-size: 12px; padding: 0 2px 12px; flex: none; }
.lightbox-bar button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; display: grid; place-content: center; }
.lightbox-img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.lightbox-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

/* ---------- Sparkline defs ---------- */
.chart-svg { overflow: visible; }

/* ---------- Print ---------- */
.print-root { display: none; }
.print-doc { color: #111; font-size: 11px; }
.print-doc .print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #173f33; padding-bottom: 10px; margin-bottom: 14px; }
.print-doc .print-brand { font-size: 16px; font-weight: 800; color: #173f33; letter-spacing: -.02em; }
.print-doc .print-brand small { display: block; font-size: 8px; letter-spacing: .18em; color: #666; font-weight: 600; margin-top: 2px; }
.print-doc .print-name { font-size: 24px; font-weight: 750; margin-bottom: 4px; letter-spacing: -.02em; }
.print-doc .print-meta { color: #555; font-size: 9.5px; line-height: 1.7; }
.print-section { margin-top: 14px; break-inside: avoid; }
.print-section h3 { font-size: 11px; font-weight: 700; color: #173f33; border-left: 3px solid #173f33; padding-left: 7px; margin-bottom: 7px; text-transform: uppercase; letter-spacing: .08em; }
.print-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.print-table th, .print-table td { border: 1px solid #d9d6cb; padding: 4px 5px; text-align: left; vertical-align: top; }
.print-table th { background: #f3f1e9; font-weight: 650; color: #333; }
.print-table td.c, .print-table th.c { text-align: center; }
.print-kv { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 9.5px; color: #333; }
.print-kv b { font-weight: 650; }
.print-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.print-photo { border: 1px solid #ddd; padding: 3px; break-inside: avoid; }
.print-photo img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.print-table img { height: 105px !important; object-fit: contain; background: #f7f5ee; }
.print-photo span { display: block; text-align: center; font-size: 8px; color: #666; margin-top: 2px; }
.print-foot { margin-top: 18px; border-top: 1px solid #ccc; padding-top: 6px; display: flex; justify-content: space-between; font-size: 8px; color: #888; }

@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  body { font-size: 10px; }
  #app, #modal-root, #toast-root { display: none !important; }
  .print-root { display: block !important; }
  .print-section { break-inside: avoid; }
  .print-doc .print-head { position: static; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { padding: 30px 28px 26px; }
  .hero-main { align-items: flex-start; flex-direction: column; gap: 22px; }
  .hero-side { width: 100%; justify-content: space-between; }
  .hero-stats { margin-left: 0; }
  .member-list-head { display: none; }
  .member-row { grid-template-columns: 38px minmax(110px, 1.4fr) 1fr 0.9fr 18px; }
  .mem-goal, .mem-updated, .mem-coach { display: none; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid .span-3 { grid-column: span 2; }
  .quick-strip { grid-template-columns: repeat(2, 1fr); }
  .plan-row { grid-template-columns: minmax(110px, 1.7fr) 56px 66px 84px 70px 30px; }
  .plan-row .plan-note-field { display: none; }
  .plan-cell.note-cell { display: none; }
  .plan-label-row { grid-template-columns: minmax(110px, 1.7fr) 56px 66px 84px 70px 30px; }
  .plan-label-row span:nth-child(6), .plan-cell.note-cell { display: none; }
  .diet-row { grid-template-columns: 86px 68px minmax(140px, 2fr) 88px 30px; }
  .diet-row .diet-note-field { display: none; }
  .diet-label-row { grid-template-columns: 86px 68px minmax(140px, 2fr) 88px 30px; }
  .diet-label-row span:nth-child(5) { display: none; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 60px; }
  body { font-size: 14.5px; }
  .topbar-inner { padding: 0 16px; gap: 10px; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 15px; }
  .page { padding: 18px 15px 70px; }
  .page > * + * { margin-top: 20px; }
  .hero { border-radius: 22px; padding: 25px 22px 22px; min-height: 218px; }
  .hero h1 { font-size: 33px; }
  .hero-sub { font-size: 12.5px; }
  .hero-side { flex-direction: column; align-items: stretch; gap: 16px; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
  .hero-stat { padding: 0 14px; }
  .hero-stat b { font-size: 23px; }
  .hero-stat span { font-size: 10.5px; }
  .hero-cta { margin-top: 18px; }
  .hero-cta .btn { flex: 1; }
  .coach-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .coach-card { padding: 13px; gap: 10px; border-radius: 15px; min-height: 70px; }
  .coach-avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
  .coach-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .coach-meta { display: none; }
  .coach-count span { display: none; }
  .coach-count b { font-size: 18px; }
  .coach-count b { font-size: 16px; }
  .coach-add { min-height: 70px; font-size: 12px; }
  .section-title { font-size: 19px; }
  .member-list { gap: 7px; }
  .member-row { grid-template-columns: 38px minmax(95px, 1.3fr) 1fr 16px; gap: 10px; padding: 11px 13px; border-radius: 13px; }
  .member-row .mem-metric:not(.primary) { display: none; }
  .mem-goal { display: none; }
  .mem-updated { display: none; }
  .mem-coach { display: none; }
  .mem-name { font-size: 14px; }
  .search { max-width: none; flex-basis: 100%; }
  .result-count { display: none; }
  .toolbar > .btn { display: none; }
  .member-page { padding-top: 8px; }
  .member-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: start; gap: 2px 13px; padding-bottom: 16px; }
  .member-avatar-lg { width: 56px; height: 56px; border-radius: 17px; font-size: 22px; grid-row: 1; }
  .member-identity { grid-column: 2; }
  .member-title h1 { font-size: 24px; }
  .member-meta { font-size: 11.5px; gap: 3px 10px; }
  .member-actions { grid-column: 1 / -1; margin-left: 0; width: auto; justify-content: flex-end; margin-top: 10px; }
  .member-actions .btn { flex: none; }
  .quick-strip { gap: 7px; margin-bottom: 3px; }
  .qs-item { padding: 10px 12px 9px; border-radius: 12px; }
  .qs-value { font-size: 20px; }
  .qs-label { font-size: 10px; }
  .spark { width: 48px; height: 20px; }
  .tabs-wrap { margin: 0 -15px; padding: 0 15px; top: calc(var(--topbar-h) + var(--safe-top)); }
  .tabs-wrap::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 26px; pointer-events: none; background: linear-gradient(90deg, rgba(242, 239, 231, 0), rgba(242, 239, 231, .96)); }
  .tab { padding: 12px 10px 11px; font-size: 12.5px; }
  .tab .count-dot { display: none; }
  .panel { padding-top: 18px; }
  .panel-head { gap: 10px; margin-bottom: 13px; }
  .panel-title { font-size: 18px; }
  .panel-head .section-actions { width: 100%; margin-left: 0; }
  .panel-head .section-actions .btn { width: 100%; }
  .info-card { padding: 17px 15px; border-radius: 17px; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 13px 10px; }
  .info-grid .span-3 { grid-column: span 2; }
  .info-grid .span-2 { grid-column: span 2; }
  .table-wrap { border-radius: 15px; margin: 0 -4px; }
  .cmp-corner { width: 104px; min-width: 104px; padding: 11px 10px !important; }
  .cmp-metric { width: 104px; min-width: 104px; padding: 9px 10px !important; }
  .cmp-metric b { font-size: 11px; }
  .cmp-material { font-size: 9px; }
  .cmp-value { font-size: 13px; padding: 9px 4px !important; width: 76px; min-width: 76px; }
  .cmp-record-head { width: 76px; min-width: 76px; padding: 8px 4px !important; }
  .cmp-table.dense { min-width: 892px; }
  .cmp-table.dense .cmp-metric { width: 100px; min-width: 100px; }
  .cmp-table.dense .cmp-record-head, .cmp-table.dense .cmp-value { width: 66px; min-width: 66px; }
  .delta-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .delta-card { padding: 11px 12px 10px; border-radius: 12px; }
  .delta-big { font-size: 19px; }
  .delta-name { font-size: 10.5px; }
  .delta-base { font-size: 9px; }
  .delta-legend { display: none; }
  .photo-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .photo-card { padding: 8px; border-radius: 13px; }
  .photo-thumbs { gap: 4px; }
  .photo-date { font-size: 11px; }
  .photo-thumb { border-radius: 7px; }
  .photo-add { min-height: 160px; border-radius: 13px; }
  .compare-shell { padding: 13px; border-radius: 15px; }
  .compare-bar { gap: 7px; margin-bottom: 12px; }
  .compare-select { flex: 1 0 100%; }
  .compare-select select { min-width: 0; width: auto; flex: 1; }
  .compare-bar .spacer { display: none; }
  .compare-angle { display: flex; width: 100%; }
  .compare-angle button { flex: 1; }
  .compare-hint { display: none; }
  .phase-head { padding: 14px 15px 10px; }
  .phase-body { padding: 0 14px 14px; }
  .phase-note { margin-bottom: 8px; }
  .plan-row {
    grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 8px; position: relative;
  }
  .plan-row input { height: 34px; }
  .plan-cell.is-exercise { grid-column: span 4; }
  .plan-cell { display: flex; flex-direction: column; gap: 3px; }
  .plan-cell::before { content: attr(data-label); font-size: 8px; color: var(--muted-2); letter-spacing: .04em; padding-left: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .plan-cell.is-exercise::before { display: none; }
  .diet-label-row { display: none; }
  .plan-label-row { display: none; }
  .plan-row .plan-note-field { display: none; }
  .plan-row .plan-delete { position: absolute; right: 5px; top: 5px; }
  .plan-row .plan-exercise { padding-right: 34px; }
  .plan-row .row-num { display: none; }
  .plan-foot { gap: 6px; }
  .plan-foot .spacer { display: none; }
  .plan-label-row { display: none; }
  .diet-head { padding: 15px 15px 10px; }
  .diet-list { padding: 0 14px 12px; }
  .diet-row { grid-template-columns: 1fr 1fr; gap: 5px; padding: 8px; position: relative; }
  .diet-row .diet-food { grid-column: span 2; }
  .diet-row .diet-note-field { display: none; }
  .diet-row .plan-delete { position: absolute; right: 5px; top: 5px; }
  .diet-row .diet-food { padding-right: 34px; }
  .diet-note { margin: 0 14px 12px; }
  .diet-foot { padding: 0 14px 15px; }
  .settings-head h1 { font-size: 25px; }
  .setting-card { padding: 17px; border-radius: 17px; }
  .qr-share { gap: 12px; flex-wrap: nowrap; }
  .qr-frame { width: 104px; height: 104px; padding: 7px; }
  .qr-copy { min-width: 0; }
  .qr-copy p { font-size: 11px; }
  .qr-copy .share-steps { font-size: 10.5px; gap: 5px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; animation: sheetIn .26s cubic-bezier(.2,.8,.2,1); padding-bottom: var(--safe-bottom); }
  @keyframes sheetIn { from { transform: translateY(30px); opacity: .8; } }
  .modal-head { padding: 20px 18px 0; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px 16px; }
  .record-grid { gap: 11px 9px; }
  .editor-chip { height: 32px; padding: 0 10px; }
  .editor-chip .who { max-width: 62px; }
  .back-link { max-width: 32vw; }
  .top-actions .btn-label { display: none; }
  .top-actions .btn { padding: 0 12px; }
  .member-actions .btn { flex: none; }
  .print-doc { font-size: 10px; }
}

@media (max-width: 480px) {
  .photo-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .hero { padding: 21px 18px 18px; }
  .hero h1 { font-size: 30px; }
  .hero-stat { padding: 0 10px; }
  .member-row { grid-template-columns: 36px minmax(90px, 1.4fr) 1fr 14px; }
  .delta-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
  .photo-add { min-height: 140px; }
  .qs-item { padding: 9px 10px; }
  .qs-value { font-size: 18px; }
  .tab { padding: 11px 9px; font-size: 12px; }
}

@media (hover: none) {
  .photo-thumb .replace-hint { opacity: 1; }
  .rec-edit { opacity: .6; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Additions: status / tips / photo upload / colors ---------- */
.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.status-item { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.status-label { font-size: 10.5px; color: var(--muted); }
.status-value { font: 650 22px/1.1 var(--num); letter-spacing: -0.03em; color: var(--ink); }
.status-value em { font: 500 10px/1 var(--font); color: var(--muted-2); font-style: normal; margin-left: 3px; letter-spacing: 0; }
.status-bar { display: block; height: 3px; border-radius: 3px; background: var(--bg-deep); overflow: hidden; margin-top: 3px; }
.status-bar i { display: block; height: 100%; background: var(--green-3); border-radius: 3px; }
.status-extra { font-size: 10px; color: var(--muted-2); }

.tip-box {
  display: flex; align-items: flex-start; gap: 8px; padding: 11px 14px;
  border: 1px dashed var(--line-strong); border-radius: 12px; background: rgba(255,255,255,.45);
  font-size: 11.5px; color: var(--muted); line-height: 1.65; margin-bottom: 12px;
}
.tip-box .icon { color: var(--green-3); flex: none; margin-top: 1px; }

.thumb-edit {
  position: absolute; right: 4px; top: 4px; width: 25px; height: 25px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(13, 30, 23, .55); color: #fff;
  display: grid; place-content: center; opacity: 0; transition: opacity .16s; padding: 0;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.thumb-edit .icon { width: 13px; height: 13px; }
.photo-thumb:hover .thumb-edit { opacity: 1; }
.photo-thumb .thumb-edit:hover { background: rgba(13, 30, 23, .78); }
.photo-note { font-size: 10.5px; color: var(--muted); padding: 7px 2px 0; line-height: 1.5; }
.photo-thumb.is-uploading::before {
  content: ""; position: absolute; inset: 0; background: rgba(13, 30, 23, .45); z-index: 1;
}
.photo-thumb.is-uploading::after { z-index: 2; }

.color-row { display: grid; grid-template-columns: repeat(10, minmax(24px, 34px)); gap: 8px; align-items: center; }
.color-swatch { width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; position: relative; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.color-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.color-swatch span { position: absolute; inset: 0; border-radius: 50%; }
.color-swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4.5px #17221c; }
.color-swatch:has(input:checked) { outline: none; }

@media (max-width: 760px) {
  .status-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .color-row { grid-template-columns: repeat(5, 34px); gap: 9px; }
  .status-value { font-size: 19px; }
  .thumb-edit { opacity: 1; width: 23px; height: 23px; }
  .member-actions .btn-label { display: none; }
}

@media (max-width: 760px) {
  .color-row { grid-template-columns: repeat(5, 34px); gap: 9px; }
}

/* ---------- Coach update rhythm ---------- */
.coach-meta.is-zero { color: var(--amber); }
.activity-totals { display: flex; gap: 7px; flex-wrap: wrap; }
.activity-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.activity-head {
  display: grid; grid-template-columns: minmax(180px, 1.5fr) 120px 120px 100px 18px;
  gap: 14px; align-items: center; padding: 10px 18px;
  border-bottom: 1px solid var(--line); background: #fbfaf5;
  font-size: 9.5px; color: var(--muted-2); letter-spacing: .08em; text-transform: uppercase; font-weight: 650;
}
.activity-row {
  position: relative;
  display: grid; grid-template-columns: minmax(180px, 1.5fr) 120px 120px 100px 18px;
  gap: 14px; align-items: center; width: 100%; padding: 12px 18px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  text-align: left; transition: background .15s; color: inherit;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: var(--surface-2); }
.activity-coach { display: flex; align-items: center; gap: 10px; min-width: 0; }
.activity-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-content: center;
  color: #fff; font: 700 12px/1 var(--num); letter-spacing: -0.02em;
}
.activity-info { min-width: 0; line-height: 1.3; }
.activity-info b { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; }
.activity-info b em {
  font-style: normal; font-size: 8.5px; line-height: 1; padding: 2px 4px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.activity-info small { display: block; font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.activity-info .mobile-only { display: none; }
.activity-cell { min-width: 0; }
.activity-cell b { font: 650 18px/1.1 var(--num); display: block; color: var(--ink); letter-spacing: -0.02em; }
.activity-cell span { display: block; font-size: 9.5px; color: var(--muted-2); margin-top: 2px; white-space: nowrap; }
.activity-row.is-zero .activity-week b { color: var(--amber); }
.activity-week b { color: var(--green-3); }
.activity-bar { display: block; height: 3px; width: 100%; border-radius: 3px; background: var(--bg-deep); overflow: hidden; margin-top: 5px; }
.activity-bar i { display: block; height: 100%; border-radius: 3px; background: var(--green-3); }
.activity-row.is-zero .activity-bar i { background: var(--amber); }
.activity-last b { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.activity-chev { color: var(--line-strong); display: flex; justify-content: flex-end; }
.activity-row:hover .activity-chev { color: var(--green-3); }

@media (max-width: 760px) {
  .activity-head { display: none; }
  .activity-row {
    grid-template-columns: 1fr 1fr; gap: 13px 12px; padding: 14px 15px;
  }
  .activity-coach { grid-column: 1 / -1; }
  .activity-chev { position: absolute; right: 14px; top: 16px; display: flex; }
  .activity-cell b { font-size: 21px; }
  .activity-week::before, .activity-month::before {
    content: attr(data-label); display: block; font-size: 9px; color: var(--muted-2);
    letter-spacing: .05em; margin-bottom: 3px;
  }
  .activity-last { display: none; }
  .activity-info .mobile-only { display: inline; }
}

/* ---------- 12-month goals ---------- */
.goals-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 16px;
}
.goals-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.goals-head-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.goals-icon {
  width: 32px; height: 32px; border-radius: 9px; background: #eef3ea; color: var(--green-3);
  display: grid; place-content: center; flex: none;
}
.goals-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.goals-head p { font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.goals-count { flex: none; text-align: right; line-height: 1.1; }
.goals-count b { font: 650 26px/1 var(--num); color: var(--green-3); letter-spacing: -0.03em; }
.goals-count span { display: block; font-size: 9.5px; color: var(--muted-2); margin-top: 4px; white-space: nowrap; }
.goals-bar { height: 5px; border-radius: 5px; background: var(--bg-deep); overflow: hidden; margin: 14px 0 16px; }
.goals-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--green-3), #6b9f65); transition: width .25s ease; }
.goals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.month-goal {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px 11px;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.month-goal.is-done { border-color: #cfe2d2; background: #f7fbf4; }
.month-goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.month-label { display: inline-flex; align-items: baseline; gap: 3px; color: var(--muted); font-size: 9.5px; letter-spacing: .04em; }
.month-label b { font: 650 16px/1 var(--num); color: var(--ink-2); letter-spacing: -0.02em; }
.month-check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 9.5px; color: var(--muted); user-select: none; }
.month-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.month-check-box {
  width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); display: grid; place-content: center; color: transparent;
  transition: background .15s, border-color .15s, color .15s; flex: none;
}
.month-check-box .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.month-check input:checked + .month-check-box { background: var(--green); border-color: var(--green); color: var(--lime); }
.month-check input:focus-visible + .month-check-box { outline: 2px solid var(--green-3); outline-offset: 2px; }
.month-check-text { white-space: nowrap; }
.month-goal.is-done .month-check-text { color: var(--green-3); font-weight: 600; }
.month-goal-input { height: 36px; font-size: 12px; border-color: transparent; background: var(--surface-2); border-radius: 8px; }
.month-goal-input:focus { background: #fff; }
.month-goal.is-done .month-goal-input { background: #fff; }
.plan-subhead {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 22px 2px 10px; font-size: 10px; font-weight: 700; color: var(--muted-2);
  letter-spacing: .1em; text-transform: uppercase;
}
.plan-subhead span:last-child { font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 10.5px; }

@media (max-width: 760px) {
  .goals-card { padding: 16px; border-radius: 17px; }
  .goals-head { gap: 10px; }
  .goals-head h3 { font-size: 14px; }
  .goals-count b { font-size: 22px; }
  .goals-grid { grid-template-columns: 1fr; gap: 8px; }
  .month-goal { padding: 10px 11px; }
  .plan-subhead { margin-top: 18px; }
}

@media (max-width: 760px) {
  .url-box input { flex: 1 0 100%; min-width: 0; }
  .url-box .btn { flex: 1; }
}
