/* ═══════════════════════════════════════
   JAPANDI DESIGN SYSTEM — v2
   Warm charcoal · Clay · Linen
═══════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  /* Backgrounds */
  --bg:          #F3EFE8;   /* warm linen */
  --surface:     #FDFBF8;   /* warm white paper */
  --surface-2:   #EAE5DC;   /* warm stone */
  --surface-3:   #E2DCD2;   /* slightly deeper */

  /* Borders */
  --border:      #D4CCBE;
  --border-soft: #E4DDD2;

  /* Primary — warm charcoal (Japandi ink) */
  --primary:     #252018;
  --primary-dim: #42392E;
  --primary-bg:  #ECEAE5;

  /* Accent — warm clay / fired earth */
  --accent:      #9B7B5A;
  --accent-dim:  #B89472;
  --accent-bg:   #F5EDE2;

  /* Text */
  --text-1:      #1A1714;
  --text-2:      #6B6258;
  --text-3:      #A09488;

  /* Semantic */
  --success:     #627D5A;   /* muted sage */
  --success-bg:  #EAF0E6;
  --caution:     #9B7830;   /* warm amber */
  --caution-bg:  #F6EDDA;
  --danger:      #9B5248;   /* muted clay red */
  --danger-bg:   #F5ECEA;

  /* Vial fill */
  --vial-full:   #627D5A;
  --vial-mid:    #9B7830;
  --vial-low:    #9B5248;

  /* Radius */
  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-xl:   28px;

  /* Shadow */
  --shadow-sm:   0 1px 3px rgba(30,22,10,.07);
  --shadow:      0 2px 12px rgba(30,22,10,.09);
  --shadow-lg:   0 8px 32px rgba(30,22,10,.14);

  --nav-h:       72px;
  --top-h:       60px;
  --font:        'DM Sans', system-ui, sans-serif;
  --font-serif:  'DM Serif Display', Georgia, serif;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── APP SHELL ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 100%;
}
.topbar-title { font-family: var(--font-serif); font-size: 1.15rem; color: var(--text-1); display: block; }
.topbar-sub { font-size: 0.75rem; color: var(--text-3); display: block; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
}

/* ── VIEW CONTAINER ── */
.view-container { flex: 1; overflow: hidden; position: relative; }
.view {
  position: absolute; inset: 0;
  overflow-y: auto;
  padding: 20px 20px 100px;
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }
.view.active { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ── BOTTOM NAV ── */
.bottom-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3);
  font-size: 0.66rem; font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--radius);
  transition: color 0.15s;
  flex: 1;
}
.nav-item.active { color: var(--primary); }
.nav-icon { width: 22px; height: 22px; }
.nav-fab {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,32,24,.30);
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-fab:active { transform: scale(0.95); box-shadow: 0 2px 8px rgba(37,32,24,.20); }
.nav-fab svg { stroke: #fff; stroke-width: 2.5; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.card-hero {
  background: var(--primary);
  color: #FAF7F2;
  padding: 28px 24px 24px;
  position: relative; overflow: hidden;
  margin-bottom: 16px;
}
.card-hero::before {
  content: ''; position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.card-hero::after {
  content: ''; position: absolute; bottom: -30px; left: 30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.hero-label {
  font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; opacity: 0.6; margin-bottom: 4px;
}
.hero-countdown { font-family: var(--font-serif); font-size: 3.2rem; line-height: 1; margin-bottom: 4px; }
.hero-meta { font-size: 0.82rem; opacity: 0.65; margin-bottom: 16px; }
.hero-dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2); }
.dot.active { background: rgba(255,255,255,.8); }

/* ── STATS ROW ── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.stat-chip {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 14px 10px; text-align: center;
}
.stat-val { display: block; font-family: var(--font-serif); font-size: 1.6rem; color: var(--text-1); line-height: 1; margin-bottom: 4px; }
.stat-label { display: block; font-size: 0.68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; }

/* ── SECTION HEADER ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-2); }
.link-btn { font-size: 0.82rem; color: var(--accent); font-weight: 500; }

/* ── PEPTIDE CARDS ── */
.peptide-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.peptide-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: box-shadow 0.15s;
}
.peptide-card:active { box-shadow: var(--shadow); }
.peptide-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.peptide-info { flex: 1; min-width: 0; }
.peptide-name { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peptide-dose { font-size: 0.75rem; color: var(--text-3); }
.peptide-status { font-size: 0.68rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; flex-shrink: 0; letter-spacing: 0.03em; }
.status-due { background: var(--caution-bg); color: var(--caution); }
.status-ok  { background: var(--success-bg); color: var(--success); }
.status-soon{ background: var(--primary-bg); color: var(--primary-dim); }

/* ── ACTIVITY LIST ── */
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.act-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.act-info { flex: 1; min-width: 0; }
.act-name { font-size: 0.88rem; font-weight: 500; }
.act-meta { font-size: 0.72rem; color: var(--text-3); }
.act-dose { font-size: 0.78rem; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.empty-state { text-align: center; padding: 32px 20px; color: var(--text-3); font-size: 0.85rem; }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 8px; display: block; }

/* ═══════════════════════════════════════
   FRIDGE / VIAL STYLES
═══════════════════════════════════════ */
.fridge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }

