/* CUT TRACKER v16 — premium mobile + iPad product skin */
:root {
  --bg: #090a0d;
  --surface: #14161b;
  --surface-2: #1a1d23;
  --surface-3: #20242c;
  --ink: #f7f7f3;
  --muted: #9297a2;
  --line: rgba(255,255,255,.085);
  --black: #090a0d;
  --orange: #ff6847;
  --orange-dark: #ff7a5d;
  --blue: #6c83ff;
  --green: #48d597;
  --red: #ff7069;
  --radius: 26px;
  --shadow: 0 24px 70px rgba(0,0,0,.32);
  --sidebar: 258px;
  --glass: rgba(20,22,27,.78);
  color-scheme: dark;
}

html { background: var(--bg); }
body {
  color: var(--ink);
  background:
    radial-gradient(circle at 0% -8%, rgba(255,104,71,.13), transparent 28rem),
    radial-gradient(circle at 100% 14%, rgba(108,131,255,.10), transparent 30rem),
    #090a0d;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
  letter-spacing: -.01em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image: radial-gradient(rgba(255,255,255,.11) .55px, transparent .55px);
  background-size: 6px 6px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}
::selection { color: #090a0d; background: var(--orange); }
button, input, select, textarea { color: inherit; }
button { touch-action: manipulation; }

/* Shell */
.app-sidebar {
  border-right: 1px solid var(--line);
  background: rgba(9,10,13,.92);
  backdrop-filter: blur(24px) saturate(150%);
}
.logo-glyph {
  color: #090a0d;
  background: linear-gradient(145deg, #ff8a6f, #ff5532);
  box-shadow: 0 10px 30px rgba(255,104,71,.25), inset 0 1px rgba(255,255,255,.4);
}
.logo-copy strong { color: #fff; }
.logo-copy small, .sidebar-footer p { color: #707580; }
.nav-link { color: #747985; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255,104,71,.26), rgba(255,104,71,.10));
  box-shadow: inset 0 0 0 1px rgba(255,104,71,.32);
}
.nav-link.active svg { color: var(--orange); }
.sidebar-settings-button,
.install-button {
  border-color: var(--line);
  background: rgba(255,255,255,.045);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.sidebar-settings-button:hover,
.install-button:hover { transform: translateY(-1px); border-color: rgba(255,104,71,.45); background: rgba(255,104,71,.09); }

.app-main { padding-top: 38px; }
.app-view { max-width: 1240px; }

/* Premium headings */
.view-header { margin-bottom: 22px; }
.view-header h1 {
  color: #fff;
  font-weight: 850;
  letter-spacing: -.075em;
}
.view-header h1 span { color: #5f646e; }
.view-header > div > p:last-child { color: var(--muted); }
.eyebrow { color: var(--orange); }

.primary-action, .secondary-action, .danger-action, .text-action, .recovery-banner button,
.date-button, .today-date-button, .header-action {
  min-height: 46px;
  border-radius: 15px;
  transition: transform .14s ease, filter .14s ease, border-color .14s ease, background .14s ease;
}
.primary-action {
  color: #0c0d10;
  background: linear-gradient(135deg, #ff8a6f, #ff5b37);
  box-shadow: 0 12px 30px rgba(255,104,71,.22), inset 0 1px rgba(255,255,255,.4);
}
.primary-action:hover { background: linear-gradient(135deg, #ff987f, #ff6847); filter: none; }
.secondary-action {
  border: 1px solid var(--line);
  color: #f5f5f2;
  background: rgba(255,255,255,.045);
}
.secondary-action:hover { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.075); }
.danger-action { color: #ff938e; background: rgba(255,112,105,.10); }
.primary-action:active, .secondary-action:active, .danger-action:active, .nav-link:active,
.date-button:active, .today-date-button:active, .header-action:active { transform: scale(.975); }

/* Date navigator */
.date-control {
  grid-template-columns: 48px minmax(0,1fr) auto 48px;
  max-width: none;
  margin: 0 0 16px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(20,22,27,.74);
  box-shadow: 0 14px 40px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
}
.date-button, .today-date-button {
  border: 0;
  color: #fff;
  background: rgba(255,255,255,.055);
}
.date-button { width: 48px; height: 48px; }
.today-date-button { padding: 0 17px; color: var(--orange); font-size: .72rem; font-weight: 850; }
.date-copy {
  border: 0;
  background: transparent;
  padding: 8px 10px;
}
.date-copy span { color: var(--orange); }
.date-copy strong { color: #f8f8f5; font-size: .92rem; }

/* Hero */
.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 30px;
  background:
    radial-gradient(circle at 84% 18%, rgba(255,104,71,.36), transparent 25%),
    radial-gradient(circle at 67% 110%, rgba(108,131,255,.16), transparent 34%),
    linear-gradient(145deg, #1b1d23 0%, #101115 54%, #0a0b0e 100%);
  box-shadow: 0 28px 90px rgba(0,0,0,.36), inset 0 1px rgba(255,255,255,.06);
}
.hero-card::after {
  content: "";
  position: absolute;
  right: -6%;
  bottom: -55%;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255,255,255,.018), 0 0 0 92px rgba(255,255,255,.012);
  pointer-events: none;
}
.hero-card-copy, .goal-widget { position: relative; z-index: 1; }
.status-pill {
  color: #120d0a;
  background: linear-gradient(135deg, #ff947d, #ff6342);
  box-shadow: inset 0 1px rgba(255,255,255,.35);
}
.status-pill.badge-recovery { color: #fff; background: linear-gradient(135deg, #7a90ff, #5269df); }
.hero-label-row { color: #7f8490; }
.hero-card h2 {
  margin-top: 28px;
  color: #fff;
  font-weight: 900;
  text-wrap: balance;
  text-shadow: 0 14px 42px rgba(0,0,0,.26);
}
.hero-card-copy > p { color: #a2a7b1; }
.hero-targets { gap: 9px; }
.hero-targets div {
  border-color: rgba(255,255,255,.09);
  background: rgba(255,255,255,.045);
  backdrop-filter: blur(10px);
}
.hero-targets span { color: #777d88; }
.hero-targets strong { color: #f5f5f1; }
.goal-ring {
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.3));
  background: conic-gradient(var(--orange) calc(var(--progress) * 1%), rgba(255,255,255,.09) 0);
}
.goal-ring::before { background: #111319; box-shadow: inset 0 0 0 1px var(--line); }
.goal-ring strong { color: #fff; }
.goal-ring span, .goal-widget p { color: #858a95; }

/* Snapshot cards */
.stat-strip {
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.stat-strip article {
  min-width: 0;
  border: 1px solid var(--line) !important;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(27,29,35,.96), rgba(19,21,26,.96));
  box-shadow: 0 14px 38px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.035);
}
.stat-strip span { color: #7d828d; text-transform: uppercase; letter-spacing: .08em; font-size: .58rem; }
.stat-strip strong { color: #fff; font-size: 1.55rem; }
.stat-strip small { color: #626873; }

/* Checklist shell */
.master-checklist-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.master-checklist-head {
  position: relative;
  overflow: hidden;
  margin: 18px 0 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(28,31,38,.98), rgba(18,20,25,.98));
  box-shadow: 0 18px 54px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.035);
}
.master-checklist-head::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -80px;
  top: -95px;
  border-radius: 50%;
  background: rgba(255,104,71,.14);
  filter: blur(35px);
}
.master-checklist-head > * { position: relative; z-index: 1; }
.master-checklist-head > div > span { color: var(--orange); }
.master-checklist-head h2 { color: #fff; font-size: clamp(1.55rem, 3vw, 2.15rem); }
.master-checklist-head p { color: #8e949f; }
.master-checklist-progress {
  grid-template-columns: minmax(120px,auto) minmax(0,1fr);
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(20,22,27,.76);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.master-checklist-progress strong { color: #f6f6f3; }
.progress-track { background: rgba(255,255,255,.075); }
.progress-track span {
  background: linear-gradient(90deg, #ff5d3b, #ff947c);
  box-shadow: 0 0 20px rgba(255,104,71,.32);
}
.master-checklist { position: relative; gap: 14px; }

/* The actual day flow */
.flow-step {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: rgba(20,22,27,.94);
  box-shadow: 0 18px 52px rgba(0,0,0,.18), inset 0 1px rgba(255,255,255,.025);
}
.flow-step > header {
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(30,33,40,.92), rgba(25,27,33,.92));
}
.flow-step-number {
  color: #0c0d10 !important;
  background: linear-gradient(145deg, #ff9279, #ff5936);
  box-shadow: 0 9px 25px rgba(255,104,71,.22), inset 0 1px rgba(255,255,255,.4);
}
.flow-step.is-complete {
  border-color: rgba(72,213,151,.34);
  box-shadow: 0 18px 52px rgba(0,0,0,.18), 0 0 0 1px rgba(72,213,151,.06), inset 0 1px rgba(255,255,255,.03);
}
.flow-step.is-complete > header { background: linear-gradient(180deg, rgba(31,50,43,.72), rgba(23,35,31,.72)); }
.flow-step.is-complete .flow-step-number { color: #08110d !important; background: linear-gradient(145deg, #6ce4ad, #38bf82); }
.flow-step-heading small { color: var(--orange) !important; }
.flow-step-heading strong { color: #f8f8f5; font-size: 1.05rem !important; }
.flow-step-heading p { color: #858b96; }
.flow-step > header > .master-group-count { color: #747a85; }
.flow-step-body { background: #101217; }

/* Check controls */
.master-check {
  width: 34px;
  height: 34px;
  border: 1.5px solid #565c67;
  border-radius: 12px;
  color: transparent;
  background: #191c22;
  box-shadow: inset 0 1px rgba(255,255,255,.035);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.flow-check-control:hover .master-check { border-color: #7f8692; }
.flow-check-control > input:checked + .master-check,
.master-task > input:checked + .master-check {
  color: #07100c;
  border-color: var(--green);
  background: linear-gradient(145deg, #68e4ad, #3ac987);
  box-shadow: 0 0 0 4px rgba(72,213,151,.10), 0 8px 20px rgba(72,213,151,.16);
  transform: scale(1.03);
}
.flow-check-control > input:focus-visible + .master-check,
.master-task > input:focus-visible + .master-check { outline-color: rgba(255,104,71,.5); }

/* Stretch cards */
.flow-stretch-grid { gap: 12px; }
.flow-stretch-card {
  border-color: var(--line);
  background: linear-gradient(145deg, #1c1f26, #17191f);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.flow-stretch-card:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.15); }
.flow-stretch-card > img {
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  background: #242832;
}
.flow-item-kicker { color: #8396ff; }
.flow-stretch-copy > strong { color: #f6f6f3; }
.flow-stretch-copy > small, .flow-details ol, .flow-details p { color: #8c929d; }
.flow-details { border-color: var(--line); }
.flow-details summary { color: var(--orange); }
.flow-stretch-card.is-done {
  border-color: rgba(72,213,151,.30);
  background: linear-gradient(145deg, rgba(31,61,49,.72), rgba(22,41,34,.72));
  opacity: .72;
}
.flow-stretch-card.is-done .flow-stretch-copy > strong { text-decoration: none; color: #9fe6c3; }

/* Cardio */
.flow-primary-task,
.inline-log-card {
  border-color: var(--line);
  background: linear-gradient(145deg, #1b1e25, #16181e);
}
.flow-primary-task { min-height: 76px; }
.master-task-icon {
  color: #fff;
  background: linear-gradient(145deg, #30343e, #22252c);
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}
.master-task-copy strong { color: #f7f7f4; }
.master-task-copy small { color: #858b96; }
.session-list li { color: #a2a7b1; }
.session-list li::before { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255,104,71,.07); }
.inline-log-head span { color: var(--orange); }
.inline-log-head strong { color: #f5f5f2; }

/* Form controls */
.cardio-log-grid label,
.master-log-fields label,
.master-log-wide,
.settings-grid label { color: #f4f4f1; }
.cardio-log-grid label > span,
.master-log-fields label > span,
.master-log-wide > span,
.settings-grid label > span { color: #858b96; }
.cardio-log-grid input,
.cardio-log-grid select,
.flow-prescription-grid input,
.master-log-fields input,
.master-log-fields select,
.master-log-fields textarea,
.master-log-wide textarea,
.settings-grid input,
.settings-grid select {
  min-height: 48px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 13px;
  color: #f8f8f5;
  background: #0f1116;
  box-shadow: inset 0 1px rgba(255,255,255,.02);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { line-height: 1.45; }
.cardio-log-grid input:focus,
.cardio-log-grid select:focus,
.flow-prescription-grid input:focus,
.master-log-fields input:focus,
.master-log-fields select:focus,
.master-log-fields textarea:focus,
.master-log-wide textarea:focus,
.settings-grid input:focus,
.settings-grid select:focus {
  border-color: rgba(255,104,71,.62);
  background: #13151b;
  box-shadow: 0 0 0 4px rgba(255,104,71,.09);
}
input::placeholder, textarea::placeholder { color: #555b66; opacity: 1; }
select option { background: #15171c; }

/* Exercises */
.rule-chips span {
  color: #949aa5;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.04);
}
.flow-exercise-card {
  border-color: var(--line);
  background: linear-gradient(145deg, #1b1e24, #16181e);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.flow-exercise-card.is-core {
  border-color: rgba(108,131,255,.26);
  background: linear-gradient(145deg, rgba(41,48,78,.72), rgba(24,28,44,.84));
}
.flow-exercise-main .core-icon { background: linear-gradient(145deg, #7a8fff, #566bdd); }
.flow-exercise-copy strong { color: #f8f8f5; }
.flow-exercise-copy small { color: #7f91ff; }
.flow-prescription-grid {
  border-color: var(--line);
  background: rgba(9,10,13,.42);
}
.flow-prescription-grid span { color: #6f7580; }
.flow-prescription-grid strong { color: #dfe1e5; }
.flow-exercise-card.is-done {
  border-color: rgba(72,213,151,.30);
  background: linear-gradient(145deg, rgba(31,61,49,.72), rgba(22,41,34,.72));
  opacity: .74;
}
.flow-exercise-card.is-done .flow-exercise-copy strong { color: #9fe6c3; text-decoration: none; }

/* Daily log */
.master-log-panels { gap: 12px; background: #101217; }
.master-log-panel {
  border-color: var(--line);
  background: linear-gradient(145deg, #1b1e24, #16181e);
}
.master-log-check-row { border-color: var(--line); background: rgba(255,255,255,.015); }
.master-log-icon { background: linear-gradient(145deg, #7188ff, #4f65db); }
.master-log-fields { background: transparent; }
.master-log-panel-heading strong { color: #f7f7f4; }
.master-log-panel-heading small { color: #858b96; }
.master-log-panel-heading > span { color: #0c0d10; background: linear-gradient(145deg, #ff9279, #ff5936); }
.save-badge { color: #8d939e; border-color: var(--line); background: rgba(255,255,255,.04); }
.save-badge.is-saved { color: #83dfb1; border-color: rgba(72,213,151,.22); background: rgba(72,213,151,.08); }

/* Data and recovery cards */
.data-card,
.recovery-banner,
.progress-card,
.stretch-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #191c22, #121419);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.025);
}
.data-card { color: #fff; }
.data-card p { color: #7f8590; }
.storage-location { color: #8b919c; background: rgba(255,255,255,.04); border-color: var(--line); }
.data-card .secondary-action { border-color: var(--line); color: #fff; background: rgba(255,255,255,.045); }
.settings-summary-line strong { color: #fff; }
.settings-summary-line span { color: #7f8590; }
.recovery-banner {
  background:
    radial-gradient(circle at 88% 20%, rgba(108,131,255,.21), transparent 30%),
    linear-gradient(145deg, #1d2337, #121622);
}
.recovery-banner button { color: #fff; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.08); }
.safety-note { color: #e6b0ad; border-color: rgba(255,112,105,.18); background: rgba(255,112,105,.07); }

/* Progress screen */
.progress-summary > div { border-color: var(--line); background: rgba(255,255,255,.035); }
.progress-summary span, .progress-summary small { color: #777d88; }
.progress-summary strong { color: #fff; }
.chart-wrap { border-color: var(--line); background: #0f1116; }
.empty-chart { color: #777d88; }
.range-buttons { border-color: var(--line); background: rgba(255,255,255,.035); }
.range-button { color: #858b96; background: transparent; }
.range-button.active { color: #0c0d10; background: var(--orange); }

/* Stretch library */
.stretch-card { overflow: hidden; }
.stretch-card img { background: #252832; }
.stretch-card-copy { background: transparent; }
.stretch-area { color: #8396ff; }
.stretch-card h3 { color: #fff; }
.stretch-steps, .stretch-tip { color: #9399a4; }
.stretch-meta span { color: #a8adb6; background: rgba(255,255,255,.055); }
.timer-display { border-color: rgba(255,104,71,.24); background: rgba(255,104,71,.10); color: #fff; }

/* Sticky save dock */
.save-bar {
  bottom: calc(14px + env(safe-area-inset-bottom));
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(18,20,25,.84);
  box-shadow: 0 20px 60px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(24px) saturate(150%);
}
.toast {
  color: #0c0d10;
  background: linear-gradient(135deg, #6ae3ad, #42ca8c);
  box-shadow: 0 18px 50px rgba(0,0,0,.32);
  font-weight: 800;
}

/* Settings */
.settings-dialog {
  color: #fff;
  border: 1px solid var(--line);
  background: #111319;
  box-shadow: 0 34px 100px rgba(0,0,0,.55);
}
.settings-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(12px); }
.settings-dialog-head span { color: var(--orange); }
.settings-dialog-head h2 { color: #fff; }
.settings-dialog-head p, .settings-grid small { color: #858b96; }
.dialog-close { color: #fff; background: rgba(255,255,255,.075); }
.settings-grid label { border-color: var(--line); background: #191c22; }
.settings-note { color: #b8c3ff; border-color: rgba(108,131,255,.22); background: rgba(108,131,255,.10); }

/* Mobile and iPad are the primary product */
@media (max-width: 1199px) {
  .app-sidebar { display: none; }
  .mobile-header {
    position: sticky;
    inset: 0 0 auto;
    z-index: 100;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    min-height: calc(62px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    border-bottom: 1px solid var(--line);
    color: #fff;
    background: rgba(9,10,13,.80);
    box-shadow: 0 8px 30px rgba(0,0,0,.16);
    backdrop-filter: blur(22px) saturate(150%);
  }
  .mobile-logo {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    color: #0b0c0f;
    background: linear-gradient(145deg, #ff9279, #ff5936);
    box-shadow: 0 9px 24px rgba(255,104,71,.18), inset 0 1px rgba(255,255,255,.38);
    font-size: .78rem;
    font-weight: 950;
    letter-spacing: -.05em;
  }
  .mobile-logo span { font-size: .68rem; }
  #mobileHeaderTitle { padding-left: 12px; font-size: .86rem; font-weight: 800; }
  .mobile-header-actions { justify-self: end; }
  .header-action {
    min-width: 44px;
    border: 1px solid var(--line);
    color: #fff;
    background: rgba(255,255,255,.055);
  }
  #mobileSaveShortcut { color: #0d0e11; border: 0; background: var(--orange); font-weight: 850; }
  .app-main {
    min-height: 100dvh;
    margin-left: 0;
    padding: 20px clamp(16px, 3vw, 30px) calc(118px + env(safe-area-inset-bottom));
  }
  .app-view { max-width: 980px; }
  .bottom-nav {
    position: fixed;
    z-index: 110;
    left: 50%;
    right: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(3, minmax(84px, 1fr));
    width: min(500px, calc(100vw - 24px));
    padding: 7px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 24px;
    background: rgba(19,21,26,.88);
    box-shadow: 0 22px 65px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.04);
    backdrop-filter: blur(24px) saturate(160%);
    transform: translateX(-50%);
  }
  .bottom-nav .nav-link {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    min-height: 55px;
    padding: 6px 10px;
    border-radius: 18px;
    color: #737985;
    font-size: .62rem;
  }
  .bottom-nav .nav-link svg { width: 20px; height: 20px; }
  .bottom-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(145deg, rgba(255,104,71,.23), rgba(255,104,71,.10));
    box-shadow: inset 0 0 0 1px rgba(255,104,71,.24);
  }
  .bottom-nav .nav-link.active svg { color: var(--orange); }
  .toast { left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .view-header h1 { font-size: clamp(2.4rem, 7vw, 4.8rem); }
  .hero-card { grid-template-columns: minmax(0,1fr) 210px; }
  .stat-strip { grid-template-columns: repeat(5, minmax(140px,1fr)); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
  .stat-strip::-webkit-scrollbar { display: none; }
  .stat-strip article { scroll-snap-align: start; }
}

@media (min-width: 700px) and (max-width: 1199px) {
  .app-main { padding-top: 26px; }
  .dashboard-header { display: none; }
  .date-control { position: sticky; top: calc(70px + env(safe-area-inset-top)); z-index: 45; }
  .hero-card { padding: 38px; }
  .hero-card h2 { font-size: clamp(4.8rem, 9vw, 7rem); }
  .flow-stretch-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .flow-stretch-card { grid-template-columns: 36px 112px minmax(0,1fr); }
  .flow-stretch-card > img { width: 112px; height: 138px; }
  .master-log-fields { padding: 16px; }
}

@media (max-width: 699px) {
  body { background: radial-gradient(circle at 50% -5%, rgba(255,104,71,.12), transparent 24rem), #090a0d; }
  .app-main { padding-inline: 12px; padding-top: 14px; }
  .dashboard-header { display: none; }
  .date-control {
    position: sticky;
    top: calc(68px + env(safe-area-inset-top));
    z-index: 45;
    grid-template-columns: 42px minmax(0,1fr) 42px;
    gap: 6px;
    padding: 6px;
    border-radius: 17px;
  }
  .today-date-button { display: none; }
  .date-button { width: 42px; height: 42px; min-height: 42px; border-radius: 12px; }
  .date-copy { grid-template-columns: 1fr; gap: 2px; padding: 5px 6px; text-align: center; }
  .date-copy span { font-size: .53rem; }
  .date-copy strong { font-size: .76rem; }
  .hero-card {
    grid-template-columns: 1fr;
    gap: 22px;
    min-height: 0;
    padding: 24px 20px;
    border-radius: 27px;
  }
  .hero-card h2 { margin: 22px 0 9px; font-size: clamp(3.55rem, 18vw, 5.4rem); }
  .hero-card-copy > p { font-size: .85rem; line-height: 1.55; }
  .hero-targets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 24px; }
  .hero-targets div { min-width: 0; padding: 11px 9px; border-radius: 13px; }
  .hero-targets span { font-size: .5rem; }
  .hero-targets strong { font-size: .67rem; line-height: 1.3; }
  .goal-widget {
    grid-template-columns: 116px minmax(0,1fr);
    align-items: center;
    justify-items: start;
    text-align: left;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  .goal-ring { width: 108px; height: 108px; }
  .goal-ring::before { width: 84px; height: 84px; }
  .goal-ring strong { font-size: 1.55rem; }
  .goal-widget p { margin: 0; font-size: .68rem; }
  .stat-strip { margin-block: 12px 18px; grid-template-columns: repeat(5, 142px); gap: 8px; }
  .stat-strip article { padding: 16px; border-radius: 18px; }
  .stat-strip strong { font-size: 1.32rem; }
  .master-checklist-head { display: grid; padding: 18px; border-radius: 22px; }
  .master-checklist-head .secondary-action { width: 100%; }
  .master-checklist-progress { grid-template-columns: 1fr; gap: 9px; padding: 13px; }
  .master-checklist { gap: 12px; }
  .flow-step { border-radius: 22px; }
  .flow-step > header {
    grid-template-columns: 44px minmax(0,1fr);
    min-height: 0;
    padding: 14px 12px;
  }
  .flow-step-number { width: 42px; height: 42px; border-radius: 14px; }
  .flow-step-heading strong { font-size: .93rem !important; }
  .flow-step-heading p { font-size: .62rem; }
  .flow-step > header > .master-group-count { grid-column: 2; font-size: .58rem; }
  .flow-step-body { padding: 9px; }
  .flow-stretch-card {
    grid-template-columns: 34px 82px minmax(0,1fr);
    gap: 9px;
    min-height: 112px;
    padding: 9px;
    border-radius: 18px;
  }
  .flow-stretch-card > img { width: 82px; height: 108px; border-radius: 13px; }
  .flow-stretch-copy > strong { font-size: .81rem; }
  .flow-stretch-copy > small { font-size: .59rem; }
  .flow-details summary { min-height: 34px; display: flex; align-items: center; }
  .flow-primary-task { grid-template-columns: 34px 46px minmax(0,1fr); padding: 11px; border-radius: 17px; }
  .master-task-icon { width: 46px; height: 46px; }
  .session-list { margin: 16px 2px; }
  .session-list li { font-size: .72rem; }
  .inline-log-card { padding: 12px; border-radius: 16px; }
  .cardio-log-grid { grid-template-columns: 1fr 1fr; }
  .cardio-log-grid label:first-child { grid-column: 1 / -1; }
  .flow-exercise-card { border-radius: 18px; }
  .flow-exercise-main { grid-template-columns: 34px 44px minmax(0,1fr); padding: 11px; }
  .flow-exercise-main .master-task-icon { width: 44px; height: 44px; }
  .flow-prescription-grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px; }
  .master-log-panels { padding: 9px; }
  .master-log-panel { border-radius: 18px; }
  .master-log-fields { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 11px; }
  .master-log-wide { grid-column: 1 / -1; }
  .data-card { padding: 18px; }
  .data-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .data-actions .file-button { grid-column: 1 / -1; }
  .recovery-banner { border-radius: 22px; }
  .save-bar {
    bottom: calc(86px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 8px;
    border-radius: 20px;
  }
  .save-bar .primary-action { min-height: 50px; }
  .save-bar #markComplete { display: none; }
  .save-bar .danger-action { width: 50px; overflow: hidden; color: transparent; position: relative; }
  .save-bar .danger-action::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font-size: 1.35rem; }
  .stretch-grid { grid-template-columns: 1fr; }
  .progress-card { padding: 14px; border-radius: 22px; }
  .progress-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .progress-summary > div { padding: 12px 9px; }
  .progress-summary strong { font-size: .98rem; }
  .chart-wrap { min-height: 320px; }
}

@media (max-width: 390px) {
  .mobile-header { padding-inline: 11px; }
  #mobileSaveShortcut { padding-inline: 12px; }
  .hero-targets { grid-template-columns: 1fr; }
  .hero-targets div { display: flex; align-items: center; justify-content: space-between; }
  .hero-targets strong { margin-top: 0; text-align: right; }
  .flow-stretch-card { grid-template-columns: 34px 72px minmax(0,1fr); }
  .flow-stretch-card > img { width: 72px; height: 96px; }
  .master-log-fields { grid-template-columns: 1fr; }
  .body-log-fields label:last-child { grid-column: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .app-view.active { animation: premiumViewIn .28s cubic-bezier(.2,.75,.2,1); }
  @keyframes premiumViewIn { from { opacity: 0; transform: translateY(10px) scale(.995); } to { opacity: 1; transform: none; } }
  .flow-step.is-complete .flow-step-number { animation: completePop .28s cubic-bezier(.2,1.6,.45,1); }
  @keyframes completePop { 0% { transform: scale(.82); } 100% { transform: scale(1); } }
}

/* The top-bar Save action is always available on phone/iPad, so the final actions
   stay in the document flow instead of covering workout content. */
@media (max-width: 1199px) {
  .save-bar {
    position: static;
    bottom: auto;
    margin-top: 18px;
    margin-bottom: 8px;
  }
}
@media (max-width: 699px) {
  .save-bar {
    position: static;
    bottom: auto;
    grid-template-columns: minmax(0,1fr) auto;
  }
}

/* Phone and iPad use the settings cog in the mobile header.
   Hide the duplicate Edit targets control at these widths. */
@media (max-width: 1199px) {
  #openSettings {
    display: none !important;
  }
}
