/* Weight — daily weight tracker with linear regression
 * Palette: sage-mint + ice-blue + cream
 * © אופיר ברנס (Ofir Baranes) 2026 - כל הזכויות שמורות
 */

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg-1: #08130f;
  --bg-2: #0e1f1a;
  --bg-3: #112826;
  --sage-200: #d1fae5;
  --sage-300: #a7f3d0;
  --sage-400: #6ee7b7;
  --sage-500: #34d399;
  --sage-600: #10b981;
  --sage-700: #047857;
  --ice-200: #e0f2fe;
  --ice-300: #bae6fd;
  --ice-400: #7dd3fc;
  --ice-500: #38bdf8;
  --cream-100: #f0fdfa;
  --cream-200: #ccfbf1;
  --amber-400: #fbbf24;
  --rose-400: #fb7185;
  --paprika: #dc2626;
  --text-primary: #f0fdfa;
  --text-secondary: rgba(240,253,250,0.72);
  --text-muted: rgba(240,253,250,0.42);
  --surface: rgba(240,253,250,0.05);
  --surface-strong: rgba(240,253,250,0.09);
  --surface-input: rgba(8,19,15,0.55);
  --border: rgba(110,231,183,0.16);
  --border-strong: rgba(110,231,183,0.28);
  --shadow-glass: 0 30px 60px -25px rgba(3,8,6,0.85);
  --shadow-soft: 0 10px 30px rgba(16,185,129,0.18);
  --bezier: cubic-bezier(.34,1.56,.64,1);
  --bezier-soft: cubic-bezier(.4,0,.2,1);
}

html, body {
  background: var(--bg-1);
  color: var(--text-primary);
  font-family: 'Heebo', system-ui, sans-serif;
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 700px 800px at 80% -10%, rgba(110,231,183,0.16), transparent 60%),
    radial-gradient(ellipse 500px 600px at -10% 60%, rgba(125,211,252,0.10), transparent 65%),
    radial-gradient(ellipse 800px 1000px at 50% 110%, rgba(4,120,87,0.22), transparent 70%),
    linear-gradient(180deg, #08130f 0%, #0c1b16 60%, #112826 110%);
  background-attachment: fixed;
  position: relative;
  padding-bottom: 84px;
}

.mono { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }

/* ===== Ambient ===== */
.ambient-bg {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb-blur {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.40;
}
.orb-blur.o1 { width: 440px; height: 440px; top: -130px; right: -120px; background: radial-gradient(circle, #34d399 0%, transparent 70%); animation: drift1 28s ease-in-out infinite; }
.orb-blur.o2 { width: 340px; height: 340px; bottom: 5%; left: -100px; background: radial-gradient(circle, #38bdf8 0%, transparent 70%); opacity: 0.22; animation: drift2 34s ease-in-out infinite; }
.orb-blur.o3 { width: 280px; height: 280px; top: 38%; right: 28%; background: radial-gradient(circle, #6ee7b7 0%, transparent 70%); opacity: 0.20; animation: drift3 40s ease-in-out infinite; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-30px,40px) scale(1.1); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-25px,-35px) scale(1.12); } }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(8,19,15,0.92) 0%, rgba(8,19,15,0.55) 100%);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cream-100);
  letter-spacing: -0.01em;
}
.mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sage-400), var(--ice-400));
  color: var(--bg-1);
  box-shadow: 0 0 22px rgba(110,231,183,0.45);
  overflow: hidden;
}
.mark img { display: block; }
.header-actions { display: flex; gap: 8px; }
.icon-btn, .install-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  border-radius: 12px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
  backdrop-filter: blur(10px);
}
.icon-btn { padding: 7px 9px; font-size: 16px; }
.icon-btn:hover, .install-btn:hover {
  background: var(--surface-strong);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.install-btn {
  background: linear-gradient(135deg, var(--sage-400), var(--ice-400));
  border: none;
  color: var(--bg-1);
  font-weight: 700;
}

main {
  position: relative;
  z-index: 1;
  padding: 22px 18px;
  max-width: 760px;
  margin: 0 auto;
}
.hidden { display: none !important; }

/* ===== Hero Card with bg image ===== */
.hero-card {
  position: relative;
  border-radius: 26px;
  padding: 26px 24px 22px;
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(16,185,129,0.18) 0%, rgba(56,189,248,0.12) 100%);
  box-shadow: var(--shadow-glass);
  min-height: 220px;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('hero_bg.png');
  background-size: cover;
  background-position: center right;
  opacity: 0.32;
  z-index: 0;
  filter: saturate(1.05);
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(8,19,15,0.85) 0%, rgba(8,19,15,0.55) 35%, rgba(8,19,15,0.20) 100%),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(110,231,183,0.18), transparent 60%);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
}
.hc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.hc-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sage-300);
}
.hc-trend-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(110,231,183,0.16);
  color: var(--sage-300);
  border: 1px solid rgba(110,231,183,0.28);
}
.hc-trend-pill.down {
  background: rgba(56,189,248,0.16);
  color: var(--ice-400);
  border-color: rgba(56,189,248,0.32);
}
.hc-trend-pill.up {
  background: rgba(251,191,36,0.16);
  color: var(--amber-400);
  border-color: rgba(251,191,36,0.32);
}
.hc-amount-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.hc-amount {
  font-size: clamp(56px, 13vw, 76px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, var(--cream-100) 0%, var(--sage-300) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(110,231,183,0.25);
}
.hc-unit {
  font-size: 16px;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
}
.hc-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.55;
}
.hc-meta .mono { color: var(--cream-100); font-weight: 500; }
.hc-meta .down { color: var(--ice-400); font-weight: 600; }
.hc-meta .up { color: var(--amber-400); font-weight: 600; }
.hc-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hc-cta {
  padding: 11px 22px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s var(--bezier);
}
.hc-cta.primary {
  background: linear-gradient(135deg, var(--sage-500), var(--sage-700));
  color: var(--cream-100);
  box-shadow: 0 8px 22px rgba(16,185,129,0.35);
}
.hc-cta.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(16,185,129,0.50); }
.hc-cta.ghost {
  background: rgba(240,253,250,0.10);
  color: var(--cream-100);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
}
.hc-cta.ghost:hover { background: rgba(240,253,250,0.18); }

