/* ── base.css ── */
:root {
  --teal: #1BBFA5;
  --teal-light: #2DD4BB;
  --teal-dark: #0E9B85;
  --teal-bg: #E6FAF7;
  --teal-pale: #F0FDFB;
  --red: #FF6B6B;
  --red-light: #FFE9E9;
  --green: #22C997;
  --green-light: #E6FAF2;
  --text-primary: #1A2637;
  --text-secondary: #6B7C93;
  --text-muted: #A3B1C2;
  --bg: #F4F8FB;
  --card: #FFFFFF;
  --card-shadow: 0 4px 20px rgba(27, 191, 165, 0.10), 0 1px 4px rgba(0,0,0,0.04);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --nav-h: 68px;
  --font-num: 'Nunito', sans-serif;
  --font-body: 'Noto Sans SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* App shell - phone-sized centered container */
.app-shell {
  position: relative;
  max-width: 430px;
  margin: 0 auto;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.12);
}

/* Pages */
.page {
  position: absolute;
  inset: 0;
  bottom: var(--nav-h);
  display: none;
  flex-direction: column;
}
.page.active { display: flex; }

.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 24px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page-scroll::-webkit-scrollbar { display: none; }

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--card);
  display: flex;
  border-top: 1px solid rgba(27,191,165,0.12);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 11px;
  transition: color .2s, transform .15s;
  padding: 8px 0;
}
.nav-item:active { transform: scale(.92); }
.nav-item.active { color: var(--teal); }
.nav-item.active svg { stroke: var(--teal); }

/* FAB */
.fab {
  position: absolute;
  bottom: calc(var(--nav-h) + 20px);
  right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--teal);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 24px rgba(27,191,165,0.45);
  transition: transform .2s, box-shadow .2s;
  z-index: 10;
}
.fab:active { transform: scale(.92); box-shadow: 0 3px 12px rgba(27,191,165,0.35); }

/* Generic helpers */
.pos { color: var(--red); }
.neg { color: var(--teal-dark); }
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background .15s;
}
.icon-btn:active { background: var(--teal-bg); }

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: flex-end;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal-sheet {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 16px 24px 40px;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,1,.5,1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px;
  background: #DDE3EA;
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal-title {
  font-size: 18px; font-weight: 700;
  text-align: center; margin-bottom: 24px;
  color: var(--text-primary);
}
.modal-weight-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}
.modal-adj {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--teal-bg);
  color: var(--teal-dark);
  font-size: 22px; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-adj:active { background: var(--teal); color: #fff; }
.modal-weight-val {
  font-family: var(--font-num);
  font-size: 48px; font-weight: 900;
  color: var(--text-primary);
  min-width: 110px; text-align: center;
}
.modal-weight-unit { font-size: 16px; color: var(--text-secondary); }
.modal-date-row {
  display: flex; align-items: center; gap: 8px;
  justify-content: center; margin-bottom: 24px;
  font-size: 15px; color: var(--text-secondary);
}
.modal-save {
  width: 100%; height: 50px;
  border-radius: var(--radius-md);
  background: var(--teal);
  border: none;
  color: #fff;
  font-size: 16px; font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  margin-bottom: 10px;
  transition: background .15s;
}
.modal-save:active { background: var(--teal-dark); }
.modal-cancel {
  width: 100%; height: 44px;
  border-radius: var(--radius-md);
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 15px; cursor: pointer;
  font-family: var(--font-body);
}
