/* Jessie Health — iOS-style dark theme */
:root {
  --bg: #0e0e0e;
  --btn: #1a8434;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --ink: #ffffff;
  --muted: rgba(235, 235, 245, .6);
  --muted-2: rgba(235, 235, 245, .3);
  --line: rgba(84, 84, 88, .55);
  --green: #30d158;
  --green-dim: rgba(48, 209, 88, .16);
  --blue: #0a84ff;
  --pink: #ff375f;
  --pink-dim: rgba(255, 55, 95, .16);
  --orange: #ff9f0a;
  --orange-dim: rgba(255, 159, 10, .16);
  --red: #ff453a;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); text-decoration: none; }
img { max-width: 100%; }

svg.ico { width: 1.1em; height: 1.1em; vertical-align: -0.16em; flex-shrink: 0; }
.ico-lg { width: 1.7em; height: 1.7em; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 4px; }
h2 {
  font-size: .82rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 26px 0 8px 4px;
}
.sub { color: var(--muted); font-size: .92rem; margin: 0 0 14px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card.tap { cursor: pointer; transition: background .15s; }
.card.tap:active { background: var(--card-2); }

.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.chev { color: var(--muted-2); display: flex; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--btn); color: #fff; border: none;
  border-radius: 13px; padding: 14px 18px; font-weight: 700; font-size: 1rem;
  cursor: pointer; width: 100%; transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.985); opacity: .85; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.secondary { background: var(--card); color: var(--ink); }
.btn.small { width: auto; padding: 9px 14px; font-size: .88rem; border-radius: 11px; font-weight: 600; }
.btn.danger { background: rgba(255, 69, 58, .16); color: var(--red); }
.btn.ghost { background: none; border: none; color: var(--green); width: auto; padding: 6px 8px; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .7rem; font-weight: 700;
  padding: 2.5px 8px; border-radius: 999px; vertical-align: middle;
}
.badge.glute { background: var(--pink-dim); color: var(--pink); }
.badge.posture { background: var(--green-dim); color: var(--green); }
.badge.pb { background: var(--orange-dim); color: var(--orange); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: none;
  padding: 10px 16px; border-radius: 999px; cursor: pointer; font-size: .92rem; font-weight: 600;
  color: var(--muted);
}
.pill.on { background: var(--btn); color: #fff; }

.input, textarea.input, select.input {
  width: 100%; padding: 13px 14px; border: none; outline: none;
  border-radius: 12px; background: var(--card); margin: 5px 0 14px;
  color: var(--ink); font-size: 1rem;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { box-shadow: 0 0 0 2px var(--green); }
select.input { appearance: none; }
label.lbl { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: 4px; }
input[type="checkbox"] { accent-color: var(--green); width: 18px; height: 18px; }

.thumb {
  width: 56px; height: 56px; border-radius: 12px; object-fit: cover;
  background: var(--card-2); flex-shrink: 0;
}
.thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  color: var(--green); font-size: 1.4rem;
}

.meal-name { font-weight: 600; }
.meta { color: var(--muted); font-size: .82rem; }
.meta svg.ico { opacity: .75; }

.fav { background: none; border: none; font-size: 1.15rem; cursor: pointer; padding: 6px; color: var(--orange); }

/* Week grid */
.day-row { display: grid; grid-template-columns: 52px 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.day-label { font-size: .78rem; color: var(--muted); padding-top: 12px; text-align: center; font-weight: 600; }
.day-label.today { color: var(--green); font-weight: 800; }
.slot {
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
  padding: 10px; font-size: .8rem; min-height: 48px; cursor: pointer;
  display: flex; align-items: center;
}
.slot.filled { border: none; }

/* Workout */
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 14px; font-weight: 700; cursor: pointer;
  border: 2px solid transparent; transition: background .15s;
}
.split-card:active { background: var(--card-2); }
.split-card.suggested { border-color: var(--green); background: var(--green-dim); }
.split-card .meta { margin-top: 5px; font-size: .76rem; }
.split-card svg.ico { color: var(--green); }
.split-card .badge { margin-left: 2px; }

.ex-select {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-2); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; cursor: pointer;
  transition: background .15s;
}
.ex-select:active { background: #3a3a3c; }
.ex-select .grow { flex: 1; min-width: 0; }
.ex-select .add-mark { color: var(--green); display: flex; }
.ex-select, .card { -webkit-touch-callout: none; }
.ex-select { user-select: none; -webkit-user-select: none; }

ol.steps { margin: 6px 0 14px; padding-left: 22px; }
ol.steps li { margin-bottom: 8px; font-size: .92rem; line-height: 1.45; }
ol.steps li::marker { color: var(--green); font-weight: 700; }

.sets-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.sets-table th {
  font-size: .68rem; color: var(--muted); text-align: left; padding: 2px 4px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.sets-table td { padding: 3px 4px; }
.sets-table input {
  width: 100%; padding: 11px 8px; border: none; outline: none;
  border-radius: 10px; background: var(--card-2); text-align: center; color: var(--ink);
}
.sets-table input:focus { box-shadow: 0 0 0 2px var(--green); }
.sets-table .pb-mark { color: var(--orange); }
.set-del { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 6px; display: flex; }

.stat-line { font-size: .82rem; color: var(--muted); margin: 3px 0; }
.stat-line b { color: var(--ink); font-weight: 600; }
.suggest-line {
  display: flex; align-items: center; gap: 10px;
  background: var(--green-dim); border-radius: 10px;
  padding: 9px 11px; margin: 8px 0 2px; font-size: .84rem;
}
.suggest-line b { color: var(--green); }
.suggest-line .grow { flex: 1; min-width: 0; }

/* Bottom nav — iOS tab bar */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: rgba(14, 14, 14, .85);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: .5px solid var(--line);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .62rem; font-weight: 600; color: rgba(245, 245, 250, .85); min-width: 56px;
}
.bottom-nav a svg { width: 25px; height: 25px; }
.bottom-nav a.on { color: var(--green); }

/* Toast + timer */
.toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--card-2); color: var(--ink); padding: 11px 20px;
  border-radius: 999px; font-size: .9rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  max-width: 90vw; text-align: center;
  backdrop-filter: blur(20px);
}
.timer-chip {
  position: fixed; top: 12px; right: 12px; z-index: 50;
  background: var(--btn); color: #fff; font-weight: 800;
  padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.timer-chip.done { background: var(--pink); color: #fff; }

/* Login */
.login-wrap { padding-top: 11vh; text-align: center; }
.logo-mark {
  width: 84px; height: 84px; margin: 0 auto 8px;
  background: var(--green-dim); color: var(--green);
  border-radius: 24px; display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 44px; height: 44px; }
.user-tiles { display: flex; gap: 14px; justify-content: center; margin: 28px 0; }
.user-tile {
  background: var(--card); border-radius: var(--radius);
  padding: 26px 32px; font-weight: 700; font-size: 1.05rem; cursor: pointer;
  border: 2px solid transparent;
}
.user-tile.on { border-color: var(--green); background: var(--green-dim); }
.pin-input {
  font-size: 1.5rem; letter-spacing: .6em; text-align: center; max-width: 220px;
}

/* Progress */
.chart-svg { width: 100%; height: auto; }
.chart-svg polyline, .chart-svg circle { stroke: var(--green); }
.chart-svg circle { fill: var(--green); }
.chart-svg text { fill: var(--muted); }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: .8rem; }
.bar-row .bar { height: 16px; background: var(--pink); border-radius: 5px; min-width: 2px; }
.bar-row .lbl-w { width: 64px; color: var(--muted); flex-shrink: 0; }

/* 14-day mood strip on Today */
.streak-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.streak-cell { padding: 4px 0; }
.streak-cell .day { font-size: .58rem; color: var(--muted-2); font-weight: 600; margin-bottom: 3px; }
.streak-cell.today .day { color: var(--green); }
.streak-cell .face svg { width: 22px; height: 22px; }
.streak-cell .what {
  font-size: .56rem; font-weight: 600; color: var(--muted);
  margin-top: 2px; min-height: .8em; overflow: hidden; white-space: nowrap;
}
.face-happy { color: var(--green); }
.face-neutral { color: var(--muted-2); }
.face-sad { color: var(--red); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-cell { padding: 6px 0; border-radius: 10px; font-size: .8rem; position: relative; }
.cal-cell.today { background: var(--green-dim); color: var(--green); font-weight: 800; }
.cal-dots { display: flex; gap: 2px; justify-content: center; margin-top: 2px; min-height: 6px; }
.dot { width: 5px; height: 5px; border-radius: 50%; }
.dot.w { background: var(--green); }
.dot.p { background: var(--orange); }
.dot.m { background: var(--pink); }

.checklist label {
  display: flex; gap: 12px; padding: 11px 4px;
  border-bottom: .5px solid var(--line); align-items: baseline;
}
.checklist label:last-child { border-bottom: none; }
.strike { text-decoration: line-through; color: var(--muted-2); }

/* Bottom-sheet picker */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end;
}
.sheet {
  background: var(--card); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px; margin: 0 auto;
  max-height: 84vh; overflow-y: auto;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
}
.sheet::before {
  content: ""; display: block; width: 38px; height: 5px;
  background: var(--muted-2); border-radius: 3px; margin: 6px auto 10px;
}
.sheet .input { background: var(--card-2); }
.sheet .ex-select { background: var(--card-2); }
.muscle-head {
  font-size: .72rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin: 18px 0 7px 4px;
}

.divider { border: none; border-top: .5px solid var(--line); margin: 18px 0; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.notice {
  background: var(--green-dim); border-radius: 12px; padding: 12px 14px;
  font-size: .84rem; color: var(--muted); margin-bottom: 12px;
}