/* ===== Stats row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 8px;
  text-align: center;
  transition: all 0.3s var(--bezier-soft);
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-num {
  font-size: 24px;
  font-weight: 600;
  color: var(--cream-100);
  margin-bottom: 4px;
  line-height: 1.05;
}
.stat-num.down { color: var(--ice-400); }
.stat-num.up { color: var(--amber-400); }
.stat-num.accent {
  background: linear-gradient(135deg, var(--sage-300), var(--ice-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Chart card ===== */
.chart-card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-glass);
  margin-bottom: 22px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-title {
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--cream-100);
  letter-spacing: -0.015em;
}
.chart-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.range-toggle {
  display: inline-flex;
  background: rgba(8,19,15,0.5);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}
.rt-btn {
  padding: 6px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 100px;
  transition: all 0.2s;
  letter-spacing: 0.04em;
}
.rt-btn:hover { color: var(--cream-100); }
.rt-btn.active {
  background: linear-gradient(135deg, var(--sage-500), var(--sage-700));
  color: var(--cream-100);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.chart-wrap {
  position: relative;
  margin-bottom: 14px;
}
#scatterSvg {
  width: 100%;
  height: 280px;
  overflow: visible;
}

/* SVG scatter styles */
.scatter-axis-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  fill: rgba(240,253,250,0.42);
}
.scatter-grid-line {
  stroke: rgba(240,253,250,0.06);
  stroke-width: 1;
}
.scatter-confidence {
  fill: url(#confidenceGrad);
  opacity: 0.55;
}
.scatter-trend {
  fill: none;
  stroke: var(--cream-100);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}
.scatter-ma {
  fill: none;
  stroke: var(--ice-400);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scatter-dot {
  fill: var(--sage-400);
  stroke: var(--bg-1);
  stroke-width: 1.5;
  cursor: pointer;
  transition: all 0.2s var(--bezier);
}
.scatter-dot:hover {
  r: 6;
  fill: var(--cream-100);
}
.scatter-empty-text {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 14px;
  fill: var(--text-muted);
}

.chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-secondary);
}
.leg-item { display: inline-flex; align-items: center; gap: 6px; }
.leg-dot { width: 9px; height: 9px; border-radius: 50%; }
.leg-line { width: 16px; height: 2px; border-radius: 2px; }
.leg-line.dashed { background: repeating-linear-gradient(90deg, var(--cream-100) 0 4px, transparent 4px 8px) !important; }
.leg-band { width: 16px; height: 8px; border-radius: 4px; border: 1px solid var(--border-strong); }