.vial-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 16px 14px;
  cursor: pointer; transition: box-shadow 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative;
}
.vial-card:active { box-shadow: var(--shadow); }

/* Vial graphic */
.vial-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.vial-cap {
  width: 22px; height: 7px;
  background: var(--surface-3); border-radius: 3px 3px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  position: relative; z-index: 2;
}
.vial-body-outer {
  width: 52px; height: 88px;
  border: 2px solid var(--border);
  border-radius: 4px 4px 10px 10px;
  overflow: hidden; position: relative;
  background: var(--bg);
}
.vial-fill {
  position: absolute; bottom: 0; left: 0; right: 0;
  transition: height 0.6s cubic-bezier(.22,.61,.36,1);
  border-radius: 0 0 8px 8px;
}
.vial-fill.full   { background: linear-gradient(to top, var(--vial-full), #8AAD80); }
.vial-fill.mid    { background: linear-gradient(to top, var(--vial-mid), #C4A050); }
.vial-fill.low    { background: linear-gradient(to top, var(--vial-low), #C47A70); }
.vial-fill.empty  { background: var(--surface-3); height: 6px !important; }

/* Sheen line on vial */
.vial-sheen {
  position: absolute; top: 4px; left: 10px;
  width: 4px; height: 70%;
  background: rgba(255,255,255,.25); border-radius: 4px;
}
/* Measurement lines */
.vial-marks {
  position: absolute; right: 4px; top: 8px; bottom: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.vial-mark { width: 6px; height: 1px; background: rgba(0,0,0,.12); }

.vial-pct-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 6px; border-radius: 10px;
}
.vial-pct-badge.full  { background: var(--success-bg); color: var(--success); }
.vial-pct-badge.mid   { background: var(--caution-bg); color: var(--caution); }
.vial-pct-badge.low   { background: var(--danger-bg);  color: var(--danger); }

.vial-info { width: 100%; text-align: center; }
.vial-name { font-weight: 600; font-size: 0.82rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vial-remaining { font-size: 0.72rem; color: var(--text-2); margin-bottom: 4px; }
.vial-doses-left { font-size: 0.68rem; color: var(--text-3); }

.vial-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; margin-top: 4px; }
.vial-stat { background: var(--bg); border-radius: var(--radius-sm); padding: 6px 4px; text-align: center; }
.vial-stat-val { display: block; font-weight: 600; font-size: 0.78rem; }
.vial-stat-label { display: block; font-size: 0.6rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* Add vial button */
.add-vial-btn {
  background: var(--surface); border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-3); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  width: 100%;
}
.add-vial-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Reconstitution calculator card */
.recon-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 20px;
  margin-bottom: 20px;
}
.recon-result {
  background: var(--primary); color: var(--surface);
  border-radius: var(--radius); padding: 20px;
  text-align: center; margin-top: 16px;
}
.recon-result-val { font-family: var(--font-serif); font-size: 2.4rem; line-height: 1; }
.recon-result-unit { font-size: 0.72rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.08em; }
.recon-result-sub { font-size: 0.8rem; opacity: 0.7; margin-top: 4px; }
.recon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.recon-stat { background: rgba(255,255,255,.1); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.recon-stat-val { font-weight: 600; font-size: 1rem; }
.recon-stat-label { font-size: 0.65rem; opacity: 0.65; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── TAB BAR ── */
.tab-bar {
  display: flex; background: var(--surface-2); border-radius: var(--radius);
  padding: 4px; gap: 2px; margin-bottom: 20px;
}
.tab {
  flex: 1; padding: 8px 4px; border-radius: calc(var(--radius) - 4px);
  font-size: 0.8rem; font-weight: 500; color: var(--text-2); transition: all 0.15s;
}
.tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── FILTER ROW ── */
.filter-row { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 5px 14px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-2);
  background: var(--surface); cursor: pointer; transition: all 0.15s;
}
.filter-chip.active { background: var(--primary); color: #FAF7F2; border-color: var(--primary); }

/* ── CHART ── */
.chart-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 20px;
}

/* ── CALENDAR ── */
.calendar-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; font-weight: 600; font-size: 1rem;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.cal-day-name { text-align: center; font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.82rem; cursor: pointer;
  position: relative; transition: background 0.15s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.has-dose::after {
  content: ''; position: absolute; bottom: 3px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.cal-day.today { font-weight: 700; color: var(--accent); }
.cal-day.selected { background: var(--primary); color: var(--surface); }
.cal-day.selected::after { background: rgba(250,247,242,.6); }
.cal-day.other-month { opacity: 0.3; }
.cal-detail { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.cal-detail.hidden { display: none; }
.cal-detail-date { font-weight: 600; margin-bottom: 10px; }

/* ── BODY MAP ── */
.body-map-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.body-map { width: 200px; }
.body-svg { width: 100%; height: auto; }
.site-dot { fill: var(--success); cursor: pointer; transition: all 0.2s; stroke: var(--surface); stroke-width: 2; }
.site-dot.avoid   { fill: var(--danger); }
.site-dot.caution { fill: var(--caution); }
.site-dot.ready   { fill: var(--success); }
.site-legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-2); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.avoid   { background: var(--danger); }
.legend-dot.caution { background: var(--caution); }
.legend-dot.ready   { background: var(--success); }
.site-detail-box { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 14px 16px; width: 100%; }
.site-detail-box.hidden { display: none; }

/* ── LOG SHEET ── */
#view-log { padding: 0; }
.log-sheet { background: var(--surface); min-height: 100%; padding-bottom: 40px; }
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: var(--surface); z-index: 5;
}
.sheet-title { font-weight: 600; font-size: 1rem; }
.text-btn { font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.form-section { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.form-label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-2); margin-bottom: 10px; }

/* Peptide select */
.peptide-select-list { display: flex; flex-direction: column; gap: 8px; }
.peptide-select-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius); border: 1.5px solid var(--border);
  cursor: pointer; transition: all 0.15s;
}
.peptide-select-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.peptide-select-item .peptide-icon { width: 32px; height: 32px; font-size: 1rem; border-radius: 8px; }

/* Dose chips */
.dose-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--border);
  font-size: 0.82rem; font-weight: 500; color: var(--text-2);
  background: var(--surface); transition: all 0.15s; cursor: pointer;
}
.chip.active { background: var(--primary); color: var(--surface); border-color: var(--primary); }
.custom-dose-wrap { display: flex; align-items: center; gap: 8px; }
.custom-dose-wrap.hidden { display: none; }
.custom-dose-input { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; flex: 1; outline: none; background: var(--surface-2); }
.custom-dose-input:focus { border-color: var(--accent); background: var(--surface); }
.unit-label { font-size: 0.82rem; color: var(--text-2); font-weight: 500; }

/* Vial selector in log */
.vial-select-list { display: flex; flex-direction: column; gap: 6px; }
.vial-select-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: var(--radius); border: 1.5px solid var(--border);
  cursor: pointer; transition: all 0.15s; background: var(--surface);
}
.vial-select-item.selected { border-color: var(--primary); background: var(--primary-bg); }
.vial-mini-indicator {
  width: 12px; height: 30px; border-radius: 4px; border: 1.5px solid var(--border);
  overflow: hidden; flex-shrink: 0; background: var(--bg);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.vial-mini-fill { width: 100%; border-radius: 0 0 2px 2px; }

/* Site grid */
.site-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-btn {
  padding: 9px 10px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  font-size: 0.8rem; color: var(--text-2); background: var(--surface);
  transition: all 0.15s; text-align: left;
}
.site-btn.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.route-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.text-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; outline: none; background: var(--surface-2);
  color: var(--text-1); transition: border-color 0.15s, background 0.15s;
}
.text-input:focus { border-color: var(--accent); background: var(--surface); }
textarea.text-input { resize: vertical; min-height: 80px; }

/* Input with unit inline */
.input-unit-wrap { display: flex; align-items: center; gap: 0; }
.input-unit-wrap .text-input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; }
.input-unit-label {
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 12px; font-size: 0.8rem; color: var(--text-2); font-weight: 500;
  white-space: nowrap;
}

/* ── PROFILE ── */
.profile-header {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px;
}
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 600; flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-name { font-weight: 600; font-size: 1rem; }
.profile-since { font-size: 0.75rem; color: var(--text-3); }
.treatment-cards { display: flex; flex-direction: column; gap: 8px; }
.treatment-item {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.treat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.treat-info { flex: 1; }
.treat-name { font-weight: 500; font-size: 0.9rem; }
.treat-sub { font-size: 0.72rem; color: var(--text-3); }
.pref-list { display: flex; flex-direction: column; gap: 2px; }
.pref-item {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; transition: background 0.12s;
}
.pref-item:first-child { border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius-sm); }
.pref-item:last-child  { border-radius: var(--radius-sm) var(--radius-sm) var(--radius) var(--radius); }
.pref-item:only-child  { border-radius: var(--radius); }
.pref-item:active { background: var(--surface-2); }
.pref-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pref-text { flex: 1; }
.pref-title { font-size: 0.88rem; font-weight: 500; }
.pref-sub { font-size: 0.72rem; color: var(--text-3); }
.chevron { color: var(--text-3); font-size: 1.2rem; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,23,20,.45); backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s;
}
.modal-overlay.hidden { display: none; }
.modal-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
  width: 100%; max-width: 430px; max-height: 88dvh;
  overflow-y: auto; animation: slideUp 0.22s;
  scrollbar-width: none;
}
.modal-sheet::-webkit-scrollbar { display: none; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 0; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-weight: 600; font-size: 1.05rem; }
.modal-body { padding: 16px 20px 28px; }
.peptide-search-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 50dvh; overflow-y: auto; }
.peptide-search-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: var(--radius); cursor: pointer; transition: background 0.12s;
  border: 1px solid transparent;
}
.peptide-search-item:hover { background: var(--surface-2); }
.peptide-search-item.already-added { opacity: 0.4; pointer-events: none; }
.search-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.search-info .search-name { font-weight: 500; font-size: 0.9rem; }
.search-info .search-cat { font-size: 0.72rem; color: var(--text-3); }

