/* Squad Status · estilo oscuro con acento rojo (ver "Estilo visual" en el documento de desarrollo) */
:root {
  --bg: #16181C; --bg-deep: #0E0F12; --card: #22252B; --card-2: #2C3037; --line: #3A3F47; --rule: #30343B;
  --text: #F4F4F5; --muted: #A9AFB8; --muted-2: #C4C8CF;
  --red: #E1251B; --red-tint: #3A1D1D; --red-text: #FFB4AE; --logo: #FF0000;
  --ok-bg: #15392A; --ok: #7BE8B1; --warn-bg: #3D3014; --warn: #FFD978; --alert-bg: #3F1220; --alert: #FF7A90; --alert-line: #FF4D6D;
  --fem-bg: #2D2340; --fem: #B48CF0; --fem-text: #D9C6FA; --grey-bg: #30343B;
  --radius: 16px; --gutter: 16px;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 "Barlow", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
a { color: #FF6F61; } a:hover { color: #FF9A90; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.boot { padding: 48px var(--gutter); color: var(--muted); }
.cond { font-family: var(--cond); text-transform: uppercase; letter-spacing: .01em; }
.title { font-family: var(--cond); text-transform: uppercase; font-size: 30px; line-height: 1.1; font-weight: 700; }
.title em, .accent { color: var(--red); font-style: normal; }
.muted { color: var(--muted); } .small { font-size: 14px; } .tiny { font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; } .stack-lg { display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Estructura: menú lateral en compu, barra abajo en celular */
.shell { min-height: 100dvh; display: flex; }
.side { width: 240px; flex-shrink: 0; background: linear-gradient(165deg, var(--bg-deep) 0 78%, var(--red) 78% 81%, var(--bg-deep) 81% 84%, var(--red) 84% 87%, var(--bg-deep) 87%); padding: 24px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--cond); text-transform: uppercase; font-size: 24px; font-weight: 700; padding: 0 10px; }
.brand-by { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--muted); padding: 0 10px 12px; }
.navlink { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--muted-2); text-decoration: none; }
.navlink:hover { color: var(--text); background: rgba(255,255,255,.04); }
.navlink[aria-current="page"] { background: var(--card-2); color: #fff; font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; max-width: 1200px; }
.tabbar { display: none; }
.topbar { display: none; }
@media (max-width: 899px) {
  .side { display: none; }
  .main { padding: 12px var(--gutter) calc(88px + env(safe-area-inset-bottom)); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 6px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 4px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
  .tabbar a { min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--red); font-weight: 700; }
  .shell { display: block; }
}
.player .main { max-width: 560px; margin: 0 auto; }

/* Tarjetas y piezas */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; }
.card-2 { background: var(--card-2); border-radius: 14px; padding: 14px; }
.card h2 { font-size: 18px; }
.hero { background: linear-gradient(115deg, var(--bg-deep) 0 60%, var(--red) 60% 67%, var(--bg-deep) 67% 73%, var(--red) 73% 80%, var(--bg-deep) 80%); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.kpi { background: var(--card); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-family: var(--cond); font-size: 32px; line-height: 1.05; }
.kpi.alert { background: var(--alert-bg); color: var(--alert); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.tile b { font-family: var(--cond); font-size: 30px; line-height: 1; }
.tile span { font-size: 13px; font-weight: 600; }
.t-green { background: var(--ok-bg); color: var(--ok); } .t-amber { background: var(--warn-bg); color: var(--warn); }
.t-red { background: var(--alert-bg); color: var(--alert); } .t-grey { background: var(--grey-bg); color: var(--muted-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.tag { display: inline-flex; padding: 1px 7px; border-radius: 6px; border: 1px solid currentColor; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.tag-Lesionado { color: var(--alert); } .tag-Diferenciado { color: var(--warn); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); text-decoration: none; color: inherit; }
.list-row:first-child { border-top: 0; }
.fem { background: var(--fem-bg); color: var(--fem-text); }

/* Botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { border: 0; background: var(--red); color: #fff; font-weight: 700; border-radius: 4px; padding-right: 30px; clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); }
.btn-primary:hover { background: #F0362C; }
.btn-big { min-height: 56px; font-size: 18px; width: 100%; }
.btn-link { display: inline-flex; align-items: center; background: none; border: 0; color: #FF6F61; font-weight: 600; min-height: 44px; padding: 0 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { color: var(--alert); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.input, select.input { min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid #4A4F57; background: var(--card); width: 100%; }
.input:focus, .btn:focus-visible, .chip:focus-visible, .scale:focus-visible { outline: 2px solid var(--red-text); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; }
.chip[aria-pressed="true"] { border: 2px solid var(--red); background: var(--red); color: #fff; font-weight: 700; }
.chip.pain[aria-pressed="true"] { border-color: var(--alert-line); background: var(--alert-bg); color: var(--alert); }
.chip.fem[aria-pressed="true"] { border-color: var(--fem); background: var(--fem); color: #1d1430; }
.seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); font-family: var(--cond); font-size: 22px; font-weight: 700; cursor: pointer; }
.scale[aria-pressed="true"] { border: 2px solid var(--red); background: var(--red); color: #fff; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); font-size: 24px; cursor: pointer; }
.stepper b { font-family: var(--cond); font-size: 40px; min-width: 76px; text-align: center; }
.rpe-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 54px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); text-align: left; cursor: pointer; }
.rpe-row[aria-pressed="true"] { border: 2px solid var(--red); background: var(--card-2); }
.rpe-num { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--cond); font-size: 22px; font-weight: 700; color: #fff; flex-shrink: 0; }

/* Tablas */
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-size: 12px; letter-spacing: .05em; font-weight: 600; padding: 8px; white-space: nowrap; }
td { padding: 10px 8px; border-top: 1px solid var(--rule); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(255,255,255,.03); }

/* Avisos y diálogos */
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); z-index: 20; }
#toast.show { opacity: 1; }
.notice { border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.notice.info { background: var(--red-tint); color: #F1D4D2; }
.notice.ok { background: var(--ok-bg); color: #CDEFDC; }
.notice.err { background: var(--alert-bg); color: var(--alert); }
dialog { border: 0; border-radius: 18px; background: var(--card); color: var(--text); padding: 20px; width: min(480px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.codebox { font-family: var(--cond); font-size: 30px; letter-spacing: .06em; background: var(--card-2); border-radius: 12px; padding: 10px 14px; text-align: center; user-select: all; }
.welcome { max-width: 460px; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) var(--gutter) 40px; display: flex; flex-direction: column; gap: 20px; }
svg text { font-family: "Barlow", sans-serif; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
