@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f2eee3;
  --paper: #fbf8ef;
  --card: #fdfbf4;
  --ink: #10251c;
  --ink-2: #3a4c41;
  --muted: #747c71;
  --faint: #9ba095;
  --line: rgba(16, 37, 28, .1);
  --line-2: rgba(16, 37, 28, .17);
  --forest: #103326;
  --forest-2: #174432;
  --teal: #1f6d58;
  --teal-soft: #e6f1eb;
  --lime: #d9f76b;
  --lime-soft: #eef8c9;
  --amber: #9a6b25;
  --amber-soft: #f6eed9;
  --clay: #d97b55;
  --clay-soft: #f8e9e0;
  --violet: #6c5b95;
  --violet-soft: #efebf7;
  --blue: #2f6290;
  --blue-soft: #e8f0f7;
  --red: #b14b33;
  --red-soft: #f7e7e2;
  --sage: #a9c6b4;
  --white: #fffef9;
  --display: 'Archivo', 'PingFang SC', 'HarmonyOS Sans SC', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
  --sans: 'Archivo', 'PingFang SC', 'HarmonyOS Sans SC', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
  --r: 20px;
  --r-sm: 13px;
  --shadow: 0 18px 44px -34px rgba(16, 37, 28, .42);
  --shadow-lg: 0 36px 80px -40px rgba(16, 37, 28, .5);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--lime); color: var(--ink); }
[hidden] { display: none !important; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  background: var(--lime);
  color: var(--forest);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.03em;
}
.brand-mark.small { min-width: 52px; height: 27px; font-size: 12px; }
.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--faint);
}
.lime-text { color: var(--lime); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); flex: none; }

/* ---------------- gate ---------------- */
.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  background: var(--bg);
}
.gate-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 42px;
  padding: 40px 54px 34px;
  overflow: hidden;
  color: var(--paper);
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(217, 247, 107, .16), transparent 58%),
    radial-gradient(80% 70% at -10% 100%, rgba(47, 136, 108, .35), transparent 60%),
    linear-gradient(155deg, #164a35 0%, #103326 55%, #0a261b 100%);
}
.gate-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(70% 70% at 60% 40%, #000, transparent 80%);
  pointer-events: none;
}
.gate-visual > * { position: relative; z-index: 1; }
.gate-visual-top { display: flex; align-items: center; gap: 14px; }
.gate-visual-label { font-size: 9.5px; font-weight: 700; letter-spacing: .18em; color: rgba(255,255,255,.48); }
.gate-copy { max-width: 570px; }
.gate-copy h1 {
  margin: 16px 0 18px;
  font-family: var(--display);
  font-size: clamp(38px, 4.5vw, 64px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 820;
}
.gate-copy > p:last-child { margin: 0; max-width: 490px; font-size: 14px; line-height: 1.8; color: rgba(255,255,255,.62); }
.gate-chart {
  width: min(100%, 560px);
  padding: 18px 20px 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(10px);
}
.gate-chart-head, .gate-chart-foot { display: flex; align-items: center; justify-content: space-between; }
.gate-chart-head span { font-size: 11px; color: rgba(255,255,255,.55); }
.gate-chart-head b { font-family: var(--display); font-size: 13px; color: var(--lime); letter-spacing: -.02em; }
.gate-chart-foot { margin-top: 8px; font-size: 9px; letter-spacing: .1em; color: rgba(255,255,255,.3); }
.gate-bars { display: flex; align-items: flex-end; gap: 7px; height: 98px; margin-top: 14px; }
.gate-bars i { flex: 1; height: var(--h); border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, rgba(217,247,107,.62), rgba(217,247,107,.16)); }
.gate-bars i.hot { background: var(--lime); box-shadow: 0 0 24px rgba(217,247,107,.26); }
.gate-visual-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 9px; font-weight: 650; letter-spacing: .1em; color: rgba(255,255,255,.38); }
.gate-visual-foot span { display: inline-flex; align-items: center; gap: 7px; }
.gate-visual-foot .dot { background: var(--lime); box-shadow: 0 0 0 4px rgba(217,247,107,.12); }

.gate-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: 36px clamp(28px, 6vw, 84px);
  background:
    radial-gradient(90% 50% at 100% 0%, rgba(217,247,107,.25), transparent 60%),
    var(--bg);
}
.gate-form { width: 100%; max-width: 420px; margin: auto; }
.gate-form .eyebrow { margin-bottom: 12px; }
.gate-form h2 { margin: 0 0 10px; font-family: var(--display); font-size: 34px; line-height: 1.1; letter-spacing: -.04em; }
.gate-sub { margin: 0 0 28px; font-size: 13px; line-height: 1.75; color: var(--muted); }
.gate-form label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.gate-form input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card);
  outline: none;
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s;
}
.gate-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(31,109,88,.1); }
.gate-error { margin: 9px 0 0; font-size: 12px; color: var(--red); }
.gate-note { margin: 18px 0 0; font-size: 10.5px; line-height: 1.7; color: var(--faint); }
.gate-panel-foot { display: flex; justify-content: space-between; font-size: 9px; font-weight: 650; letter-spacing: .12em; color: var(--faint); }
.shake { animation: shake .35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 720;
  transition: transform .15s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest); color: var(--paper); }
