/* ── Reset & base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding-bottom: 40px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.app { max-width: var(--maxw); margin: 0 auto; padding: 16px; }

a { color: inherit; }
img { max-width: 100%; display: block; }

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  padding: 4px 4px;
  margin-left: -4px;
  cursor: pointer;
}
.brand {
  flex: 1;
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}
.brand span {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 3px;
  letter-spacing: 0.14em;
}
.header-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  letter-spacing: 0.04em;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.screen-title {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 4px;
}
.screen-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

/* ── Navigation drawer ── */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 80%;
  max-width: 300px;
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0) + 20px) 0 24px;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.drawer-brand span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  display: block;
  letter-spacing: 0.14em;
  margin-top: 4px;
}
.drawer-group {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 20px 4px;
}
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  text-align: left;
  padding: 12px 20px;
  cursor: pointer;
}
.drawer-item .ico { font-size: 17px; width: 22px; text-align: center; }
.drawer-item:active { background: var(--surface2); }
.drawer-item.active {
  background: var(--surface2);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.drawer-foot {
  margin-top: auto;
  padding: 16px 20px 0;
  font-size: 9px;
  color: var(--faint);
  letter-spacing: 0.06em;
}

/* ── Buttons ── */
.btn {
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--bg);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 13px 16px;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }
.btn.ghost {
  background: none;
  color: var(--text);
  border-color: var(--border);
}
.btn.small { font-size: 13px; padding: 9px 12px; width: auto; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-row { display: flex; gap: 8px; }
.btn-row .btn { width: auto; flex: 1; }

/* ── Forms ── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.field .unit { color: var(--faint); text-transform: none; }

input[type="number"], input[type="text"], input[type="date"], select {
  width: 100%;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Segmented control */
.segmented {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.segmented button {
  flex: 1;
  background: var(--bg);
  border: none;
  border-right: 1.5px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 4px;
  cursor: pointer;
  text-transform: capitalize;
}
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--accent); color: var(--bg); }

/* Toggle list (checkboxes for body parts, etc.) */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lbl { font-size: 14px; }
.switch {
  position: relative;
  width: 42px; height: 24px;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--faint);
  border-radius: 24px;
  transition: background 0.15s;
}
.switch .track::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ── Utility ── */
.muted { color: var(--muted); }
.mono  { font-family: var(--mono); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.hidden { display: none !important; }

.empty {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  padding: 28px 12px;
  line-height: 1.6;
}