/* Confirm modal */
.confirm-sheet { max-height: auto; border-radius: var(--radius-xl); text-align: center; padding: 28px 24px; margin-bottom: 16px; }
.confirm-icon { font-size: 2.5rem; margin-bottom: 12px; }
.confirm-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 8px; }
.confirm-msg { font-size: 0.85rem; color: var(--text-2); margin-bottom: 20px; }
.confirm-btns { display: flex; gap: 10px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--primary); color: var(--surface);
  border-radius: var(--radius); padding: 13px 20px;
  font-size: 0.9rem; font-weight: 600; width: 100%; display: block;
  transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.85; }
.btn-accent {
  background: var(--accent); color: #fff;
  border-radius: var(--radius); padding: 13px 20px;
  font-size: 0.9rem; font-weight: 600; width: 100%; display: block;
  transition: opacity 0.15s;
}
.btn-outline {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px; font-size: 0.88rem; font-weight: 500; color: var(--text-1);
  transition: background 0.12s;
}
.btn-outline:active { background: var(--surface-2); }
.btn-danger { flex: 1; background: var(--danger); color: #fff; border-radius: var(--radius-sm); padding: 11px; font-size: 0.88rem; font-weight: 600; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px);
  left: 50%; transform: translateX(-50%);
  background: var(--primary); color: var(--surface);
  padding: 10px 20px; border-radius: 20px;
  font-size: 0.85rem; font-weight: 500;
  z-index: 200; box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s; white-space: nowrap;
}
.toast.hidden { display: none; }

