/* Match Sur · estilos de la PWA (teléfono primero). Basado en el prototipo aprobado v1 (22 nov 2026). */
:root {
  --ocean: #0B2A3C; --turq: #19C3B1; --cel: #7CCBEF; --bg: #F7FAFA; --ball: #DCF51E; --red: #E5484D;
  --muted: #55707F; --line: #E3ECEE; --soft: #E6EEF0; --input: #CFDDE1; --turq-soft: #E3F8F5; --cel-soft: #E4F4FC;
  --r-s: 12px; --r-m: 18px; --r-pill: 999px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ocean); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ocean); }
img { max-width: 100%; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; padding: 12px 18px calc(96px + var(--safe-b)); }
main.notabs { padding-bottom: 32px; }
h1, h2, h3 { font-style: italic; font-weight: 800; letter-spacing: -.01em; margin: 0; color: inherit; }
h2 { font-size: 24px; line-height: 1.15; margin: 6px 0 14px; }
h3 { font-size: 17px; margin: 20px 0 10px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; }

/* Encabezado */
.top { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.top img.logo { width: 34px; height: 34px; border-radius: 10px; }
.top b { font-style: italic; font-size: 17px; flex: 1; }
.back { background: none; border: 0; padding: 8px 0; min-height: 44px; cursor: pointer; font-size: 15px; color: var(--ocean); }

/* Avatares */
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--cel); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; color: var(--ocean); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 72px; height: 72px; font-size: 24px; }
.av.md { width: 44px; height: 44px; font-size: 15px; }

