:root {
  --bg: #07111f;
  --bg2: #0b1628;
  --card: rgba(15, 27, 47, .78);
  --card-solid: #101c31;
  --text: #e5f6ff;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, .18);
  --blue: #3b82f6;
  --cyan: #5eead4;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 24px 80px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100%; background:
  radial-gradient(circle at top left, rgba(59,130,246,.22), transparent 32rem),
  radial-gradient(circle at bottom right, rgba(20,184,166,.16), transparent 28rem),
  linear-gradient(180deg, var(--bg), #050914 80%); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.auth-shell { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.auth-card { width: min(460px, 100%); padding: 24px; border-radius: 28px; }
.brand-mark { width: 62px; height: 62px; border-radius: 22px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, rgba(59,130,246,.45), rgba(94,234,212,.25)); margin-bottom: 14px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.04; margin-bottom: 8px; }
h2 { font-size: 25px; line-height: 1.08; margin-bottom: 8px; }
h3 { font-size: 18px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.eyebrow { color: var(--cyan); text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 800; margin-bottom: 6px; }
.hidden { display: none !important; }
.stack { display: grid; gap: 12px; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 6px; }
label { color: var(--muted); font-size: 13px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 16px; background: rgba(7, 17, 31, .7); color: var(--text); padding: 13px 14px; outline: none; }
textarea { min-height: 76px; resize: vertical; grid-column: 1 / -1; }
input:focus, textarea:focus, select:focus { border-color: rgba(94, 234, 212, .65); box-shadow: 0 0 0 4px rgba(94, 234, 212, .08); }

.glass, .card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.card { border-radius: 24px; padding: 16px; margin-bottom: 14px; }
.primary, .success, .ghost, .icon-button { border: 0; border-radius: 16px; color: var(--text); padding: 13px 16px; font-weight: 800; }
.primary { background: linear-gradient(135deg, var(--blue), #0891b2); box-shadow: 0 14px 32px rgba(59,130,246,.22); }
.success { background: linear-gradient(135deg, var(--green), #0f766e); }
.ghost { background: rgba(148,163,184,.1); border: 1px solid var(--line); margin-bottom: 12px; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; background: rgba(148,163,184,.1); border: 1px solid var(--line); padding: 0; }
.large, .wide { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; }
.error { color: #fecaca; font-weight: 700; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: rgba(7, 17, 31, .7); border-radius: 18px; padding: 6px; margin: 18px 0; border: 1px solid var(--line); }
.segmented button { border: 0; border-radius: 13px; background: transparent; color: var(--muted); padding: 11px; font-weight: 800; }
.segmented button.active { color: var(--text); background: rgba(59,130,246,.24); }

.app-shell { width: min(720px, 100%); margin: 0 auto; min-height: 100dvh; padding: max(14px, env(safe-area-inset-top)) 14px 92px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; background: linear-gradient(180deg, rgba(7,17,31,.96), rgba(7,17,31,.72), transparent); backdrop-filter: blur(10px); }
.topbar h1 { font-size: 23px; margin: 0; }
.screen { animation: enter .22s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); width: min(720px, calc(100% - 18px)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px; border-radius: 24px; background: rgba(6, 14, 26, .92); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(18px); z-index: 20; }
.bottom-nav button { border: 0; border-radius: 17px; background: transparent; color: var(--muted); min-height: 54px; display: grid; gap: 2px; place-items: center; padding: 7px 3px; }
.bottom-nav button span { font-size: 19px; }
.bottom-nav button small { font-size: 10px; }
.bottom-nav button.active { background: rgba(59,130,246,.25); color: var(--text); }

.hero-card { border-radius: 28px; padding: 18px; display: grid; grid-template-columns: 1fr 112px; align-items: center; gap: 14px; margin-bottom: 14px; }
.radial { --value: 0; width: 104px; height: 104px; border-radius: 999px; display: grid; place-items: center; background: conic-gradient(var(--cyan) calc(var(--value) * 1%), rgba(148,163,184,.18) 0); position: relative; }
.radial::after { content: ''; position: absolute; inset: 9px; background: var(--bg2); border-radius: inherit; }
.radial span { position: relative; z-index: 1; font-weight: 900; font-size: 20px; }
.cards-grid { margin-bottom: 14px; }
.stat { min-height: 118px; margin: 0; display: grid; align-content: space-between; }
.stat span { font-size: 24px; }
.stat p { color: var(--muted); margin: 0; font-size: 13px; }
.stat strong { font-size: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border-radius: 999px; padding: 6px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 900; }
.badge.todo { background: rgba(59,130,246,.17); color: #bfdbfe; }
.badge.fait { background: rgba(34,197,94,.18); color: #bbf7d0; }
.badge.attention { background: rgba(245,158,11,.18); color: #fde68a; }
.badge.progression { background: rgba(94,234,212,.16); color: #ccfbf1; }
.danger-card { border-color: rgba(239,68,68,.26); background: linear-gradient(135deg, rgba(127,29,29,.36), rgba(15,27,47,.78)); }
.next-card p { color: var(--muted); }
.macro-mini { display: grid; gap: 9px; }
.macro-mini span { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 9px; color: var(--muted); }
.macro-mini b { color: var(--text); text-align: right; }
.notice { border: 1px dashed rgba(94,234,212,.34); color: #ccfbf1; background: rgba(20,184,166,.08); padding: 13px; border-radius: 18px; margin-bottom: 12px; }

.workout-list { display: grid; gap: 10px; }
.workout-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; text-align: left; color: var(--text); border-radius: 22px; padding: 14px; border: 1px solid var(--line); }
.workout-row strong { display: block; margin-bottom: 4px; }
.workout-row small { display: block; color: var(--muted); line-height: 1.35; }
.workout-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.exercise-list { display: grid; gap: 12px; }
.exercise-card { border: 1px solid var(--line); background: rgba(15,27,47,.7); border-radius: 24px; overflow: hidden; transition: .18s ease; }
.exercise-card.done { border-color: rgba(34,197,94,.5); box-shadow: 0 0 0 1px rgba(34,197,94,.25); }
.exercise-main { width: 100%; display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 0; color: var(--text); background: transparent; text-align: left; }
.exercise-main img { width: 84px; height: 66px; object-fit: cover; border-radius: 16px; background: #0b1628; border: 1px solid var(--line); }
.exercise-main strong { display: block; margin-bottom: 4px; }
.exercise-main small { color: var(--muted); line-height: 1.3; }
.exercise-detail { padding: 0 12px 14px; display: grid; gap: 12px; }
.detail-grid { display: grid; gap: 10px; }
.detail-grid div { padding: 12px; border-radius: 16px; background: rgba(7,17,31,.55); border: 1px solid var(--line); }
.detail-grid b { display: block; margin-bottom: 5px; }
.detail-grid span { color: var(--muted); line-height: 1.42; }
.hernia-note { padding: 12px; border-radius: 16px; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.25); color: #fde68a; font-weight: 700; }
.log-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.log-form button { grid-column: 1 / -1; }
.summary-card { border-color: rgba(34,197,94,.4); }
.form-grid button { grid-column: 1 / -1; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 14px; }
.photo-card { background: rgba(7,17,31,.6); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.photo-card img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.photo-card small { display: block; color: var(--muted); padding: 8px; }
.plan-row { display: grid; grid-template-columns: .8fr 1.3fr 1fr; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: rgba(7,17,31,.4); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 90px; transform: translateX(-50%); width: min(520px, calc(100% - 28px)); padding: 14px 16px; border-radius: 18px; background: rgba(15, 27, 47, .96); border: 1px solid rgba(94,234,212,.35); color: var(--text); box-shadow: var(--shadow); font-weight: 800; }
.error-toast { border-color: rgba(239,68,68,.55); }

@media (max-width: 420px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .hero-card { grid-template-columns: 1fr; }
  .radial { width: 96px; height: 96px; }
  .bottom-nav { gap: 4px; padding: 6px; }
  .bottom-nav button small { font-size: 9px; }
  .exercise-main { grid-template-columns: 72px 1fr; }
  .exercise-main .badge { grid-column: 1 / -1; }
  .exercise-main img { width: 72px; height: 58px; }
  .log-form, .form-grid, .plan-row { grid-template-columns: 1fr; }
  textarea, .form-grid button { grid-column: auto; }
}