.btn-primary:hover { background: var(--forest-2); }
.gate-form .btn-primary { background: var(--lime); color: var(--forest); }
.gate-form .btn-primary:hover { background: var(--lime-2, #c8eb54); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-ghost:hover { background: rgba(16,37,28,.045); }
.btn-soft { background: var(--teal-soft); color: var(--teal); }
.btn-soft:hover { background: #dcece4; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #9c3f2a; }
.btn-danger:disabled,
.btn-danger.is-loading { opacity: .5; cursor: not-allowed; pointer-events: none; transform: none; }
.btn-sm { min-height: 32px; padding: 0 11px; border-radius: 8px; font-size: 11px; }
.btn-block { width: 100%; margin-top: 12px; }
.btn .arr { font-size: 15px; line-height: 1; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(253,251,244,.7);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  transition: background .18s, border-color .18s;
}
.icon-btn:hover { background: var(--card); border-color: var(--line-2); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.is-loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
[data-icon] svg, .ico svg { width: 16px; height: 16px; display: block; }

/* ---------------- app shell ---------------- */
.app { display: flex; min-height: 100vh; }
.rail {
  position: sticky;
  top: 0;
  flex: none;
  width: 236px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  color: var(--paper);
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(217,247,107,.1), transparent 55%),
    linear-gradient(170deg, #164431 0%, #103326 58%, #0b2a1f 100%);
  overflow: hidden;
}
.rail::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(75% 60% at 50% 30%, #000, transparent 85%);
  pointer-events: none;
}
.rail > * { position: relative; z-index: 1; }
.rail-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 26px; }
.rail-brand b { display: block; font-family: var(--display); font-size: 14px; letter-spacing: -.01em; }
.rail-brand span:not(.brand-mark) { display: block; margin-top: 2px; font-size: 9px; letter-spacing: .08em; color: rgba(255,255,255,.38); }
.rail-nav { display: flex; flex-direction: column; gap: 4px; }
.rail-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  color: rgba(255,255,255,.58);
  font-size: 12.5px;
  font-weight: 620;
  transition: background .18s, color .18s;
}
.rail-nav a:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); }
.rail-nav a.active { background: rgba(217,247,107,.11); color: var(--lime); }
.rail-nav a.active::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--lime); }
.rail-nav em { margin-left: auto; font-style: normal; font-size: 8px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.22); }
.rail-nav a.active em { color: rgba(217,247,107,.5); }
.nav-ico { width: 17px; height: 17px; display: inline-grid; place-items: center; }
.nav-ico svg { width: 17px; height: 17px; }
.rail-source {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.rail-source-head { display: flex; align-items: center; gap: 7px; font-size: 10.5px; }
.rail-source-head b { font-weight: 680; color: rgba(255,255,255,.82); }
.rail-source-head .dot { background: var(--lime); box-shadow: 0 0 0 4px rgba(217,247,107,.1); }
.rail-source-head span:last-child { margin-left: auto; font-size: 8px; font-weight: 750; letter-spacing: .1em; color: var(--lime); }
.rail-source p { margin: 8px 0 12px; font-size: 9.5px; line-height: 1.65; color: rgba(255,255,255,.4); }
.rail-refresh {
  width: 100%;
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.13);
  color: rgba(255,255,255,.68);
  font-size: 10px;
  font-weight: 650;
  transition: background .18s;
}
.rail-refresh:hover { background: rgba(255,255,255,.08); }
.rail-refresh:disabled { opacity: .45; cursor: default; }
.rail-source.is-error .dot { background: var(--clay); box-shadow: 0 0 0 4px rgba(217,123,85,.14); }
.rail-source.is-error .rail-source-head span:last-child { color: var(--clay); }
.rail-foot { display: flex; flex-direction: column; gap: 2px; padding: 18px 6px 0; font-size: 8px; letter-spacing: .09em; color: rgba(255,255,255,.22); }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(242,238,227,.84);
  backdrop-filter: blur(16px);
}
.tb-title span { display: block; font-size: 8.5px; font-weight: 750; letter-spacing: .18em; color: var(--faint); }
.tb-title h1 { margin: 2px 0 0; font-family: var(--display); font-size: 23px; line-height: 1.15; letter-spacing: -.035em; font-weight: 800; }
.tb-actions { display: flex; align-items: center; gap: 9px; }
.tb-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(253,251,244,.7);
  color: var(--faint);
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.tb-search:focus-within { border-color: var(--teal); background: var(--card); box-shadow: 0 0 0 3px rgba(31,109,88,.08); }
.tb-search .ico svg { width: 15px; height: 15px; }
.tb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; color: var(--ink); }
.tb-search input::placeholder { color: var(--faint); }
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(31,109,88,.18);
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .1em;
}
.mode-chip .dot { background: var(--teal); animation: livedot 2.2s ease-in-out infinite; }
.mode-chip.error { border-color: rgba(177,75,51,.2); background: var(--red-soft); color: var(--red); }
.mode-chip.error .dot { background: var(--red); animation: none; }
@keyframes livedot { 50% { opacity: .35; } }
.view { width: 100%; max-width: 1520px; margin: 0 auto; padding: 24px 28px 64px; }