/* ===== BMI Card ===== */
.bmi-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-glass);
  margin-bottom: 22px;
}
.bmi-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--cream-100);
  letter-spacing: -0.015em;
}
.section-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--sage-300);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.section-link:hover { color: var(--sage-400); }
.bmi-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 4px;
  line-height: 1.6;
}
.bmi-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.bmi-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--cream-100), var(--sage-300));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.bmi-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.bmi-zones {
  position: relative;
  margin-top: 8px;
}
.bmi-bar {
  position: relative;
  display: grid;
  grid-template-columns: var(--z1,1fr) var(--z2,2fr) var(--z3,1fr) var(--z4,1fr) var(--z5,0.7fr);
  gap: 2px;
  height: 14px;
  border-radius: 8px;
  overflow: hidden;
}
.bmi-bar > div { transition: opacity 0.3s; opacity: 0.55; }
.bmi-bar > div.active { opacity: 1; }
.bmi-bar .z1 { background: linear-gradient(90deg, #7dd3fc, #38bdf8); }
.bmi-bar .z2 { background: linear-gradient(90deg, #6ee7b7, #34d399); }
.bmi-bar .z3 { background: linear-gradient(90deg, #fde68a, #fbbf24); }
.bmi-bar .z4 { background: linear-gradient(90deg, #fdba74, #fb923c); }
.bmi-bar .z5 { background: linear-gradient(90deg, #fca5a5, #ef4444); }
.bmi-marker {
  position: absolute;
  top: -8px;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--cream-100);
  transform: translateX(50%);
  transition: right 0.6s var(--bezier);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.bmi-zone-labels {
  display: grid;
  grid-template-columns: var(--z1,1fr) var(--z2,2fr) var(--z3,1fr) var(--z4,1fr) var(--z5,0.7fr);
  gap: 2px;
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
}

/* BMI label color variants */
.bmi-label.under { background: rgba(125,211,252,0.16); color: var(--ice-400); }
.bmi-label.normal { background: rgba(110,231,183,0.16); color: var(--sage-300); }
.bmi-label.over { background: rgba(251,191,36,0.16); color: var(--amber-400); }
.bmi-label.obese1 { background: rgba(251,146,60,0.16); color: #fdba74; }
.bmi-label.obese2 { background: rgba(239,68,68,0.18); color: #fca5a5; }

/* ===== Goal card ===== */
.goal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(110,231,183,0.12) 0%, rgba(125,211,252,0.08) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.goal-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sage-500), var(--ice-500));
  border-radius: 14px;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(16,185,129,0.30);
}
.goal-body { flex: 1; min-width: 0; }
.goal-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sage-300);
  margin-bottom: 3px;
}
.goal-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.45;
  margin-bottom: 8px;
  font-weight: 500;
}
.goal-text .mono { color: var(--sage-300); font-weight: 600; }
.goal-text .danger { color: var(--amber-400); font-weight: 600; }
.goal-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.goal-bar {
  flex: 1;
  height: 6px;
  background: rgba(240,253,250,0.10);
  border-radius: 6px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-500), var(--ice-400));
  border-radius: 6px;
  width: 0;
  transition: width 0.6s var(--bezier-soft);
}
.goal-pct {
  font-size: 12px;
  color: var(--cream-100);
  font-weight: 600;
  min-width: 36px;
  text-align: left;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 22px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage-400), var(--ice-400) 60%, var(--ice-500));
  border: none;
  color: var(--bg-1);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(16,185,129,0.45), 0 0 24px rgba(125,211,252,0.30);
  transition: all 0.3s var(--bezier);
  z-index: 90;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { transform: translateY(-3px) scale(1.05); }
.fab:active { transform: translateY(0) scale(0.96); }

/* ===== Modal ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(3,8,6,0.72);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modal-fade 0.25s var(--bezier-soft);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%;
  max-width: 540px;
  background: linear-gradient(180deg, #112826 0%, #0a1814 100%);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 20px 22px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  animation: modal-slide 0.4s var(--bezier);
  max-height: 92vh;
  overflow-y: auto;
}
@keyframes modal-slide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.handle {
  width: 38px; height: 4px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.modal-card h3 {
  font-family: 'Frank Ruhl Libre', 'Heebo', serif;
  color: var(--cream-100);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
.modal-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 14px;
}
.mark-big {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sage-400), var(--ice-400));
  border-radius: 22px;
  margin: 4px auto 14px;
  box-shadow: 0 0 30px rgba(110,231,183,0.40);
  overflow: hidden;
}

.form-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sage-300);
  margin: 4px 0 8px;
  padding-right: 4px;
}
.modal-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--cream-100);
  font-family: 'Heebo', sans-serif;
  font-size: 15px;
  margin-bottom: 12px;
  transition: all 0.2s;
  text-align: right;
  direction: rtl;
}
.modal-input.mono { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
.modal-input:focus {
  outline: none;
  border-color: var(--sage-400);
  background: rgba(8,19,15,0.7);
  box-shadow: 0 0 0 3px rgba(110,231,183,0.14);
}
.modal-input::placeholder { color: var(--text-muted); }
input[type="time"], input[type="date"], input[type="number"] { color-scheme: dark; }

/* Date row */
.date-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.dt-btn {
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--bezier-soft);
}
.dt-btn:hover { background: var(--surface-strong); color: var(--cream-100); }
.dt-btn.active {
  background: linear-gradient(135deg, var(--sage-500), var(--sage-700));
  border-color: transparent;
  color: var(--cream-100);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}

/* Weight stepper input */
.weight-input-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 8px;
}
.weight-input {
  flex: 1;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 34px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 16px 12px;
  background: var(--surface-input);
  border: 1.5px solid var(--border-strong);
  border-radius: 16px;
  color: var(--cream-100);
  direction: ltr;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}
.weight-input:focus {
  outline: none;
  border-color: var(--sage-400);
  box-shadow: 0 0 0 3px rgba(110,231,183,0.14);
  background: rgba(8,19,15,0.7);
}
.wi-step {
  width: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--cream-100);
  font-size: 26px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s var(--bezier);
  user-select: none;
}
.wi-step:hover {
  background: var(--surface-strong);
  border-color: var(--sage-400);
  color: var(--sage-300);
}
.wi-step:active { transform: scale(0.94); }
.wi-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.wi-quick-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.wi-quick-btn:hover { background: var(--surface-strong); color: var(--sage-300); border-color: var(--sage-400); }

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: stretch;
}
.btn-primary, .btn-secondary, .btn-mini {
  padding: 13px 18px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--bezier);
  border: none;
}
.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, var(--sage-500), var(--sage-700));
  color: var(--cream-100);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(16,185,129,0.40);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(16,185,129,0.55); }
