/* =========================================================
   AVD Core · Tema visual (paleta del logo AVD)
   ========================================================= */
:root {
  --navy: #0D213B;
  --navy-2: #16304F;
  --navy-3: #24476F;
  --steel: #5E7593;
  --steel-2: #93A3B8;
  --mist: #DCE3EC;
  --bg: #EDEDED;
  --surface: #FFFFFF;
  --line: #D5D9DF;
  --text: #0D213B;
  --text-2: #4B5D74;
  --ok: #1E7F55;
  --warn: #B86E00;
  --danger: #B3261E;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(13,33,59,.06), 0 6px 18px rgba(13,33,59,.07);
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body); font-size: 16px; line-height: 1.45;
  color: var(--text); background: var(--bg);
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-3); }
[hidden] { display: none !important; }

/* ---------- tipografía ---------- */
.display, h1, h2, h3 {
  font-family: var(--display); font-weight: 800; font-style: italic;
  text-transform: uppercase; letter-spacing: .01em; line-height: 1.05; margin: 0;
}
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.eyebrow { font-family: var(--display); font-weight: 700; font-style: italic; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--steel); }

/* ---------- motivo "líneas de velocidad" del logo ---------- */
.speed {
  position: relative; overflow: hidden;
}
.speed::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .14;
  background:
    linear-gradient(90deg, transparent 0 40%, #fff 40% 100%) 0 18% / 100% 3px no-repeat,
    linear-gradient(90deg, transparent 0 55%, #fff 55% 100%) 0 30% / 100% 3px no-repeat,
    linear-gradient(90deg, transparent 0 30%, #fff 30% 100%) 0 42% / 100% 3px no-repeat,
    linear-gradient(90deg, transparent 0 62%, #fff 62% 100%) 0 54% / 100% 3px no-repeat,
    linear-gradient(90deg, transparent 0 46%, #fff 46% 100%) 0 66% / 100% 3px no-repeat,
    linear-gradient(90deg, transparent 0 70%, #fff 70% 100%) 0 78% / 100% 3px no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%);
          mask-image: linear-gradient(90deg, transparent, #000 70%);
  transform: skewX(-20deg); transform-origin: bottom;
}

/* ---------- layout ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  padding: calc(10px + var(--safe-top)) 0 10px;
  box-shadow: 0 2px 10px rgba(13,33,59,.25);
}
.topbar .container { display: flex; align-items: center; gap: 12px; }
.topbar .logo { height: 40px; width: auto; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn { color: #fff; }
.page { flex: 1; padding: 18px 0 calc(96px + var(--safe-bottom)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.navy { background: var(--navy); color: #fff; }
.card.navy .muted { color: var(--steel-2); }
.card-link { display: block; text-decoration: none; color: inherit; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.card-link:active { transform: scale(.985); }

/* ---------- botones ---------- */
.btn {
  appearance: none; border: 0; border-radius: 12px; padding: 13px 18px; min-height: 48px;
  font-family: var(--display); font-weight: 700; font-style: italic; text-transform: uppercase; letter-spacing: .04em; font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: var(--navy); color: #fff; transition: filter .15s, transform .08s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--mist); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.btn.light { background: #fff; color: var(--navy); }
.btn.danger { background: var(--danger); }
.btn.sm { min-height: 38px; padding: 8px 12px; font-size: .95rem; border-radius: 10px; }
.btn.lg { min-height: 58px; font-size: 1.3rem; }
.icon-btn {
  appearance: none; border: 0; background: transparent; width: 42px; height: 42px; border-radius: 12px;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--navy);
}
.icon-btn:hover { background: rgba(127,127,127,.12); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; flex: none; }

/* ---------- formularios ---------- */
.field { display: block; }
.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  padding: 12px 14px; min-height: 48px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(36,71,111,.15); }
.input.sm { min-height: 40px; padding: 8px 10px; }
.input-wrap { position: relative; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--steel-2); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(18px); }
.error-text { color: var(--danger); font-size: .9rem; min-height: 1.2em; }

/* ---------- chips, badges, segmentado ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; background: var(--mist); color: var(--navy); font-size: .88rem; font-weight: 600; }
.chip.dark { background: var(--navy); color: #fff; }
.chip button { border: 0; background: transparent; cursor: pointer; padding: 0 0 0 2px; color: inherit; font-size: 1rem; line-height: 1; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-family: var(--display); font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; }
.badge.fuerte { background: var(--navy); color: #fff; }
.badge.medio { background: var(--mist); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }
.badge.off { background: #f3e2e0; color: var(--danger); }
.badge.on { background: #dcefe5; color: var(--ok); }
.seg { display: flex; background: var(--mist); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 10px 8px; cursor: pointer;
  font-family: var(--display); font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: 1rem; color: var(--navy);
}
.seg button.active { background: var(--navy); color: #fff; box-shadow: var(--shadow); }
.seg button small { display: block; font-family: var(--body); font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .78rem; opacity: .8; }

/* ---------- video ---------- */
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #0a1628; border-radius: 12px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video .play {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(13,33,59,.05), rgba(13,33,59,.55));
}
.video .play span { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.95); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.video .play svg { width: 28px; height: 28px; color: var(--navy); margin-left: 4px; }
.video .novideo { position: absolute; inset: 0; display: grid; place-items: center; color: var(--steel-2); text-align: center; padding: 16px; font-size: .9rem; }
.video .novideo svg { width: 36px; height: 36px; margin: 0 auto 6px; display: block; opacity: .7; }

/* ---------- lista / misc ---------- */
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.num {
  flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-style: italic; font-weight: 800; font-size: 1.1rem;
}
.stat { text-align: center; }
.stat b { display: block; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 1.7rem; line-height: 1; }
.stat span { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.card.navy .stat span { color: var(--steel-2); }
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty svg { width: 48px; height: 48px; margin: 0 auto 10px; opacity: .5; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- toast / modal ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(86px + var(--safe-bottom)); display: grid; place-items: center; z-index: 100; pointer-events: none; padding: 0 16px; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 500; animation: toastIn .25s ease; max-width: 520px; }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.modal-back { position: fixed; inset: 0; background: rgba(13,33,59,.55); z-index: 90; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease; }
@media (min-width: 700px) { .modal-back { align-items: center; } }
.modal { background: var(--bg); width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + var(--safe-bottom)); animation: slideUp .25s ease; }
@media (min-width: 700px) { .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { flex: 1; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } }

/* ---------- login ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px;
  background: radial-gradient(1200px 600px at 50% -10%, #ffffff 0%, var(--bg) 60%);
}
.login-box { width: 100%; max-width: 400px; }
.login-logo { width: 78%; max-width: 300px; margin: 0 auto 26px; }
.login .card { padding: 22px; }
.login-foot { text-align: center; margin-top: 18px; font-size: .82rem; color: var(--text-2); }

/* ---------- navegación inferior ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + var(--safe-bottom));
}
.bottom-nav a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 10px;
  text-decoration: none; color: var(--steel); font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.active { color: var(--navy); background: var(--mist); }

.spinner { width: 34px; height: 34px; border: 3px solid var(--mist); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--navy); z-index: 200; transition: opacity .3s; }
.splash img { width: 60%; max-width: 260px; }
.install-banner { display: flex; align-items: center; gap: 10px; }
a.btn, label.btn { text-decoration: none; }
h1 svg, h2 svg, h3 svg { width: 22px; height: 22px; vertical-align: -3px; flex: none; }
.toast-wrap { z-index: 150; }

.video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0a1628; }

/* videos verticales propios */
.video.portrait { aspect-ratio: 9 / 16; width: calc(min(68vh, 540px) * 9 / 16); max-width: 100%; margin: 0 auto; }
.modal .video.portrait { width: calc(min(50vh, 440px) * 9 / 16); }
body:has(.player) .toast-wrap { bottom: calc(150px + var(--safe-bottom)); }

.offline-pill { position: fixed; top: calc(8px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 160; background: var(--warn); color: #fff; font-size: .8rem; font-weight: 700; padding: 6px 12px; border-radius: 99px; box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: nowrap; }