/* ── ONBOARDING ── */
.onboard-overlay {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
}
.onboard-overlay.hidden { display: none; }
.onboard-card { width: 100%; max-width: 360px; }
.onboard-logo { font-size: 2.5rem; margin-bottom: 12px; }
.onboard-title { font-family: var(--font-serif); font-size: 3rem; line-height: 1.1; color: var(--text-1); margin-bottom: 12px; }
.onboard-sub { font-size: 0.9rem; color: var(--text-2); margin-bottom: 32px; line-height: 1.6; }

/* ── ICON BTN ── */
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 1rem; transition: background 0.12s;
}
.icon-btn:hover { background: var(--surface-2); }

/* ── DETAIL MODAL ── */
.detail-info-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-tag { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500; background: var(--primary-bg); color: var(--primary-dim); }
.detail-section { margin-bottom: 14px; }
.detail-section h4 { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 4px; }
.detail-section p { font-size: 0.85rem; color: var(--text-2); line-height: 1.6; }
.detail-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.detail-stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.detail-stat-val { font-family: var(--font-serif); font-size: 1.4rem; color: var(--text-1); }
.detail-stat-label { font-size: 0.68rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.detail-btns { display: flex; gap: 8px; margin-top: 16px; }
.detail-log-btn { flex: 1; background: var(--primary); color: var(--surface); border-radius: var(--radius-sm); padding: 12px; font-size: 0.9rem; font-weight: 600; }
.detail-remove-btn { padding: 12px 16px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 0.82rem; color: var(--danger); }

/* ── FORM ROW ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group .form-label { margin-bottom: 0; }

/* ── UNIT TOGGLE ── */
.unit-toggle { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.unit-toggle-btn {
  flex: 1; padding: 7px; border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.82rem; font-weight: 500; color: var(--text-2); transition: all 0.15s;
}
.unit-toggle-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ── SEPARATOR ── */
.sep { height: 1px; background: var(--border-soft); margin: 4px 0; }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
