/* CrewLink — estilos de la app (director + crew) · Mercamind */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Raleway:wght@600;700&display=swap');

/* Valores base. Todas las páginas usan V4 (abajo), que activa js/theme.js antes de pintar */
:root {
  --bg: #07090d;
  --bg2: #0c1017;
  --panel: #111620;
  --panel2: #161c28;
  --chip: #1d2535;
  --line: #222b3a;
  --line2: #2d3850;
  --text: #e9eef6;
  --heading: var(--text);
  --muted: #7d8aa3;
  --dim: #4b5670;
  --accent: #4de1ff;      /* cian CrewLink */
  --accent-ink: #00222b;
  --accent-tint: rgba(77,225,255,.08);
  --accent-glow: rgba(77,225,255,.35);
  --online: var(--ok);
  --tally: #ff3b4e;       /* rojo al aire */
  --red-text: #ff3b4e;
  --red-tint: rgba(255,59,78,.08);
  --amber: #ffbe3d;
  --amber-line: rgba(255,190,61,.3);
  --amber-bg: rgba(255,190,61,.08);
  --ok: #38e39a;
  --green-text: #38e39a;
  --green-bg: rgba(56,227,154,.1);
  --warn: #ffbe3d;
  --bad: #ff4d5e;
  --bad-line: rgba(255,77,94,.35);
  --bad-bg: rgba(255,77,94,.1);
  --bad-text: #ffb3bb;
  --overlay: rgba(3,5,8,.78);
  --grid-line: rgba(77,225,255,.035);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Sora', system-ui, -apple-system, sans-serif;
  --display: var(--sans);
}

/* ---------- V4 · Velinx día / noche ----------
   Mismo significado en ambos modos:
   rojo = micrófono abierto · verde = alguien habla · máximo contraste (blanco de noche, negro de día) = elegido o activado
   ámbar = pon atención · gris = inactivo. Los canales se distinguen por letra, nombre y tecla, no por color. */
