:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5e8;
  --panel: #ffffff;
  --accent: #16766d;
  --accent-dark: #115b54;
  --soft: #eaf5f2;
  --danger: #a01d46;
  --danger-soft: #fff0f3;
  --gold: #d99b2b;
  --shadow: 0 2px 12px rgba(29, 29, 31, .035);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button { border: 0; }
.app-shell { max-width: 1320px; margin: 0 auto; }

.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 18px; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); }
.brand h1, .topbar h2, .section-title h3, .panel-heading h3 { margin: 0; }
.brand h1 { font-size: clamp(23px, 6vw, 31px); line-height: 1.1; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.app-header .eyebrow { color: var(--muted); }
.storage-warning { margin: 12px 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 720; line-height: 1.45; }
.demo-switch { position: relative; }
.demo-switch > summary { min-height: 44px; display: flex; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 700; list-style: none; }
.demo-switch > summary::-webkit-details-marker { display: none; }
.demo-switch[open] > summary { background: var(--bg); }
.role-switch { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 190px; display: grid; gap: 6px; padding: 8px; border-radius: 12px; background: #fff; box-shadow: 0 14px 35px rgba(0,0,0,.22); }
.role-switch button { min-height: 44px; padding: 8px 12px; border-radius: 8px; background: #f4f7f4; color: var(--ink); font-weight: 800; text-align: left; }
.role-switch button.active { background: var(--soft); color: var(--accent-dark); }
.role-switch .role-reset { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; background: #fff; color: var(--muted); font-size: 12px; }

.workspace { display: grid; gap: 18px; padding: 24px 16px 48px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.topbar h2 { font-size: clamp(25px, 7vw, 32px); }
.top-actions { display: flex; gap: 8px; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.compact-panel { padding: 13px 16px; }
.compact-panel summary { color: var(--accent-dark); font-weight: 800; }
.compact-panel[open] summary { margin-bottom: 12px; }
.student-layout, .coach-view, .coach-panel { display: grid; gap: 16px; align-items: start; }
.hidden { display: none !important; }
.home-view { display: grid; gap: 16px; max-width: 930px; padding-top: 16px; }
.home-summary { margin: 0 0 4px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 12px; }
.home-card { display: grid; gap: 8px; min-height: 146px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--ink); text-align: left; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.home-card:hover { border-color: #a9cbc3; transform: translateY(-2px); }
.home-card span { color: var(--accent); font-size: 12px; font-weight: 800; }
.home-card strong { font-size: 21px; letter-spacing: -.02em; }
.home-card small { color: var(--muted); font-size: 13px; }
.student-menu { display: flex; gap: 8px; }
.tab-button { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-weight: 700; }
.tab-button.active { border-color: var(--accent); background: var(--soft); color: var(--accent-dark); }
.booking-panel, .workout-panel { width: 100%; max-width: 900px; }
.section-title { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.section-title h3, .panel-heading h3 { font-size: 20px; line-height: 1.25; }
.helper-text, .panel-heading > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.panel-heading { display: grid; gap: 9px; }
.panel-heading > p { margin: 0; }

.primary, .secondary, .ghost, .remove { min-height: 48px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; font-weight: 700; line-height: 1.2; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { border-color: var(--line); background: #fff; color: var(--accent-dark); }
.ghost { border-color: var(--line); background: #fff; color: var(--muted); }
.remove { background: var(--danger-soft); color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .5; }
.compact-button { min-height: 40px; padding: 8px 11px; }
.small-button { min-height: 40px; padding: 7px 10px; font-size: 13px; }
.wide-button { width: 100%; margin-top: 14px; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
select, input, textarea { width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid #d3d3d7; border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 78px; resize: vertical; }
input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--accent); }
:focus-visible { outline: 3px solid #e0a842; outline-offset: 2px; }
.form-grid { display: grid; gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions > button { flex: 1 1 130px; }
.form-message { margin: 13px 0 0; padding: 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 720; line-height: 1.45; }
.form-message.success { background: var(--soft); color: var(--accent-dark); }
.routine-status { min-height: 20px; margin: 12px 0 0; color: var(--accent-dark); font-size: 14px; font-weight: 720; line-height: 1.45; }
.empty { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Selector de día y reservas del alumno */
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 9px; border-radius: 999px; background: var(--soft); color: var(--accent-dark); font-size: 12px; font-weight: 820; white-space: nowrap; }
.status-pill.danger { background: var(--danger-soft); color: var(--danger); }
.date-picker { display: flex; gap: 8px; margin: 0 -2px 16px; padding: 2px 2px 10px; overflow-x: auto; scrollbar-width: thin; }
.date-chip { flex: 0 0 76px; min-height: 68px; display: grid; place-content: center; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfb; color: var(--muted); text-align: center; }
.date-chip span { font-size: 11px; font-weight: 820; text-transform: uppercase; }
.date-chip strong { color: var(--ink); font-size: 14px; }
.date-chip.active { border-color: var(--accent); background: var(--soft); color: var(--accent-dark); box-shadow: 0 0 0 2px rgba(14,117,103,.1); }
.day-selection { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; margin-bottom: 12px; }
.day-selection h4 { margin: 0; font-size: 16px; }
.day-selection span { color: var(--muted); font-size: 12px; font-weight: 700; }
.time-list { display: grid; gap: 10px; }
.time-row { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; }
.time-row.reserved { border-color: #9bcbbd; background: var(--soft); }
.time-row > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.time-row > div:first-child strong { font-size: 23px; }
.time-row > div:first-child span { color: var(--muted); font-size: 13px; font-weight: 700; }
.time-actions { display: grid; grid-template-columns: 1fr; gap: 7px; }
.reserved-label { align-self: center; color: var(--accent-dark); font-size: 13px; font-weight: 820; }

/* Rutina del alumno */
.routine-list, .routine-editor, .student-list, .history-list { display: grid; gap: 10px; }
.session-picker { display: grid; gap: 8px; margin-bottom: 8px; }
.session-choice { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); text-align: left; }
.session-choice.active { border-color: var(--accent); background: var(--soft); }
.session-choice span { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.session-choice.active span { color: var(--accent-dark); }
.session-order-summary { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.exercise-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfb; }
.exercise-card.done { border-color: #9bcbbd; background: var(--soft); }
.exercise-card > img { width: 100%; max-height: 220px; border-radius: 10px; object-fit: cover; }
.exercise-check { grid-template-columns: auto 1fr; align-items: center; gap: 11px; }
.exercise-check strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 16px; }
.exercise-check small { color: var(--muted); font-size: 13px; }
.exercise-card > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.youtube-link { display: inline-flex; align-items: center; width: fit-content; min-height: 44px; padding: 8px 12px; border: 1px solid #d4dce5; border-radius: 9px; background: #fff; color: #134f80; font-size: 13px; font-weight: 750; text-decoration: none; }
.youtube-link:hover, .youtube-link:focus-visible { text-decoration: underline; border-color: #134f80; }

/* Menú y agenda del profesor */
.coach-menu { display: grid; gap: 8px; }
.menu-card { min-height: 58px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); color: var(--ink); text-align: left; }
.menu-card strong, .menu-card small { display: block; }
.menu-card strong { margin-bottom: 4px; font-size: 16px; }
.menu-card small { color: var(--muted); font-size: 12px; font-weight: 620; }
.menu-icon { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: var(--bg); color: var(--muted); font-size: 11px; font-weight: 800; }
.menu-card.active { border-color: var(--accent); background: var(--soft); }
.menu-card.active .menu-icon { background: var(--accent); color: #fff; }
.tool-box { padding: 0; overflow: hidden; }
.tool-box > summary { min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; list-style: none; }
.tool-box > summary::-webkit-details-marker { display: none; }
.tool-box > summary::after { content: "+"; color: var(--accent); font-size: 26px; font-weight: 500; }
.tool-box[open] > summary::after { content: "−"; }
.tool-box[open] > summary { border-bottom: 1px solid var(--line); background: #fbfdfb; }
.tool-box summary strong, .tool-box summary small { display: block; }
.tool-box summary small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 620; }
.tool-content { display: grid; gap: 14px; padding: 18px; }
.weekday-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.weekday-picker legend { width: 100%; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 750; }
.weekday-picker label { grid-template-columns: auto auto; align-items: center; gap: 5px; min-height: 42px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fafcfb; color: var(--ink); }
.agenda-grid, .profile-grid { display: grid; gap: 16px; align-items: start; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.segmented-control { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg); }
.segmented-control button { min-height: 38px; padding: 7px 14px; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; }
.segmented-control button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.week-navigation { display: flex; align-items: center; gap: 8px; }
.week-navigation strong { min-width: 105px; font-size: 13px; text-align: center; }
.week-navigation button { min-width: 40px; font-size: 22px; }
.week-grid { display: grid; gap: 8px; }
.week-day { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.week-day-heading { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.week-day-heading span, .week-empty { color: var(--muted); font-size: 12px; }
.week-day-slots { display: grid; gap: 6px; }
.week-slot { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); text-align: left; }
.week-slot.selected { border-color: var(--accent); background: var(--soft); }
.week-slot span { color: var(--muted); font-size: 11px; }
.slot-grid, .calendar-days { display: grid; gap: 12px; }
.calendar-days { gap: 22px; }
.calendar-day { display: grid; gap: 12px; }
.calendar-day + .calendar-day { padding-top: 20px; border-top: 1px solid var(--line); }
.day-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.day-heading h4 { margin: 0; font-size: 16px; }
.day-heading span { color: var(--muted); font-size: 12px; font-weight: 750; }
.slot-card { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfb; }
.slot-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.slot-card.full { border-color: #f1c8d4; background: #fff8fa; }
.slot-main { display: flex; justify-content: space-between; gap: 12px; }
.slot-time { font-size: 24px; font-weight: 850; }
.badge { align-self: start; padding: 5px 9px; border-radius: 999px; background: var(--soft); color: var(--accent-dark); font-size: 12px; font-weight: 850; }
.badge.full { background: #ffe4eb; color: var(--danger); }
.meter { overflow: hidden; height: 7px; border-radius: 999px; background: #e7ece8; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.slot-card.full .meter span { background: var(--danger); }
.coach-availability { margin: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.slot-summary { margin: -4px 0 16px; color: var(--accent-dark); font-size: 14px; font-weight: 750; line-height: 1.5; }
.slot-editor { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.coach-slot-detail, #studentProfile { scroll-margin-top: 14px; }
.coach-slot-detail h4 { margin: 20px 0 10px; font-size: 15px; }
.delete-warning { margin: 15px 0; padding: 14px; border: 1px solid #f1c8d4; border-radius: 12px; background: #fff8fa; }
.delete-warning h4 { margin: 0 0 7px; color: var(--danger); }
.delete-warning p { margin: 0 0 13px; font-size: 14px; line-height: 1.45; }

/* Fichas */
.student-row { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfb; color: var(--muted); text-align: left; }
.student-row strong, .student-row span { display: block; }
.student-row strong { margin-bottom: 4px; color: var(--ink); }
.student-row span { font-size: 13px; }
.student-row.active { border-color: var(--accent); background: var(--soft); }
.directory-list { margin-top: 14px; }
.student-create { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.student-create > summary { min-height: 58px; padding: 12px 14px; }
.student-create .tool-content { padding: 14px; }
.student-create .form-message { margin-top: 0; }
.profile-actions { justify-content: flex-end; }
.profile-actions > button { flex: 0 1 auto; }
.info-grid { display: grid; gap: 9px; }
.info-grid > div { display: grid; gap: 3px; padding: 12px; border-radius: 10px; background: #f6f8f6; }
.info-grid span, .history-row small { color: var(--muted); font-size: 11px; font-weight: 720; }
.info-grid strong { overflow-wrap: anywhere; font-size: 14px; }
.profile-intro { margin-bottom: 12px; }
.profile-alerts { display: grid; gap: 8px; margin-bottom: 12px; }
.profile-alert, .profile-clear { margin: 0; padding: 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.profile-alert { display: grid; gap: 3px; border: 1px solid #f1d9b0; background: #fffaf0; color: #875b14; }
.profile-alert.danger { border-color: #f1c8d4; background: var(--danger-soft); color: var(--danger); }
.profile-clear { border: 1px solid var(--line); background: #fafafa; color: var(--muted); }
.profile-section { margin-top: 8px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.profile-disclosure > summary { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; list-style: none; }
.profile-disclosure > summary::-webkit-details-marker { display: none; }
.profile-disclosure > summary::after { content: "+"; color: var(--accent); font-size: 24px; font-weight: 500; }
.profile-disclosure[open] > summary { border-bottom: 1px solid var(--line); background: #fbfdfb; }
.profile-disclosure[open] > summary::after { content: "−"; }
.profile-disclosure summary strong, .profile-disclosure summary small { display: block; }
.profile-disclosure summary strong { font-size: 15px; }
.profile-disclosure summary small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 620; }
.profile-disclosure-content { padding: 14px 16px 16px; }
.profile-disclosure-content.history-list { padding-top: 14px; }
.plan-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px; border: 1px solid #b4d8cc; border-radius: 12px; background: var(--soft); }
.plan-card span { color: var(--accent-dark); font-size: 13px; }
.plan-form { display: grid; gap: 10px; margin-top: 12px; }
.plan-form > button { justify-self: start; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; font-size: 13px; }
.history-row strong, .history-row small { display: block; }
.history-row small { margin-top: 4px; }

/* Editor de rutinas */
.routine-source-grid { display: grid; gap: 10px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.routine-import { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 13px; }
.routine-import-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.routine-import-actions > * { flex: 1 1 240px; }
.routine-import-preview { margin: 12px 0; padding: 12px 14px; border: 1px solid #b4d8cc; border-radius: 10px; background: var(--soft); font-size: 13px; }
.routine-import-preview p { margin: 4px 0; }
.routine-import-preview ul { margin: 8px 0 0; padding-left: 20px; }
.routine-import-preview li { margin: 3px 0; }
.routine-mode-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.routine-mode-actions button { flex: 1 1 220px; }
.routine-mode-actions button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.routine-mode-actions button[aria-pressed="false"] { background: #fff; border-color: var(--line); color: var(--accent-dark); }
.routine-compare-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.routine-compare-tools > * { flex: 1 1 230px; }
.routine-comparison { display: grid; gap: 18px; }
.routine-comparison > * { min-width: 0; }
.routine-comparison h4 { margin: 0 0 14px; }
.routine-reference { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f6f8f7; max-height: 55vh; overflow-y: auto; }
.reference-session { margin-top: 18px; }
.reference-session h5 { margin: 0 0 10px; font-size: 15px; }
.reference-exercise { padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow-wrap: anywhere; }
.reference-exercise p { margin: 7px 0; font-size: 13px; }
.reference-exercise img { width: 100%; max-height: 130px; object-fit: contain; }
.repeated-exercise { border-color: #ac7418; background: #fffaf0; }
.repeat-badge { display: inline-block; margin: 8px 0; padding: 4px 8px; border-radius: 6px; background: #fff0ca; color: #704600; font-size: 12px; font-weight: 750; }
@media (min-width: 980px) {
  .routine-comparison.has-reference { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; }
  .routine-reference { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}
.session-editor { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.session-editor-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.session-editor-heading .eyebrow { margin: 0; }
.session-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.session-actions .small-button { min-width: 38px; }
.session-exercises { display: grid; gap: 10px; }
.editor-row { display: grid; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfb; }
.exercise-number { color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.editor-actions { display: flex; justify-content: flex-end; }
.file-label input { padding: 8px; }
.media-preview { display: grid; gap: 8px; }
.media-preview img { width: 100%; max-height: 260px; border-radius: 10px; object-fit: contain; background: #edf1ed; }
.routine-actions { align-items: center; margin-top: 14px; }
.autosave-status { margin: 10px 0; color: var(--accent-dark); font-size: 13px; font-weight: 750; }
.autosave-status[data-state="saving"] { color: #8a5d0a; }
.autosave-status[data-state="error"] { color: var(--danger); }
.inline-check { grid-template-columns: auto 1fr; align-items: center; flex: 1 1 230px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfb; color: var(--ink); }
.routine-print-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.routine-print-tools label { flex: 1 1 270px; }
.routine-print-tools button { min-height: 48px; }
.routine-print-sheet { display: none; }

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { margin: 0; min-width: 0; min-height: 0; background: #fff; color: #171717; font: 10pt/1.4 Arial, sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-routine .app-shell { display: none !important; }
  body.printing-routine .routine-print-sheet { display: block !important; }
  .print-header { display: flex; justify-content: space-between; gap: 18mm; padding-bottom: 6mm; border-bottom: 2px solid #16766d; }
  .print-header h1 { margin: 1mm 0 2mm; font-size: 20pt; line-height: 1.15; }
  .print-brand { margin: 0; color: #16766d; font-size: 9pt; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
  .print-meta { min-width: 40mm; text-align: right; font-size: 9pt; }
  .print-meta p { margin: 0 0 1mm; }
  .print-recipient { margin: 5mm 0 2mm; font-size: 11pt; }
  .print-session { margin-top: 7mm; }
  .print-session h2 { margin: 0 0 3mm; padding: 2.5mm 3mm; background: #eaf5f2; color: #115b54; font-size: 12pt; break-after: avoid; }
  .print-exercise { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4mm; padding: 3mm 1mm; border-bottom: 1px solid #d7ddda; break-inside: avoid; page-break-inside: avoid; }
  .print-exercise h3 { margin: 0 0 1mm; font-size: 10pt; }
  .print-exercise p { margin: 1mm 0 0; overflow-wrap: anywhere; }
  .print-exercise img { display: block; width: 24mm; height: 20mm; object-fit: contain; }
  .print-metrics { font-weight: 700; }
  .print-notes { color: #484848; white-space: pre-wrap; }
  .print-video { font-size: 8pt; overflow-wrap: anywhere; }
  .print-footer { margin-top: 8mm; padding-top: 3mm; border-top: 1px solid #bcc9c4; color: #555; font-size: 8pt; }
}

@media (min-width: 560px) {
  .time-row { grid-template-columns: minmax(120px, .6fr) minmax(250px, 1fr); align-items: center; }
  .time-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .routine-source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
}

@media (min-width: 780px) {
  .app-header { padding: 21px 28px; }
  .workspace { padding: 26px 28px 50px; }
  .coach-menu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .student-layout { grid-template-columns: 1fr; }
  .demo-person { grid-column: 1 / -1; }
}

@media (min-width: 980px) {
  .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week-day { padding: 9px; }
  .week-day-heading { display: grid; }
  .week-slot { display: grid; }
  .agenda-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: minmax(290px, .65fr) minmax(0, 1.35fr); }
  .coach-slot-detail { position: static; max-height: none; }
  .routine-workspace { padding: 24px; }
}

@media (max-width: 559px) {
  .app-header { align-items: flex-start; }
  .demo-switch > summary { width: 108px; text-align: center; }
  .topbar .ghost { width: auto; }
  .metric-grid { grid-template-columns: 1fr; }
  .coach-menu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu-card { min-height: 52px; display: grid; grid-template-columns: 1fr; place-items: center; padding: 8px 4px; text-align: center; }
  .menu-card .menu-icon, .menu-card small { display: none; }
  .menu-card strong { margin: 0; font-size: 13px; }
  .section-title > .compact-button { width: 100%; }
  .profile-actions { width: 100%; }
  .profile-actions > button { flex: 1 1 130px; }
}
