/* ==========================================================
   Fisioterapia de Precisión · Telerehab
   Sistema visual: petróleo profundo + teal de precisión + coral de acción
   ========================================================== */
:root {
  --ink: #1f2d36;
  --ink-2: #2a3d49;
  --ink-3: #36505f;
  --brand: #3f6a80;
  --brand-2: #8fadbf;
  --brand-soft: #e8eff3;
  --accent: #b48a36;
  --gold: #c2a25a;
  --accent-soft: #f6efdf;
  --amber: #f0a020;
  --amber-soft: #fff4dd;
  --ok: #1f9d68;
  --ok-soft: #e1f5ec;
  --danger: #dc4438;
  --danger-soft: #fde8e6;
  --violet: #6b5bd2;
  --violet-soft: #eeebfc;
  --bg: #f2f5f7;
  --card: #ffffff;
  --line: #e2e8ee;
  --line-2: #d3dce4;
  --text: #10222f;
  --muted: #5b6e7e;
  --muted-2: #8a9aa7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 31, 38, .05), 0 6px 24px -10px rgba(20, 31, 38, .14);
  --shadow-lg: 0 24px 60px -20px rgba(20, 31, 38, .35);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --num: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
  --side: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* ───────── Botones ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font: 600 14px var(--font); cursor: pointer; transition: transform .08s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(63, 106, 128, .8); }