.btn-secondary {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--cream-100);
}
.btn-secondary:hover { background: var(--surface-strong); }
.btn-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
}
.btn-mini:hover { background: var(--surface-strong); color: var(--cream-100); }
.btn-mini.danger {
  color: var(--rose-400);
  border-color: rgba(251,113,133,0.30);
}
.btn-mini.danger:hover { background: rgba(244,63,94,0.12); }

/* History */
.hist-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.hs-item {
  text-align: center;
  padding: 14px 6px;
  background: rgba(240,253,250,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.hs-num { font-size: 20px; font-weight: 600; color: var(--sage-300); }
.hs-label { font-size: 10px; color: var(--text-secondary); margin-top: 4px; }

.hist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}
.hist-list::-webkit-scrollbar { width: 4px; }
.hist-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(240,253,250,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.hist-row:hover { background: rgba(240,253,250,0.08); border-color: var(--border-strong); }
.hist-body { flex: 1; min-width: 0; }
.hist-date { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--sage-300); margin-bottom: 2px; }
.hist-note { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.hist-w {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--cream-100);
  flex-shrink: 0;
}
.hist-delta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  margin-top: 2px;
  font-weight: 500;
  display: block;
  text-align: left;
}
.hist-delta.up { color: var(--amber-400); }
.hist-delta.down { color: var(--ice-400); }
.hist-delta.same { color: var(--text-muted); }

/* About */
#aboutModal p { font-size: 14px; line-height: 1.75; }
#aboutModal strong { color: var(--sage-300); font-weight: 700; }
#aboutModal em { color: var(--ice-400); font-style: normal; font-weight: 600; }

@media (max-width: 380px) {
  main { padding: 18px 14px; }
  .hero-card { padding: 22px 18px 18px; }
  .stat { padding: 14px 6px; }
  .stat-num { font-size: 20px; }
  .weight-input { font-size: 28px; }
}