[data-theme] {
  --mono: 'Poppins', system-ui, -apple-system, sans-serif;
  --sans: 'Poppins', system-ui, -apple-system, sans-serif;
  --display: 'Raleway', 'Poppins', sans-serif;
  --accent-glow: transparent;
  --online: var(--accent);
  --grid-line: transparent;
  --amber-line: #F5A400;
  --bad: var(--amber);           /* problemas y errores = atención, nunca rojo */
  --bad-line: var(--amber-line);
  --bad-bg: var(--amber-bg);
  --bad-text: var(--amber);
}
[data-theme="night"] {
  --bg: #0F0F0F; --bg2: #161616; --panel: #1A1A1A; --panel2: #242424; --chip: #2A2A2A;
  --line: #2C2C2C; --line2: #3D3D3D; --text: #FFFFFF; --heading: #FFFFFF; --muted: #B0B0B0; --dim: #9A9A9A;
  --accent: #F2F2F2; --accent-ink: #161616; --accent-tint: rgba(242,242,242,.06);
  --tally: #FF2A2A; --red-text: #FF4D4D; --red-tint: rgba(255,42,42,.06);
  --ok: #22C77A; --green-text: #4ADE94; --green-bg: rgba(34,199,122,.16);
  --amber: #FFC24D; --amber-bg: rgba(245,164,0,.12);
  --overlay: rgba(0,0,0,.72);
  color-scheme: dark;
}
[data-theme="day"] {
  --bg: #FAFAFA; --bg2: #FFFFFF; --panel: #FFFFFF; --panel2: #F2F2F2; --chip: #F0F0F0;
  --line: #E3E3E3; --line2: #CFCFCF; --text: #161616; --heading: #232E07; --muted: #5E5E5E; --dim: #6B6B6B;
  --accent: #161616; --accent-ink: #FFFFFF; --accent-tint: rgba(22,22,22,.05);
  --tally: #FA0000; --red-text: #D90000; --red-tint: #FFFFFF;
  --ok: #0E9F5E; --green-text: #087A4B; --green-bg: #E3F6EC;
  --amber: #9A5B00; --amber-bg: #FFF6E0;
  --overlay: rgba(22,22,22,.45);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { overflow: hidden; transition: background-color .2s, color .2s; }
[data-theme], [data-theme] body { overscroll-behavior: none; } /* sin deslizar-para-recargar en la consola y el crew */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
[data-theme] .label { font-size: 11px; font-weight: 600; color: var(--dim); }

/* Fondo con retícula */
.grid-bg {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); box-shadow: 0 0 24px var(--accent-glow); }
.logo-mark svg { width: 18px; height: 18px; }
.logo-text { font-size: 19px; }
.logo-text b { color: var(--accent); font-weight: 800; }
.logo-sub { font-family: var(--mono); font-size: 9px; letter-spacing: .16em; color: var(--dim); text-transform: uppercase; }
/* V4: logotipo de texto */
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark b { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: .02em; }
.wordmark small { font-size: 11px; color: var(--dim); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; transition: .15s; white-space: nowrap; }
a.btn { color: var(--text); text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 10px; border-radius: 8px; }
.btn.big { height: 56px; font-size: 15px; border-radius: 14px; width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
[data-theme] .btn { height: 44px; padding: 0 16px; border-radius: 12px; background: transparent; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; }
[data-theme] .btn svg { width: 18px; height: 18px; }
[data-theme] .btn.primary { background: var(--accent); font-weight: 600; }
[data-theme] .btn.primary:hover { filter: none; opacity: .9; }
[data-theme] .btn.sm { height: 30px; font-size: 12px; border-radius: 8px; }
[data-theme] .btn.big { height: 56px; font-size: 16px; border-radius: 14px; }

.toggle { height: 24px; padding: 0 9px; border-radius: 6px; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; border: 1px solid var(--line2); color: var(--muted); background: transparent; }
.toggle.on-live { color: var(--ok); border-color: rgba(56,227,154,.45); background: rgba(56,227,154,.08); }
.toggle.off-live { color: var(--bad); border-color: rgba(255,77,94,.45); background: rgba(255,77,94,.1); }
.toggle.on-iso { color: var(--amber); border-color: rgba(255,190,61,.5); background: rgba(255,190,61,.1); }

/* Selector día / noche */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); flex: none; }
.seg button { height: 36px; padding: 0 12px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg svg { width: 16px; height: 16px; flex: none; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 7px; }
.input, select.input { height: 48px; border-radius: 11px; background: var(--bg2); border: 1px solid var(--line2); padding: 0 14px; font-size: 15px; outline: none; width: 100%; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.input.code { font-family: var(--mono); font-size: 20px; letter-spacing: .12em; text-align: center; text-transform: uppercase; color: var(--accent); }
[data-theme] .input.code { font-weight: 600; }

/* Tarjeta / modal */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
[data-theme] .card { border-radius: 22px; }
.overlay { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 18px; }
.modal { width: min(440px, 100%); max-height: 92vh; overflow: auto; }
.modal h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: .02em; }
[data-theme] .modal h2 { font-family: var(--display); font-weight: 700; color: var(--heading); }
.modal .close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); color: var(--muted); }
.modal { position: relative; }

.err { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-text); font-size: 13px; }
.err a { color: inherit; font-weight: 600; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber); font-size: 12px; line-height: 1.45; }

/* Indicadores */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.online { background: var(--online); box-shadow: 0 0 10px var(--accent-glow); }
.dot.connecting { background: var(--amber); animation: blink 1s infinite; }
.dot.offline { background: var(--bad); }
@keyframes blink { 50% { opacity: .3; } }

.vu { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.vu > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok) 0 60%, var(--amber) 60% 85%, var(--bad) 85%); background-size: 100% 100%; transition: width .06s linear; }
[data-theme] .vu { background: var(--line2); border-radius: 999px; }
[data-theme] .vu > i { background: var(--ok); }   /* verde: alguien habla */

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; border: 1px solid; }

.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 11px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.banner-audio { position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--tally); color: #fff; text-align: center; font-weight: 700; font-size: 13px; padding: 10px; cursor: pointer; letter-spacing: .04em; }
[data-theme] .banner-audio { background: var(--amber-line); color: #161616; }
/* Aviso de versión nueva: píldora pequeña arriba al centro, se puede ocultar; no tapa los controles */
#updateBanner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 95; display: flex; align-items: center; max-width: calc(100vw - 24px); background: #F5A400; color: #161616; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.35); font: 600 12px/1.2 var(--sans); }
#updateBanner button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 9px 6px 9px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#updateBanner .x { padding: 9px 14px 9px 8px; font-size: 16px; line-height: 1; }

/* Flash a pantalla completa */
.flash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; text-align: center; animation: flashbg .5s steps(1) 6; cursor: pointer; padding: 24px; }
.flash h1 { font-size: clamp(44px, 14vw, 120px); margin: 0; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.flash p { font-family: var(--mono); letter-spacing: .2em; opacity: .8; font-size: 12px; }
@keyframes flashbg { 50% { filter: brightness(1.6); } }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