/* Tarjetas */
.card { background: #fff; border-radius: var(--r-m); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.card.dark { background: var(--ocean); color: #fff; border: 0; }
.card.dark h2, .card.dark h3 { color: #fff; }
.card.warn { background: #FFF8E1; border-color: #F2DE9B; }
.card.tap { cursor: pointer; }

/* Botones */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; border-radius: var(--r-pill); border: 0; background: var(--turq); color: var(--ocean); font-weight: 700; cursor: pointer; margin-top: 10px; text-decoration: none; padding: 0 18px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1.5px solid var(--ocean); }
.btn.dark { background: var(--ocean); color: #fff; }
.btn.wa { background: #25D366; color: #06381B; }
.btn.danger { background: transparent; border: 1.5px solid var(--red); color: #B42318; }
.btn.sm { width: auto; min-height: 40px; padding: 0 14px; margin: 0; font-size: 13px; }
.link { background: none; border: 0; color: var(--ocean); text-decoration: underline; cursor: pointer; min-height: 44px; width: 100%; font-size: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* Segmentos y chips */
.seg { display: flex; background: var(--soft); border-radius: var(--r-pill); padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: var(--r-pill); background: none; font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(11,42,60,.15); }
.seg button:disabled { opacity: .45; cursor: default; }
.card.dark .seg { background: #1F4256; }
.card.dark .seg button { color: #fff; }
.card.dark .seg button.on { background: #fff; color: var(--ocean); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chips.col { flex-direction: column; }
.opt { min-height: 42px; padding: 0 14px; border-radius: var(--r-pill); border: 1.5px solid var(--input); background: #fff; font-size: 14px; cursor: pointer; text-align: left; }
.chips.col .opt { border-radius: var(--r-s); padding: 10px 14px; }
.opt.on { border-color: var(--turq); background: var(--turq-soft); font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; background: var(--turq-soft); color: #0B5E55; }
.tag.cel { background: var(--cel-soft); color: #0B4A6B; }
.tag.dark { background: rgba(255,255,255,.14); color: #fff; }
.tag.red { background: #FDECEC; color: #B42318; }
.tag.yellow { background: #F6FBCF; color: #4B5406; }
.badge { display: inline-grid; place-items: center; min-width: 38px; height: 34px; padding: 0 6px; border-radius: 10px; background: var(--ocean); color: #fff; font-style: italic; font-weight: 800; font-size: 14px; flex: none; }
.badge.turq { background: var(--turq); color: var(--ocean); }

/* Formularios */
.field { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { display: block; width: 100%; margin-top: 6px; min-height: 48px; border: 1px solid var(--input); border-radius: var(--r-s); padding: 0 14px; font-size: 16px; font-weight: 400; background: #fff; }
.field textarea { padding: 10px 14px; min-height: 72px; resize: vertical; }
.field small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
.prefix { display: flex; align-items: center; margin-top: 6px; border: 1px solid var(--input); border-radius: var(--r-s); background: #fff; }
.prefix span { padding: 0 4px 0 14px; color: var(--muted); font-size: 16px; font-weight: 400; }
.prefix input { border: 0; margin: 0; padding-left: 4px; }
.pin { letter-spacing: .6em; text-align: center; font-size: 22px !important; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 6px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--turq); }
.lbl { font-size: 13px; font-weight: 600; margin: 14px 0 4px; }

/* Pasos */
.dots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 16px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--input); }
.dots i.on { background: var(--turq); width: 24px; border-radius: 4px; }
.steplbl { text-align: center; font-size: 12px; color: var(--muted); margin-top: -8px; margin-bottom: 8px; }

/* Bienvenida */
.hero { min-height: 82dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; }
.hero img { width: min(260px, 70vw); }
.hero h1 { font-size: 28px; }
.hero .btns { width: 100%; margin-top: 22px; }

/* Tarjeta de nivel */
.lvl { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.big { width: 92px; height: 92px; border-radius: 24px; background: var(--turq); color: var(--ocean); display: grid; place-items: center; font-size: 40px; font-style: italic; font-weight: 900; flex: none; }
.lvl .t { font-size: 26px; font-style: italic; font-weight: 800; display: block; line-height: 1.1; }
.bar { position: relative; height: 14px; border-radius: 7px; background: rgba(255,255,255,.15); overflow: hidden; margin: 16px 0 6px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--ball); border-radius: 7px; }
.bar s { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(135deg, rgba(229,72,77,.95) 0 4px, rgba(229,72,77,.55) 4px 8px); }
.barlab { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; opacity: .9; }
.barlab em { color: #FF8A8D; font-style: normal; }
.barlab .alert { color: #FFB4B6; font-weight: 700; }

/* Partidos */
.match { display: flex; align-items: center; gap: 12px; }
.match > div { flex: 1; min-width: 0; }
.match b { display: block; font-size: 14px; }
.court { background: #1E7F86; border-radius: var(--r-m); padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; border: 3px solid #fff; outline: 1px solid var(--input); margin: 12px 0; }
.court::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed rgba(255,255,255,.8); pointer-events: none; }
.slot { min-height: 72px; border-radius: 12px; border: 1.5px dashed rgba(255,255,255,.7); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; text-align: center; padding: 6px; }
.slot.full { border-style: solid; background: rgba(255,255,255,.18); font-weight: 700; }
.slot .av { width: 30px; height: 30px; font-size: 11px; }
.slot small { font-weight: 400; opacity: .9; }

/* Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border: 0; }
.list li.me { background: var(--turq-soft); margin: 0 -16px; padding: 10px 16px; border-radius: 12px; border: 0; }
.list li.tap { cursor: pointer; }
.list li > div { flex: 1; min-width: 0; }
.list li b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { width: 24px; font-weight: 800; font-style: italic; text-align: center; flex: none; }
.up { color: #0E8A7D; font-weight: 700; font-size: 13px; }
.dn { color: #C4383D; font-weight: 700; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 8px; text-align: center; }
.stats b { display: block; font-size: 22px; font-style: italic; }
.stats span { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; }

/* Interruptor */
.switch { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 6px 0; cursor: pointer; min-height: 44px; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--input); position: relative; flex: none; cursor: pointer; margin: 0; }
.switch input::after { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked { background: var(--turq); }
.switch input:checked::after { left: 21px; }

/* Pestañas inferiores */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: #fff; border-top: 1px solid var(--line); }
.tabs > div { max-width: 480px; margin: 0 auto; display: flex; padding: 6px 8px calc(10px + var(--safe-b)); }
.tabs a { flex: 1; text-decoration: none; font-size: 12px; color: #4F6A78; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; justify-content: center; position: relative; }
.tabs a.on { color: var(--ocean); font-weight: 700; }
.tabs svg { width: 22px; height: 22px; }
.tabs .dot { position: absolute; top: 2px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.plus { width: 44px; height: 44px; border-radius: 50%; background: var(--turq); color: var(--ocean); display: grid; place-items: center; margin-top: -16px; font-size: 26px; font-weight: 700; box-shadow: 0 2px 8px rgba(11,42,60,.2); }

/* Hoja inferior */
.sheet { position: fixed; inset: 0; background: rgba(11,42,60,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet > div { background: var(--bg); width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 18px 18px calc(24px + var(--safe-b)); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--input); margin: 0 auto 12px; }
.sheet ul { padding-left: 18px; margin: 6px 0 10px; }
.sheet li { margin: 4px 0; }

/* Aviso flotante */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--ocean); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 14px; z-index: 20; max-width: min(440px, 92vw); box-shadow: 0 6px 20px rgba(11,42,60,.3); }
.toast.err { background: #B42318; }

/* Resultado */
.score { display: grid; grid-template-columns: 1fr repeat(3, 54px); gap: 8px; align-items: center; margin: 8px 0; }
.score input { width: 100%; min-height: 46px; border: 1px solid var(--input); border-radius: 10px; text-align: center; font-size: 18px; background: #fff; }
.score .h { font-size: 12px; color: var(--muted); text-align: center; }
.score b { font-size: 13px; }

/* Texto legal */
.legal h2 { margin-top: 18px; }
.legal h3 { margin-top: 18px; }
.legal p, .legal li { font-size: 14px; margin: 6px 0; }

/* Admin */
.admin main { max-width: 1100px; padding-bottom: 40px; }
.admin .app { max-width: 1100px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.t th, table.t td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.t th { background: var(--soft); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.kpis div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.kpis b { display: block; font-size: 24px; font-style: italic; }
