@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-latin-800-normal-BKzMuPgK.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans-latin-400-normal-CW0RaeGs.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('/fonts/dm-sans-latin-700-normal-DvUfVpUG.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --navy: #0f2942;
  --teal: #0d9488;
  --teal-soft: #ccfbf1;
  --text: #0f172a;
  --muted: #475569;
  --hot: #ea580c;
  --hot-soft: #ffedd5;
  --ok-bg: #ecfdf5;
  --ok-border: #86efac;
  --ok-text: #15803d;
  --warn-bg: #fffbeb;
  --warn-border: #fcd34d;
  --warn-text: #b45309;
  --red-bg: #fef2f2;
  --red-border: #fca5a5;
  --red-text: #b91c1c;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.48;
}

h1, h2, h3 {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  color: var(--navy);
  letter-spacing: 0.01em;
  margin: 0 0 0.45rem;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem;
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--navy);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.badge.verde, .badge.normal, .badge.Completado, .badge.Remisión {
  background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text);
}
.badge.amarillo, .badge.bajo, .badge.Pendiente, .badge.Mejoría {
  background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text);
}
.badge.rojo, .badge.alto, .badge.Inasistencia, .badge.Activa {
  background: var(--red-bg); border-color: var(--red-border); color: var(--red-text);
}

.main { padding: 1.25rem 0 5.5rem; display: grid; gap: 1rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.15rem;
  box-shadow: var(--shadow);
}

.panel.clinical-accent {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border-color: #99f6e4;
}

.hero {
  position: relative;
  min-height: 210px;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  padding: 1.4rem;
  background: var(--navy);
  color: #ffffff;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
}

.hero-content { position: relative; z-index: 1; max-width: 660px; }
.hero-content h1 { color: #ffffff; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.hero-content p { color: #e2e8f0; margin: 0.35rem 0 0; }

.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-5 { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.85rem;
}

.stat-card small { color: var(--muted); display: block; font-size: 0.8rem; font-weight: 700; }
.stat-card strong { font-size: 1.85rem; color: var(--navy); font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--navy);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover:not(:disabled) { background: #f1f5f9; border-color: var(--teal); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) { background: #1e3a5f; border-color: #1e3a5f; }

.btn-teal {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}
.btn-teal:hover:not(:disabled) { background: #0f766e; border-color: #0f766e; }

.btn-hot {
  background: var(--hot);
  border-color: var(--hot);
  color: #ffffff;
}
.btn-hot:hover:not(:disabled) { background: #c2410c; border-color: #c2410c; }

.btn-danger {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

.btn-sm { min-height: 32px; padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.row { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #99f6e4;
  border-color: var(--teal);
}

label { display: grid; gap: 0.28rem; font-size: 0.84rem; font-weight: 700; color: var(--muted); }
form { display: grid; gap: 0.75rem; }

.progress-bar {
  height: 9px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 0.45rem 0;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #14b8a6);
  transition: width 0.25s ease;
}

.exercise-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.exercise-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.exercise-photos img {
  width: 100%;
  height: 145px;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.clock {
  font-size: clamp(2.4rem, 7vw, 3.1rem);
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  margin: 0.2rem 0;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
  margin-bottom: 0.85rem;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
}

.bottom-nav button {
  flex: 1;
  max-width: 145px;
  min-height: 44px;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.bottom-nav button.active {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: var(--teal);
}

.toast {
  position: fixed;
  top: 74px;
  right: 1rem;
  z-index: 50;
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
  padding: 0.65rem 1rem;
  border-radius: 0.65rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.toast.err {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

.muted { color: var(--muted); }

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: var(--navy);
  color: #cbd5e1;
  font-size: 0.78rem;
  border-top: 1px solid #1e3a5f;
  padding: 0.45rem 1rem;
}

.app-footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.has-bottom-nav .bottom-nav {
  bottom: 32px;
}

.has-bottom-nav .main {
  padding-bottom: 6.8rem;
}

.hero-role-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media print {
  .app-header, .bottom-nav, .app-footer, .no-print, button, select, form { display: none !important; }
  body { background: #ffffff; }
  .panel { box-shadow: none; border: 1px solid #cbd5e1; break-inside: avoid; }
}