/* ---------------- page primitives ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head h2 { margin: 4px 0 6px; font-family: var(--display); font-size: 30px; line-height: 1.12; letter-spacing: -.04em; }
.page-head p { margin: 0; max-width: 660px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.meta-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(253,251,244,.55);
  font-size: 9.5px;
  font-weight: 620;
  color: var(--muted);
  white-space: nowrap;
}
.meta-chip b { color: var(--ink-2); font-weight: 720; }
.meta-chip .dot { width: 5px; height: 5px; background: var(--teal); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.card-head h3 { margin: 0; font-family: var(--display); font-size: 15px; letter-spacing: -.02em; font-weight: 760; }
.card-head p { margin: 3px 0 0; font-size: 10px; color: var(--muted); }
.card-head .right { flex: none; display: flex; align-items: center; gap: 6px; }
.card-body { padding: 16px 20px 20px; }
.sec-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 2px 10px; }
.sec-title h3 { margin: 0; font-family: var(--display); font-size: 16px; letter-spacing: -.02em; }
.sec-title p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); }
.sec-title .right { display: flex; align-items: center; gap: 8px; }
.text-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--teal); }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn svg { width: 12px; height: 12px; }
.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: var(--display);
  font-weight: 750;
  letter-spacing: -.02em;
  flex: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.avatar.md { width: 36px; height: 36px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.active { background: var(--teal-soft); color: var(--teal); }
.status.cooling { background: var(--amber-soft); color: var(--amber); }
.status.quiet { background: rgba(16,37,28,.06); color: var(--muted); }
.status.dormant { background: var(--red-soft); color: var(--red); }
.status.none { background: rgba(16,37,28,.05); color: var(--faint); }
.goal-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--ink-2); white-space: nowrap; }
.goal-tag i { width: 6px; height: 6px; border-radius: 2px; background: var(--sage); }
.goal-tag.muscle i { background: var(--teal); }
.goal-tag.strength i { background: var(--amber); }
.goal-tag.shape i { background: var(--violet); }
.goal-tag.habit i { background: var(--blue); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; }

/* ---------------- overview ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.kpi {
  position: relative;
  min-height: 132px;
  padding: 17px 18px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -34px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,247,107,.22), transparent 70%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 10.5px; font-weight: 650; color: var(--muted); }
.kpi-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); }
.kpi-ico svg { width: 15px; height: 15px; }
.kpi-ico.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-ico.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-ico.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-value { display: flex; align-items: baseline; gap: 5px; margin-top: 11px; font-family: var(--display); font-size: 34px; line-height: 1; font-weight: 820; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-family: var(--sans); font-size: 10px; font-weight: 650; letter-spacing: 0; color: var(--faint); }
.kpi-sub { margin-top: 9px; font-size: 10px; line-height: 1.5; color: var(--muted); }
.kpi-sub b { font-weight: 750; color: var(--teal); }
.kpi-sub.warn b { color: var(--amber); }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(310px, .82fr); gap: 13px; margin-top: 13px; }
.ov-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.legend { display: flex; align-items: center; gap: 12px; font-size: 9px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; background: var(--teal); }
.legend i.line { height: 2px; border-radius: 2px; background: var(--clay); }
.legend i.line.blue { background: var(--blue); }
.legend i.lime { background: var(--lime); }
.legend i.minutes { background: var(--blue); opacity: .35; }
.chart-box { position: relative; padding: 8px 10px 0; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid-line { stroke: rgba(16,37,28,.08); stroke-width: 1; }
.chart-svg .axis-text { fill: #9ba095; font-family: var(--sans); font-size: 9px; }
.chart-svg .axis-text.right { fill: #b5826e; }
.chart-svg .bar { fill: var(--teal); opacity: .85; }
.chart-svg .bar:hover { opacity: 1; }
.chart-svg .bar.hot { fill: var(--forest); }
.chart-svg .area { fill: url(#volArea); }
.chart-svg .line { fill: none; stroke: var(--clay); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .dot { fill: var(--clay); stroke: var(--card); stroke-width: 2; }
.chart-svg .x-label { fill: #747c71; font-family: var(--sans); font-size: 8.5px; }
.minutes-svg .mb-bar { fill: var(--blue); opacity: .16; }
.minutes-svg .mb-bar.hot { opacity: .32; }
.minutes-svg .mb-line { fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.minutes-svg .mb-dot { fill: var(--blue); stroke: var(--card); stroke-width: 2; }
.chart-empty { display: grid; place-items: center; min-height: 230px; border-radius: 14px; background: rgba(242,238,227,.5); color: var(--faint); font-size: 11px; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 10px 2px; font-size: 9px; color: var(--faint); }
.chart-foot b { color: var(--ink-2); font-weight: 700; }

.donut-wrap { display: flex; align-items: center; gap: 20px; padding: 12px 4px 6px; }
.donut {
  --active: 0%;
  position: relative;
  flex: none;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) 0 var(--seg1), var(--amber) var(--seg1) var(--seg2), var(--sage) var(--seg2) var(--seg3), #d8d2c3 var(--seg3) 100%);
}
.donut::after { content: ''; position: absolute; inset: 14px; border-radius: 50%; background: var(--card); }
.donut-center { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; }
.donut-center b { font-family: var(--display); font-size: 28px; line-height: 1; font-weight: 820; letter-spacing: -.05em; }
.donut-center span { margin-top: 4px; font-size: 8.5px; color: var(--muted); }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.dl-row { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.dl-row i { width: 7px; height: 7px; border-radius: 2px; background: var(--sage); }
.dl-row:nth-child(1) i { background: var(--teal); }
.dl-row:nth-child(2) i { background: var(--amber); }
.dl-row:nth-child(3) i { background: var(--sage); }
.dl-row:nth-child(4) i { background: #d8d2c3; }
.dl-row b { margin-left: auto; font-family: var(--display); font-size: 12px; color: var(--ink); }
.donut-note { margin: 12px 2px 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 9.5px; line-height: 1.65; color: var(--faint); }

.meter-list { display: flex; flex-direction: column; gap: 13px; }
.meter-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 38px; align-items: center; gap: 10px; }
.meter-label { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--ink-2); white-space: nowrap; }
.meter-label i { width: 7px; height: 7px; border-radius: 2px; }
.meter-track { height: 7px; border-radius: 5px; background: rgba(16,37,28,.06); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--teal); transition: width .5s ease; }
.meter-val { font-family: var(--display); font-size: 11px; font-weight: 720; text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.rank-list { display: flex; flex-direction: column; }
.rank-row { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px 2px; border-top: 1px solid var(--line); }
.rank-row:first-child { border-top: 0; }
.rank-no { font-family: var(--display); font-size: 11px; font-weight: 750; color: var(--faint); }
.rank-main { min-width: 0; }
.rank-name { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; }
.rank-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 4px; margin-top: 6px; border-radius: 3px; background: rgba(16,37,28,.06); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--sage)); }
.rank-val { text-align: right; font-family: var(--display); font-size: 12px; font-weight: 760; font-variant-numeric: tabular-nums; }
.rank-val small { display: block; margin-top: 1px; font-family: var(--sans); font-size: 8.5px; font-weight: 500; color: var(--faint); }

.recent-list { display: flex; flex-direction: column; }
.recent-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); }
.recent-row:first-child { border-top: 0; }
.recent-main { flex: 1; min-width: 0; }
.recent-main b { display: block; font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-main span { display: block; margin-top: 2px; font-size: 9px; color: var(--faint); }
.recent-val { flex: none; text-align: right; font-size: 9px; color: var(--muted); }
.recent-val b { display: block; font-family: var(--display); font-size: 11px; color: var(--ink-2); }

.follow-list { display: flex; flex-direction: column; }
.follow-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.follow-row:first-child { border-top: 0; }
.follow-row:hover .follow-name b { color: var(--teal); }
.follow-main { flex: 1; min-width: 0; }
.follow-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.follow-name b { font-size: 11.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-name .follow-badge { flex: none; }
.follow-main > span { display: block; margin-top: 2px; font-size: 9px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-cta { flex: none; font-size: 9px; color: var(--faint); }
.follow-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(16,37,28,.05); color: var(--muted); font-size: 8px; font-weight: 650; white-space: nowrap; }
.follow-badge i { width: 4px; height: 4px; border-radius: 50%; background: var(--fc, var(--faint)); }
.follow-badge:not(.idle) { background: color-mix(in srgb, var(--fc) 11%, transparent); color: var(--fc); }
.follow-badge.idle { color: var(--faint); }
.follow-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px; text-align: center; color: var(--faint); font-size: 10px; line-height: 1.6; }
.follow-empty svg { color: var(--teal); opacity: .65; }
.follow-empty p { margin: 0; }
.cell-follow { display: block; margin-top: 4px; }

.upload-card { margin-top: 13px; }
.upload-wrap { display: flex; flex-direction: column; gap: 5px; }
.upload-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; }
.upload-svg { display: block; width: 100%; height: auto; overflow: visible; }
.up-bar { fill: var(--teal); opacity: .28; }
.up-bar.hot { fill: var(--forest); opacity: .85; }
.up-bar.empty { fill: rgba(16,37,28,.1); }
.up-count { fill: var(--ink-2); font-family: var(--display); font-size: 9px; font-weight: 700; }
.upload-empty { display: flex; align-items: center; gap: 12px; padding: 14px 4px 4px; color: var(--faint); font-size: 10px; }
.upload-empty span { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); }
.upload-empty p { margin: 0; line-height: 1.6; }

.cohort-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.cohort {
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(242,238,227,.42);
}
.cohort b { font-family: var(--display); font-size: 24px; line-height: 1; font-weight: 800; letter-spacing: -.04em; }
.cohort span { display: block; margin-top: 4px; font-size: 8.5px; line-height: 1.4; color: var(--muted); }
.cohort i { display: block; height: 4px; margin-top: 9px; border-radius: 3px; background: var(--teal); opacity: .75; }

.code-list { display: flex; flex-direction: column; gap: 12px; }
.code-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 42px; align-items: center; gap: 10px; }
.code-name { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--ink-2); }
.code-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--teal-soft); color: var(--teal); font-family: var(--display); font-size: 9px; font-weight: 800; }
.code-track { height: 7px; border-radius: 5px; background: rgba(16,37,28,.06); overflow: hidden; }
.code-track i { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.code-val { text-align: right; font-family: var(--display); font-size: 11px; font-weight: 720; }
.code-val small { display: block; font-family: var(--sans); font-size: 8px; font-weight: 500; color: var(--faint); }

/* ---------------- tables / toolbar ---------------- */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 11px; }
.toolbar .spacer { flex: 1; }
.field { position: relative; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--faint); }
.field svg { width: 14px; height: 14px; }
.field input, .field select { border: 0; outline: 0; background: transparent; font-size: 11px; color: var(--ink); min-width: 0; }
.field input { width: 190px; }
.field select { padding-right: 4px; color: var(--ink-2); cursor: pointer; }
.field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(31,109,88,.07); }
.result-line { display: flex; align-items: center; gap: 8px; margin: 0 2px 9px; font-size: 10px; color: var(--muted); }
.result-line b { color: var(--ink-2); }
.table-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 940px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  text-align: left;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--faint);
  background: rgba(247,243,234,.96);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink-2); }
