:root {
  --ink: #173f49;
  --ink-soft: #47656a;
  --paper: #f7f5ef;
  --card: #fffdf9;
  --teal: #2c8d83;
  --teal-soft: #d7eadf;
  --coral: #c6775e;
  --yellow: #f1dca3;
  --line: #dfe6df;
  --shadow: 0 18px 48px rgba(23, 63, 73, .10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 8% 0%, #eef6ee 0, transparent 34%), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding-bottom: 52px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 0 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 15px; background: var(--ink); display: grid; place-items: center; color: #fff; font-size: 24px; box-shadow: 0 8px 18px rgba(23,63,73,.18); }
.brand h1 { font-size: 17px; letter-spacing: -.02em; margin: 0; }
.brand p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; }
.status { border: 1px solid var(--line); background: rgba(255,255,255,.72); color: var(--ink-soft); padding: 9px 13px; border-radius: 999px; font-size: 12px; }
.status.live { color: #236b5e; border-color: #afd9ca; background: #effaf3; }
.nav { display: flex; gap: 7px; overflow-x: auto; padding: 4px; margin-bottom: 26px; background: rgba(255,255,255,.68); border: 1px solid var(--line); border-radius: 14px; }
.nav button { border: 0; background: transparent; color: var(--ink-soft); padding: 10px 15px; border-radius: 10px; white-space: nowrap; font-weight: 700; font-size: 13px; }
.nav button.active { background: var(--ink); color: #fff; box-shadow: 0 5px 12px rgba(23,63,73,.18); }
.hero { display: grid; grid-template-columns: 1.08fr .92fr; gap: 20px; min-height: 380px; background: var(--ink); color: white; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.hero-copy { padding: clamp(28px, 5vw, 58px); display: flex; flex-direction: column; justify-content: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: 11px; font-weight: 800; color: #b7daca; margin: 0 0 14px; }
.hero h2 { margin: 0; font-size: clamp(32px, 4vw, 58px); line-height: .98; letter-spacing: -.055em; max-width: 580px; }
.hero-copy > p:not(.eyebrow) { max-width: 480px; color: #d3e2dd; line-height: 1.6; margin: 20px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.hero-image { min-height: 380px; background: #cee2d9; position: relative; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.hero-image:after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(23,63,73,.32), transparent 40%); pointer-events: none; }
.button { border: 0; padding: 12px 17px; border-radius: 12px; font-weight: 800; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--teal); color: white; box-shadow: 0 8px 17px rgba(44,141,131,.26); }
.button.secondary { background: #f7eee4; color: var(--ink); }
.button.ghost { background: rgba(255,255,255,.12); color: white; border: 1px solid rgba(255,255,255,.27); }
.button.small { padding: 9px 12px; font-size: 12px; }
.button.ink { background: var(--ink); color: #fff; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0 26px; }
.metric, .panel, .exercise-card { background: rgba(255,253,249,.9); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(23,63,73,.05); }
.metric { padding: 18px; }
.metric .value { font-size: 26px; font-weight: 900; letter-spacing: -.04em; }
.metric .label { color: var(--ink-soft); font-size: 12px; margin-top: 4px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 32px 0 15px; }
.section-head h3 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.section-head p { color: var(--ink-soft); margin: 6px 0 0; font-size: 13px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 22px; }
.panel h3 { margin: 0 0 8px; font-size: 18px; letter-spacing: -.03em; }
.panel > p { color: var(--ink-soft); font-size: 13px; line-height: 1.55; margin: 0 0 18px; }
.mode-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { border-radius: 999px; padding: 6px 9px; background: var(--teal-soft); color: #25675c; font-size: 11px; font-weight: 900; }
.pill.coral { background: #f6e0d6; color: #914e3b; }
.next-box { border-radius: 16px; background: #eff7f1; padding: 17px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 18px 0; }
.next-box strong { display: block; font-size: 27px; letter-spacing: -.05em; }
.next-box span { color: var(--ink-soft); font-size: 12px; }
.intervals { display: flex; gap: 7px; flex-wrap: wrap; }
.intervals button { border: 1px solid var(--line); background: white; color: var(--ink-soft); border-radius: 10px; padding: 9px 11px; font-size: 12px; font-weight: 800; }
.intervals button.selected { border-color: var(--teal); color: var(--teal); background: #effaf3; }
.notice { border-left: 4px solid var(--coral); background: #fff5ef; color: #744638; padding: 12px 14px; border-radius: 11px; font-size: 12px; line-height: 1.5; }
.home-callout { background: #f6efe1; }
.home-callout .home-time { font-size: 42px; line-height: 1; font-weight: 900; letter-spacing: -.07em; margin: 18px 0 7px; }
.phase-list { display: grid; gap: 8px; margin: 15px 0 20px; }
.phase { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.phase b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--teal); font-size: 11px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar input { min-width: 220px; flex: 1; border: 1px solid var(--line); background: white; border-radius: 11px; padding: 12px 13px; color: var(--ink); }
.filter { border: 1px solid var(--line); background: white; padding: 10px 11px; border-radius: 11px; color: var(--ink-soft); }
.exercise-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.exercise-card { overflow: hidden; }
.exercise-card img { width: 100%; height: 155px; object-fit: cover; display: block; background: #dceae2; }
.exercise-body { padding: 15px; }
.exercise-body h4 { margin: 0 0 5px; font-size: 15px; letter-spacing: -.02em; }
.exercise-body p { margin: 0 0 11px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.exercise-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dose { font-size: 12px; font-weight: 900; color: var(--teal); }
.tag { font-size: 10px; color: var(--ink-soft); background: #f1f2ec; padding: 5px 7px; border-radius: 999px; }
.routine-shell { max-width: 820px; margin: 0 auto; }
.routine-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 18px; }
.routine-head h2 { margin: 0; font-size: 30px; letter-spacing: -.05em; }
.routine-head p { color: var(--ink-soft); margin: 7px 0 0; font-size: 13px; }
.progress { height: 10px; background: #e1e9e2; border-radius: 99px; overflow: hidden; margin: 15px 0 21px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #75bd94); transition: width .3s; }
.phase-card { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; padding: 0; }
.phase-card img { width: 100%; height: 100%; min-height: 320px; object-fit: cover; }
.phase-copy { padding: 28px; display: flex; flex-direction: column; justify-content: center; }
.phase-copy .phase-number { color: var(--coral); text-transform: uppercase; font-size: 11px; letter-spacing: .13em; font-weight: 900; }
.phase-copy h3 { font-size: 29px; line-height: 1.05; letter-spacing: -.045em; margin: 10px 0 10px; }
.phase-copy p { color: var(--ink-soft); line-height: 1.55; font-size: 13px; }
.routine-clock { font-size: 52px; letter-spacing: -.08em; font-weight: 900; margin: 18px 0 10px; }
.routine-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.settings-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.field { display: grid; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 800; }
.field input { border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--ink); background: white; }
.empty { padding: 36px; text-align: center; color: var(--ink-soft); background: rgba(255,255,255,.6); border: 1px dashed var(--line); border-radius: 18px; }
.footer-note { color: var(--ink-soft); font-size: 11px; line-height: 1.55; margin-top: 28px; }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(14,33,37,.56); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(5px); }
.modal { width: min(720px, 100%); max-height: min(850px, 94vh); overflow: auto; border-radius: 25px; background: var(--card); box-shadow: 0 26px 70px rgba(0,0,0,.25); }
.modal-top { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 22px 24px 0; }
.modal-top h3 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.close { border: 0; background: #f2f3ee; color: var(--ink); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; }
.modal img { width: calc(100% - 48px); height: 220px; object-fit: cover; margin: 16px 24px 0; border-radius: 17px; background: #dceae2; }
.modal-copy { padding: 0 24px 24px; }
.modal-copy .dose-big { font-size: 26px; font-weight: 900; color: var(--teal); margin: 16px 0 5px; letter-spacing: -.04em; }
.modal-copy p { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.steps { padding-left: 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.steps li { margin: 6px 0; }
.timer-box { background: #edf7f0; border-radius: 15px; padding: 16px; margin: 18px 0; text-align: center; }
.timer-box strong { font-size: 45px; letter-spacing: -.08em; }
.timer-box p { margin: 2px 0 0; font-size: 11px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.modal-actions .button { flex: 1; min-width: 130px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 40; max-width: 340px; background: var(--ink); color: white; padding: 14px 16px; border-radius: 13px; box-shadow: var(--shadow); font-size: 12px; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-image { min-height: 260px; order: -1; }
  .hero-copy { padding-top: 30px; }
  .dashboard-grid, .phase-card { grid-template-columns: 1fr; }
  .phase-card img { min-height: 220px; max-height: 280px; }
  .exercise-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 570px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { padding-top: max(16px, env(safe-area-inset-top)); }
  .status { display: none; }
  .hero { border-radius: 22px; }
  .hero h2 { font-size: 38px; }
  .hero-image { min-height: 210px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .exercise-grid { grid-template-columns: 1fr; }
  .exercise-card img { height: 190px; }
  .routine-head { display: block; }
  .routine-head .button { margin-top: 14px; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 20px; }
  .modal img { height: 180px; }
}