.btn.primary:hover { background: #335a6d; color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px -8px rgba(180, 138, 54, .9); }
.btn.accent:hover { background: #9c7629; color: #fff; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--ink-2); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ───────── Formularios ───────── */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
input, select, textarea { font: 500 15px var(--font); color: var(--text); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); }
input[type=range] { padding: 0; border: 0; accent-color: var(--brand); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(95, 125, 143, .15); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; }
legend { font-weight: 800; padding: 0 6px; font-size: 14px; }
.seg { display: inline-flex; background: #e9eef2; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; font: 600 13px var(--font); color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ───────── Alertas, chips ───────── */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.alert.danger { background: var(--danger-soft); color: #9e2a22; border-color: #f6c4bf; }
.alert.info { background: var(--brand-soft); color: #2f5163; border-color: #cddbe3; }
.alert.warn { background: var(--amber-soft); color: #8a5a00; border-color: #f4dba6; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef2f5; color: var(--muted); white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: #345a6c; }
.chip.ok { background: var(--ok-soft); color: #127049; }
.chip.warn { background: var(--amber-soft); color: #8d5a00; }
.chip.danger { background: var(--danger-soft); color: #a8291f; }
.chip.violet { background: var(--violet-soft); color: #4b3cae; }
.chip.accent { background: var(--accent-soft); color: #87661f; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ───────── Auth ───────── */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 110% -10%, rgba(95, 125, 143, .22), transparent 60%),
  radial-gradient(900px 600px at -10% 110%, rgba(180, 138, 54, .14), transparent 60%), var(--bg); }
.auth-shell { width: min(980px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; background: var(--card); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-art { background: var(--ink); color: #dce9ef; padding: 40px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 560px; }
.auth-art h2 { color: #fff; font-size: 30px; line-height: 1.15; max-width: 380px; }
.auth-art .lead { color: #a9c3cf; max-width: 360px; }
.auth-art .pts { display: flex; flex-direction: column; gap: 10px; font-size: 14px; position: relative; z-index: 1; }
.auth-art .pts span { display: flex; align-items: center; gap: 10px; }
.auth-art .pts i { width: 26px; height: 26px; border-radius: 8px; background: rgba(95, 125, 143, .18); display: grid; place-items: center; color: var(--brand-2); font-style: normal; font-weight: 800; }
.auth-art svg.reticle { position: absolute; right: -120px; bottom: -120px; width: 420px; opacity: .55; }
.auth-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-card { width: min(440px, 100%); background: var(--card); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 34px; }
.auth-card.wide { width: min(760px, 100%); }
.auth-logo { height: 46px; margin-bottom: 26px; }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } .auth-art { min-height: 0; padding: 28px; } .auth-art .pts { display: none; } .auth-form { padding: 28px; } }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button { border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: 4px 9px; font: 700 12px var(--font); color: var(--muted); cursor: pointer; }
.lang-switch button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ───────── Shell profesional ───────── */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #c9dbe3; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.side .brand { display: block; padding: 4px 8px 18px; }
.side .brand img { width: 100%; max-width: 210px; }
.side .inst { margin: 0 6px 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); font-size: 13px; }
.side .inst b { color: #fff; display: block; font-size: 14px; }
.nav-sec { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #6f8fa0; margin: 14px 12px 4px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9dbe3; font-weight: 600; font-size: 14px; text-decoration: none; }
.nav a svg { width: 19px; height: 19px; opacity: .8; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: linear-gradient(90deg, rgba(95, 125, 143, .22), rgba(95, 125, 143, .06)); color: #fff; box-shadow: inset 3px 0 0 var(--brand-2); }
.nav a .badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 800; }
.side .me { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); display: flex; gap: 10px; align-items: center; font-size: 13px; }
.side .me b { color: #fff; display: block; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: var(--brand); flex: none; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }
.avatar.xl { width: 72px; height: 72px; border-radius: 20px; font-size: 26px; }
.main { min-width: 0; padding: 26px 32px 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.topbar .sub { color: var(--muted); font-size: 14px; }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.burger { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .main { padding: 16px 16px 90px; }
  .burger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(20, 31, 38, .45); z-index: 55; }
}

/* ───────── Tarjetas ───────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.pad0 { padding: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-h h3 { margin: 0; }
.card-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.kpi { position: relative; overflow: hidden; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .val { font: 700 34px/1.1 var(--num); margin: 6px 0 2px; letter-spacing: -.02em; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi .ic { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.kpi .ic svg { width: 20px; height: 20px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty svg { width: 46px; height: 46px; color: var(--line-2); margin-bottom: 8px; }

/* ───────── Tablas ───────── */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafcfd; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f7fbfb; }
.who { display: flex; align-items: center; gap: 12px; }
.who b { display: block; }
.who .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 13px; }
.bar { height: 8px; border-radius: 99px; background: #e8eef2; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.bar.warn > i { background: var(--amber); }
.bar.danger > i { background: var(--danger); }
.bar.ok > i { background: var(--ok); }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .num { width: 40px; text-align: right; font-weight: 700; }

/* ───────── Tabs ───────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; font: 700 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--brand); }
.tabs button:hover { color: var(--ink); }

/* ───────── Ficha paciente ───────── */
.pat-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pat-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pat-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .pat-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

/* ───────── Actividades ───────── */
.act-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.act-ic svg { width: 24px; height: 24px; }
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-row { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.plan-row .handle { cursor: grab; color: var(--muted-2); }
.plan-row.drag { opacity: .5; }
.plan-row .info { flex: 1; min-width: 0; }
.plan-row .info b { display: block; }
.plan-row .params { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.plan-row .wk { text-align: center; min-width: 74px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.lib-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.lib-card:hover { border-color: var(--brand-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.lib-card .ttl { display: flex; gap: 12px; align-items: center; }
.lib-card p { font-size: 13px; color: var(--muted); margin: 0; flex: 1; }
.lib-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-card.pick { cursor: pointer; }
.lib-card.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(95, 125, 143, .2); }

/* ───────── Sesiones ───────── */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.ses { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.ses.flag { border-color: #f3b2ab; }
.ses-h { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; }
.ses-h .date { font: 600 13px var(--num); color: var(--muted); width: 92px; }
.ses-h .date b { display: block; color: var(--text); font-size: 15px; }
.ses-b { border-top: 1px solid var(--line); padding: 12px 14px; background: #fbfcfd; display: none; }
.ses.open .ses-b { display: block; }
.res-row { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.res-row:last-child { border-bottom: 0; }
.res-row .act-ic { width: 34px; height: 34px; border-radius: 10px; }
.res-row .act-ic svg { width: 18px; height: 18px; }
.metrics { display: flex; gap: 6px; flex-wrap: wrap; }
.donut { width: 44px; height: 44px; flex: none; }

/* ───────── Gráficos ───────── */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 600 11px var(--num); fill: var(--muted-2); }
.chart .grid line { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 99; background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; box-shadow: var(--shadow-lg); white-space: nowrap; }

/* ───────── Modal y toast ───────── */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 31, 38, .5); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 18px; animation: fade .15s; }
.modal { background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 36px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.lg { width: min(860px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; }
.modal-h .x { margin-left: auto; }
.modal-b { padding: 20px 22px; overflow-y: auto; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0 } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: pop .2s; }
.toast.err { background: var(--danger); }
.cred { background: var(--ink); color: #fff; border-radius: 14px; padding: 16px 18px; font-family: var(--num); }
.cred div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.cred span { color: #8fb0be; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.loading { display: grid; place-items: center; padding: 60px; }

/* ───────── Comparación postural ───────── */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.compare figure { margin: 0; background: #1f2d36; border-radius: 12px; overflow: hidden; position: relative; }
.compare img { width: 100%; display: block; }
.compare figcaption { position: absolute; left: 10px; top: 10px; background: rgba(20, 31, 38, .75); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.delta-up { color: var(--ok); font-weight: 800; }
.delta-down { color: var(--danger); font-weight: 800; }

/* ───────── Portal del paciente ───────── */
body.portal { background: var(--bg); }
.p-top { background: var(--ink); color: #fff; padding: 18px 18px 70px; border-radius: 0 0 28px 28px; position: relative; overflow: hidden; }
.p-top .inner { max-width: 760px; margin: 0 auto; }
.p-top svg.reticle { position: absolute; right: -80px; top: -60px; width: 260px; opacity: .35; }
.p-top .bar1 { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.p-top .bar1 img { height: 34px; }
.p-top h1 { color: #fff; margin-top: 22px; font-size: 26px; position: relative; }
.p-top .sub { color: #a9c3cf; position: relative; }
.p-wrap { max-width: 760px; margin: -50px auto 0; padding: 0 16px 110px; position: relative; display: flex; flex-direction: column; gap: 16px; }
.p-hero { display: flex; align-items: center; gap: 18px; }
.ring { width: 96px; height: 96px; flex: none; }
.p-item { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.p-item.done { background: #f6fbf9; }
.p-item .info { flex: 1; min-width: 0; }
.p-item .info b { display: block; font-size: 15px; }
.p-item .check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: #fff; flex: none; }
.p-item.done .check { background: var(--ok); border-color: var(--ok); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.week .d { aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center; background: #eef2f5; font: 700 14px var(--num); color: var(--muted); }
.week .d.on { background: var(--brand); color: #fff; }
.week .d.today { outline: 2px solid var(--accent); outline-offset: 2px; }
.p-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.p-nav .in { display: flex; width: min(760px, 100%); }
.p-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 12px; font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; }
.p-nav a svg { width: 22px; height: 22px; }
.p-nav a.on { color: var(--brand); }
.pain-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.pain-scale button { aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; font: 800 15px var(--num); cursor: pointer; color: #fff; }
.pain-scale button.on { border-color: var(--ink); transform: scale(1.08); box-shadow: var(--shadow); }
.pain-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }

/* ───────── Pantalla de juego ───────── */
body.play { background: #141f26; color: #e8f2f6; overflow: hidden; height: 100vh; height: 100dvh; }
.stage { position: fixed; inset: 0; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); opacity: .0; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); z-index: 5; background: linear-gradient(180deg, rgba(18, 28, 34, .85), transparent); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .t { font-weight: 800; font-size: 16px; }
.hud .t small { display: block; color: #8fb0be; font-weight: 600; font-size: 12px; }
.hud .stats { margin-left: auto; display: flex; gap: 8px; }
.pill { background: rgba(255, 255, 255, .1); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 6px 12px; text-align: center; min-width: 64px; }
.pill b { display: block; font: 700 20px/1.1 var(--num); color: #fff; }
.pill span { font-size: 11px; color: #9dbac6; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hbtn { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); color: #fff; height: 40px; min-width: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; font: 700 14px var(--font); padding: 0 12px; }
.hbtn svg { width: 20px; height: 20px; }
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(18, 28, 34, .78); backdrop-filter: blur(6px); }
.ov-card { width: min(520px, 100%); background: #22333d; border: 1px solid rgba(255, 255, 255, .1); border-radius: 22px; padding: 26px; box-shadow: var(--shadow-lg); text-align: center; color: #e8f2f6; max-height: calc(100dvh - 40px); overflow-y: auto; }
.ov-card h2 { color: #fff; font-size: 24px; }
.ov-card p { color: #a9c3cf; }
.ov-card .btn { border-color: rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .08); color: #fff; }
.ov-card .btn.primary { background: var(--brand); border-color: var(--brand); }
.ov-card .btn.accent { background: var(--accent); border-color: var(--accent); }
.ov-card .pain-ends { color: #8fb0be; }
.ov-card .pain-scale button.on { border-color: #fff; }
.big-num { font: 700 64px/1 var(--num); color: #fff; }
.countdown { position: fixed; inset: 0; display: grid; place-items: center; z-index: 8; pointer-events: none; font: 700 160px var(--num); color: #fff; text-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.prog { position: fixed; left: 16px; right: 16px; bottom: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 6px; }
.prog i { flex: 1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .15); }
.prog i.on { background: var(--brand-2); }
.prog i.cur { background: var(--accent); }
.res-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; text-align: left; }
.res-grid div { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 10px 12px; }
.res-grid b { display: block; font: 700 22px var(--num); color: #fff; }
.res-grid span { font-size: 12px; color: #9dbac6; font-weight: 600; }
.cam-hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: 40px; z-index: 6; background: rgba(180, 138, 54, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; text-align: center; max-width: 90%; }
.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 700px) { .rotate-hint.need { display: block; position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 6; background: rgba(255, 255, 255, .12); padding: 8px 14px; border-radius: 10px; font-size: 13px; } }

@media print {
  .side, .topbar .actions, .tabs, .btn, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* Tipografía de marca (igual que el logo) */
h1, h2, .brand-font, .kpi .val, .auth-art h2, .p-top h1, .ov-card h2 { font-family: 'Montserrat', var(--font); }
h1, h2 { font-weight: 700; letter-spacing: -.015em; }
.gold { color: var(--gold); }
/* Tamaño por defecto de los íconos de línea (los componentes lo sobrescriben) */
svg:where([viewBox="0 0 24 24"]) { width: 20px; height: 20px; flex: none; }
.chip svg:where([viewBox="0 0 24 24"]) { width: 13px; height: 13px; }
.who > svg { color: var(--muted-2); }
#dg, #sg { align-items: start; }
.pain-scale button { min-width: 0; padding: 0; font-size: clamp(11px, 3.4vw, 15px); border-radius: 8px; }
.p-top .lang-switch button { background: transparent; color: #c9d3da; border-color: rgba(255, 255, 255, .25); }
.p-top .lang-switch button.on { background: #fff; color: var(--ink); border-color: #fff; }
@media (max-width: 720px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 26px; }
  .kpi .ic { width: 30px; height: 30px; right: 10px; top: 10px; border-radius: 9px; }
  .topbar h1 { font-size: 22px; }
}