.data-table th .sort-arrow { margin-left: 3px; font-size: 8px; opacity: .4; }
.data-table th.sorted { color: var(--teal); }
.data-table th.sorted .sort-arrow { opacity: 1; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { cursor: pointer; transition: background .15s; }
.data-table tbody tr:hover { background: rgba(31,109,88,.045); }
.data-table tbody tr:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.cell-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-user b { display: block; font-size: 11.5px; font-weight: 680; white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.cell-user span { display: block; margin-top: 1px; font-size: 8.5px; letter-spacing: .04em; color: var(--faint); }
.cell-num { font-family: var(--display); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-num small { font-family: var(--sans); font-size: 8.5px; font-weight: 500; color: var(--faint); }
.cell-bar { display: flex; align-items: center; gap: 7px; min-width: 95px; }
.cell-bar span { flex: none; font-family: var(--display); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-bar i { flex: 1; height: 4px; border-radius: 3px; background: rgba(16,37,28,.07); overflow: hidden; }
.cell-bar i b { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.cell-sub { display: block; margin-top: 2px; font-size: 8.5px; color: var(--faint); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 9.5px; color: var(--faint); background: rgba(242,238,227,.35); }
.row-arrow { color: var(--faint); font-size: 15px; }

.filters-empty, .empty-state, .error-state {
  display: grid;
  place-items: center;
  padding: 56px 24px;
  text-align: center;
}
.empty-art { width: 86px; height: 86px; margin-bottom: 16px; border-radius: 26px; display: grid; place-items: center; background: var(--teal-soft); color: var(--teal); }
.empty-art svg { width: 34px; height: 34px; }
.empty-state h3, .error-state h3, .filters-empty h3 { margin: 0; font-family: var(--display); font-size: 18px; letter-spacing: -.02em; }
.empty-state p, .error-state p, .filters-empty p { margin: 7px 0 0; max-width: 430px; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; }
.error-state .empty-art { background: var(--red-soft); color: var(--red); }

/* ---------------- backups page ---------------- */
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 13px; }
.summary-chip { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.summary-chip span { display: block; font-size: 9px; color: var(--muted); }
.summary-chip b { display: block; margin-top: 3px; font-family: var(--display); font-size: 19px; font-weight: 780; letter-spacing: -.03em; }
.backup-label { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.backup-label small { display: block; color: var(--faint); font-size: 8.5px; overflow: hidden; text-overflow: ellipsis; }
.legacy-tag { display: inline-block; margin-left: 5px; padding: 2px 5px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); font-size: 8px; font-weight: 700; }

/* ---------------- notes ---------------- */
.note-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.note-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
.note-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--display); font-size: 16px; letter-spacing: -.02em; }
.note-card h3 span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--teal-soft); color: var(--teal); }
.note-card h3 svg { width: 14px; height: 14px; }
.note-card p, .note-card li { font-size: 11.5px; line-height: 1.8; color: var(--ink-2); }
.note-card p { margin: 0 0 9px; }
.note-card ol, .note-card ul { margin: 0; padding-left: 18px; }
.note-card li { margin-bottom: 5px; }
.note-card.warn { border-color: rgba(154,107,37,.22); background: linear-gradient(180deg, #fdf8ed, var(--card)); }
.note-card.warn h3 span { background: var(--amber-soft); color: var(--amber); }
.note-card.full { grid-column: 1 / -1; }
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th, .kv-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 10.5px; }
.kv-table th { color: var(--faint); font-weight: 650; }
.kv-table td:first-child { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 10px; color: var(--teal); }
.kv-table tr:last-child td { border-bottom: 0; }
.note-callout { display: flex; gap: 10px; padding: 12px 14px; margin-top: 12px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 10.5px; line-height: 1.7; }
.note-callout svg { flex: none; width: 15px; height: 15px; margin-top: 1px; }

/* ---------------- drawer ---------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 24, 17, .42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .24s ease;
}
.drawer-overlay.open { opacity: 1; }
.drawer {
  position: fixed;
  z-index: 81;
  top: 0;
  right: 0;
  width: min(600px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.22,.8,.3,1);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  flex: none;
  padding: 20px 22px 0;
  background: linear-gradient(180deg, var(--bg) 75%, rgba(242,238,227,0));
}
.drawer-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-head-top .eyebrow { color: var(--faint); }
.drawer-close { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); }
.drawer-close:hover { background: var(--paper); }
.drawer-close svg { width: 15px; height: 15px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 10px 22px 28px; overscroll-behavior: contain; }
.d-hero {
  position: relative;
  margin-top: 10px;
  padding: 20px;
  border-radius: 22px;
  color: var(--paper);
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(217,247,107,.16), transparent 58%),
    linear-gradient(155deg, #174432, #103326 62%, #0b2a1f);
  overflow: hidden;
}
.d-hero::after { content: ''; position: absolute; right: -30px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, rgba(217,247,107,.2), transparent 68%); }
.d-hero-top { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 13px; }
.d-hero .avatar { color: var(--paper); font-weight: 850; box-shadow: 0 0 0 2px rgba(255,255,255,.16); }
.d-hero-name { flex: 1; min-width: 0; }
.d-hero-name h2 { margin: 0; font-family: var(--display); font-size: 23px; line-height: 1.2; letter-spacing: -.03em; }
.d-hero-name p { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 5px 0 0; font-size: 9.5px; color: rgba(255,255,255,.46); }
.d-hero-name p .status { color: var(--lime); background: rgba(217,247,107,.12); }
.d-hero-name p .status::before { background: var(--lime); }
.d-hero .goal-tag { color: rgba(255,255,255,.66); }
.d-hero .goal-tag i { box-shadow: 0 0 0 2px rgba(255,255,255,.12); }
.d-uid { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 9px; letter-spacing: .06em; color: rgba(255,255,255,.38); }
.d-uid button { font-size: 8.5px; font-weight: 650; color: rgba(255,255,255,.65); border: 1px solid rgba(255,255,255,.15); border-radius: 5px; padding: 2px 6px; }
.d-uid button:hover { background: rgba(255,255,255,.08); }
.d-kpis { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 18px; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.1); }
.d-kpi { padding: 10px 11px; background: rgba(255,255,255,.045); }
.d-kpi span { display: block; font-size: 8px; color: rgba(255,255,255,.42); }
.d-kpi b { display: block; margin-top: 3px; font-family: var(--display); font-size: 16px; font-weight: 780; letter-spacing: -.03em; color: var(--lime); font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-kpi b small { font-family: var(--sans); font-size: 8px; font-weight: 500; color: rgba(255,255,255,.32); letter-spacing: 0; }
.d-section { margin-top: 13px; padding: 18px 19px 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.d-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.d-section-head h3 { margin: 0; font-family: var(--display); font-size: 13.5px; letter-spacing: -.015em; }
.d-section-head p { margin: 2px 0 0; font-size: 9px; color: var(--faint); }
.d-section-head .right { font-size: 9px; color: var(--faint); text-align: right; }
.d-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.d-meta { padding: 9px 10px; border-radius: 9px; background: rgba(242,238,227,.55); }
.d-meta span { display: block; font-size: 8px; color: var(--faint); }
.d-meta b { display: block; margin-top: 2px; font-family: var(--display); font-size: 13px; font-weight: 720; letter-spacing: -.02em; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.d-actions .btn { flex: 1 1 132px; font-size: 11px; }
.d-danger-note { margin: 9px 2px 0; font-size: 8.5px; line-height: 1.6; color: var(--faint); text-align: center; }
.follow-box { display: flex; flex-direction: column; gap: 9px; }
.follow-statuses { display: flex; flex-wrap: wrap; gap: 6px; }
.follow-chip { height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 9.5px; font-weight: 650; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.follow-chip:hover { background: var(--paper); border-color: var(--ink-2); }
.follow-chip.active { background: var(--fc); border-color: var(--fc); color: #fff; }
.follow-chip.clear { margin-left: auto; border-style: dashed; color: var(--faint); }
.follow-note { width: 100%; min-height: 74px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(242,238,227,.5); font: inherit; font-size: 10.5px; line-height: 1.65; color: var(--ink); outline: none; transition: border-color .18s ease, background .18s ease; }
.follow-note:focus { border-color: var(--teal); background: var(--card); }
.follow-save-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 8.5px; color: var(--faint); }
.radar-svg { display: block; width: 100%; max-width: 440px; height: auto; margin: 0 auto; overflow: visible; }
.radar-ring { fill: none; stroke: rgba(16,37,28,.08); stroke-width: 1; }
.radar-axis { stroke: rgba(16,37,28,.08); stroke-width: 1; }
.radar-median { fill: none; stroke: #9ba095; stroke-width: 1.2; stroke-dasharray: 4 4; }
.radar-shape { fill: rgba(31,109,88,.16); stroke: #1f6d58; stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: #1f6d58; stroke: var(--card); stroke-width: 2; }
.radar-label { fill: var(--muted); font-family: var(--sans); font-size: 8.5px; }
.radar-pct { fill: var(--ink-2); font-family: var(--display); font-size: 9px; font-weight: 750; }
.radar-legend { display: flex; justify-content: center; gap: 14px; margin-top: 2px; font-size: 8.5px; color: var(--faint); }
.radar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.radar-legend i { width: 9px; height: 9px; border-radius: 2px; }
.radar-legend i.me { background: rgba(31,109,88,.22); border: 1.5px solid #1f6d58; }
.radar-legend i.mid { width: 14px; height: 2px; border-radius: 1px; background: #9ba095; }
.radar-scores { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 10px; }
.radar-scores span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: rgba(16,37,28,.04); font-size: 8.5px; color: var(--muted); }
.radar-scores b { font-family: var(--display); font-size: 9.5px; color: var(--teal); }

/* ---------------- destructive confirmation ---------------- */
.confirm-overlay { position: fixed; inset: 0; z-index: 96; display: grid; place-items: center; padding: 20px; background: rgba(8,24,17,.55); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s ease; }
.confirm-overlay.open { opacity: 1; }
.confirm-card { width: min(470px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform .2s ease; }
.confirm-overlay.open .confirm-card { transform: none; }
.confirm-head { display: flex; align-items: flex-start; gap: 11px; }
.confirm-head > div { flex: 1; min-width: 0; }
.confirm-head h3 { margin: 2px 0 0; font-family: var(--display); font-size: 18px; letter-spacing: -.02em; }
.confirm-head .eyebrow { color: var(--red); font-size: 8px; }
.confirm-ico { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: var(--red-soft); color: var(--red); }
.confirm-user { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(242,238,227,.5); }
.confirm-user > div { flex: 1; min-width: 0; }
.confirm-user b { display: block; font-size: 12px; }
.confirm-user span { display: block; margin-top: 1px; overflow: hidden; font-size: 8.5px; color: var(--faint); text-overflow: ellipsis; white-space: nowrap; }
.confirm-text { margin: 12px 0 0; font-size: 10.5px; line-height: 1.7; color: var(--muted); }
.confirm-text b { color: var(--ink-2); }
.confirm-text.dim { font-size: 9.5px; color: var(--faint); }
.confirm-field { display: block; margin-top: 14px; font-size: 10px; color: var(--muted); }
.confirm-field b { font-family: var(--display); color: var(--ink); letter-spacing: .04em; }
.confirm-input { width: 100%; height: 40px; margin-top: 7px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--paper); font: inherit; font-size: 12px; letter-spacing: .08em; outline: none; text-transform: uppercase; }
.confirm-input:focus { border-color: var(--red); background: var(--card); }
.confirm-error { margin: 8px 0 0; font-size: 10px; color: var(--red); }
.confirm-actions { display: flex; gap: 8px; margin-top: 16px; }
.confirm-actions .btn { flex: 1; }
.admin-pass-card .confirm-ico { background: var(--teal-soft); color: var(--teal); }
.admin-pass-card .confirm-head .eyebrow { color: var(--teal); }
.admin-pass-card .confirm-input { text-transform: none; letter-spacing: normal; }
.admin-pass-card .confirm-input:focus { border-color: var(--teal); }
.admin-pass-note { margin: 12px 0 0; padding: 9px 11px; border-radius: 9px; background: var(--teal-soft); font-size: 9.5px; line-height: 1.6; color: var(--teal); }
.d-legend { display: flex; align-items: center; gap: 10px; font-size: 8.5px; color: var(--faint); }
.d-legend span { display: inline-flex; align-items: center; gap: 4px; }
.d-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--teal); }
.d-legend i.line { width: 12px; height: 2px; background: var(--clay); }
.weight-svg { width: 100%; height: auto; display: block; overflow: visible; }
.weight-svg .w-grid { stroke: rgba(16,37,28,.08); }
.weight-svg .w-line { fill: none; stroke: var(--clay); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.weight-svg .w-area { fill: url(#wArea); }
.weight-svg .w-dot { fill: var(--clay); stroke: var(--card); stroke-width: 2; }
.weight-svg text { fill: var(--faint); font-family: var(--sans); font-size: 8.5px; }
.weight-current { display: flex; align-items: baseline; gap: 6px; }
.weight-current b { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.04em; }
.weight-current span { font-size: 9px; color: var(--muted); }
.weight-current em { font-style: normal; font-family: var(--display); font-size: 11px; font-weight: 700; color: var(--clay); }
.heatmap-phases { display: flex; flex-direction: column; gap: 9px; }
.hm-phase { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 8px; }
.hm-phase-label { font-size: 8.5px; color: var(--faint); line-height: 1.35; }
.hm-phase-label b { display: block; font-weight: 650; color: var(--muted); }
.hm-cells { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.hm-cell { position: relative; aspect-ratio: 1; min-height: 14px; border-radius: 3px; background: rgba(16,37,28,.06); }
.hm-cell.l1 { background: #dcebd9; }
.hm-cell.l2 { background: #a9c6b4; }
.hm-cell.l3 { background: #5f9b7d; }
.hm-cell.l4 { background: var(--teal); }
.hm-cell.l5 { background: var(--forest); }
.hm-cell.cur { outline: 1.5px solid var(--clay); outline-offset: 1px; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 9px; font-size: 8px; color: var(--faint); }
.hm-legend i { width: 10px; height: 10px; border-radius: 3px; background: rgba(16,37,28,.06); }
.hm-legend i.l1 { background: #dcebd9; } .hm-legend i.l2 { background: #a9c6b4; } .hm-legend i.l3 { background: #5f9b7d; } .hm-legend i.l4 { background: var(--teal); } .hm-legend i.l5 { background: var(--forest); }
.backup-mini-list { display: flex; flex-direction: column; }
.backup-mini { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 9.5px; }
.backup-mini:first-child { border-top: 0; }
.backup-mini .bm-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--teal-soft); color: var(--teal); }
.backup-mini .bm-icon svg { width: 12px; height: 12px; }
.backup-mini .bm-main { flex: 1; min-width: 0; }
.backup-mini .bm-main b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-mini .bm-main span { display: block; margin-top: 1px; font-size: 8px; color: var(--faint); }
.backup-mini .bm-size { flex: none; font-family: var(--display); font-size: 9px; color: var(--muted); }
.drawer-empty { padding: 18px; text-align: center; font-size: 10px; color: var(--faint); }

/* ---------------- toast / skeleton ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 120;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--forest);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 16px 36px -16px rgba(8,24,17,.6);
  animation: toastin .22s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.err { background: var(--red); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 6px); } }
.skeleton-page { padding-top: 6px; }
.sk { border-radius: 12px; background: linear-gradient(90deg, rgba(16,37,28,.055) 25%, rgba(16,37,28,.09) 37%, rgba(16,37,28,.055) 63%); background-size: 400% 100%; animation: shimmer 1.5s ease infinite; }
.sk-title { width: 240px; height: 34px; margin-bottom: 20px; }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.sk-card { height: 132px; border-radius: var(--r); }
.sk-chart { height: 340px; margin-top: 13px; border-radius: var(--r); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.reveal { animation: rise .42s cubic-bezier(.2,.8,.3,1) both; }
.reveal.d1 { animation-delay: .05s; } .reveal.d2 { animation-delay: .1s; } .reveal.d3 { animation-delay: .15s; } .reveal.d4 { animation-delay: .2s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- responsive ---------------- */
@media (max-width: 1240px) {
  .rail { width: 212px; }
  .view { padding-left: 22px; padding-right: 22px; }
  .topbar { padding-left: 22px; padding-right: 22px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid { grid-template-columns: minmax(0, 1.4fr) minmax(290px, .9fr); }
  .data-table { min-width: 900px; }
}
@media (max-width: 980px) {
  .app { display: block; }
  .rail {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
  }
  .rail-brand { padding: 0; }
  .rail-brand > div { display: none; }
  .rail-nav { flex-direction: row; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .rail-nav::-webkit-scrollbar { display: none; }
  .rail-nav a { height: 38px; padding: 0 10px; font-size: 11.5px; white-space: nowrap; }
  .rail-nav em { display: none; }
  .rail-nav a.active::before { top: auto; left: 10px; right: 10px; bottom: 0; width: auto; height: 2px; }
  .rail-source, .rail-foot { display: none; }
  .topbar { position: static; min-height: 68px; }
  .ov-grid, .ov-grid.equal { grid-template-columns: 1fr; }
  .note-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .gate { grid-template-columns: 1fr; }
  .gate-visual { display: none; }
  .gate-panel { min-height: 100vh; padding: 32px 24px; }
  .gate-form { max-width: 440px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head h2 { font-size: 26px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
@media (max-width: 640px) {
  .view { padding: 16px 14px 48px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 14px 10px; }
  .tb-title h1 { font-size: 20px; }
  .tb-actions { width: 100%; gap: 7px; }
  .tb-search { flex: 1; width: auto; }
  .icon-btn { padding: 0 10px; }
  .icon-btn-label { display: none; }
  .mode-chip { flex: none; }
  .kpi-grid { gap: 8px; }
  .kpi { min-height: 118px; padding: 13px 13px 12px; border-radius: 15px; }
  .kpi-value { font-size: 28px; margin-top: 8px; }
  .kpi-sub { margin-top: 7px; font-size: 9px; }
  .kpi-label { font-size: 9.5px; }
  .kpi-ico { width: 26px; height: 26px; border-radius: 7px; }
  .kpi-ico svg { width: 13px; height: 13px; }
  .card-head { padding: 15px 15px 0; }
  .card-body { padding: 12px 15px 16px; }
  .donut-wrap { gap: 14px; }
  .donut { width: 116px; height: 116px; }
  .donut-center b { font-size: 24px; }
  .cohort-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-strip { gap: 7px; }
  .summary-chip { padding: 10px 11px; }
  .summary-chip b { font-size: 16px; }
  .toolbar { gap: 6px; }
  .field { flex: 1; min-width: 0; }
  .field input { width: 100%; }
  .toolbar .field:nth-of-type(2), .toolbar .field:nth-of-type(3) { flex: 0 0 auto; }
  .toolbar .btn { flex: 1; }
  .page-actions { flex-wrap: wrap; }
  .drawer { width: 100%; }
  .drawer-body { padding: 8px 14px 24px; }
  .drawer-head { padding: 16px 14px 0; }
  .d-hero { padding: 17px; }
  .d-kpis { grid-template-columns: repeat(2, 1fr); }
  .d-section { padding: 15px; }
  .d-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .d-actions { flex-wrap: wrap; }
  .d-actions .btn { flex: 1 1 140px; }
  .hm-phase { grid-template-columns: 48px minmax(0, 1fr); }
  .hm-cells { gap: 2px; }
  .rank-row { grid-template-columns: 18px 28px minmax(0, 1fr) auto; }
  .recent-val { font-size: 8px; }
  .note-card { padding: 17px; }
  .follow-chip.clear { margin-left: 0; }
  .follow-save-row { flex-wrap: wrap; }
  .radar-label { font-size: 10px; }
  .radar-pct { font-size: 11px; }
  .minutes-svg .x-label, .minutes-svg .axis-text,
  .upload-svg .x-label, .upload-svg .axis-text { font-size: 15px; }
  .upload-svg .up-count { font-size: 15px; }
  .confirm-overlay { padding: 12px; }
  .confirm-card { padding: 17px; border-radius: 16px; }
  .confirm-actions { flex-direction: column; }
  .confirm-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
