/* ============================================================================
   CGE — Consola de central (video-asistencia en terreno)
   Sistema de diseño "sala de control": consola oscura de operaciones.
   Mundo visual comprometido en oscuro (elección, no omisión): despacho que
   vigila video en turnos largos. Neutros azul-negro sesgados al azul CGE +
   un único acento "energizado" ámbar para el estado EN VIVO.
   ============================================================================ */

/* ---------- Tipografía auto-hospedada (IBM Plex) ---------- */
@font-face { font-family:"IBM Plex Sans"; font-style:normal; font-weight:400; font-display:swap; src:url("/shared/fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family:"IBM Plex Sans"; font-style:normal; font-weight:500; font-display:swap; src:url("/shared/fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family:"IBM Plex Sans"; font-style:normal; font-weight:600; font-display:swap; src:url("/shared/fonts/plex-sans-600.woff2") format("woff2"); }
@font-face { font-family:"IBM Plex Sans"; font-style:normal; font-weight:700; font-display:swap; src:url("/shared/fonts/plex-sans-700.woff2") format("woff2"); }
@font-face { font-family:"IBM Plex Mono"; font-style:normal; font-weight:400; font-display:swap; src:url("/shared/fonts/plex-mono-400.woff2") format("woff2"); }
@font-face { font-family:"IBM Plex Mono"; font-style:normal; font-weight:500; font-display:swap; src:url("/shared/fonts/plex-mono-500.woff2") format("woff2"); }

:root {
  --bg:        #090D1E;
  --bg-glow:   rgba(59,84,230,.10);
  --panel:     #111834;
  --panel-2:   #151E42;
  --panel-hi:  #1C2856;
  --line:      #27325E;
  --line-soft: #1D2650;

  --ink:   #EAEEFB;
  --muted: #98A2C6;
  --faint: #69749B;

  --cge:      #3B54E6;
  --cge-hi:   #4A61EF;
  --cge-soft: rgba(59,84,230,.16);
  --live:     #FFB020;
  --live-dim: rgba(255,176,32,.14);
  --ready:    #37C6E8;
  --ready-dim:rgba(55,198,232,.12);
  --off:      #5C668C;
  --alert:    #FF5C48;
  --ok:       #35D08A;
  --ok-dim:   rgba(53,208,138,.14);
  --warn:     #FFB020;
  --warn-dim: rgba(255,176,32,.14);
  --bad:      #FF5C48;
  --bad-dim:  rgba(255,92,72,.14);

  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 82% -12%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* trama tenue tipo panel de mímico */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 24%, #000 0%, transparent 80%);
}
body > * { position: relative; z-index: 1; }

a { color: var(--cge-hi); }

/* ============================ Barra de comando ============================ */
header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 62px; padding: 0 22px;
  background: rgba(9,13,30,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-lozenge {
  background: #fff; border-radius: 8px; padding: 6px 10px;
  display: flex; align-items: center; box-shadow: 0 3px 12px rgba(0,0,0,.45); flex: none;
}
.logo-lozenge img { height: 20px; display: block; }
.brand-title {
  font-weight: 600; font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-title b { color: var(--ink); font-weight: 600; }

.cmdnav { display: flex; gap: 2px; }
.cmdnav a {
  font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: none;
  padding: 9px 13px; border-radius: 8px; position: relative; transition: color .15s, background .15s; white-space: nowrap;
}
.cmdnav a:hover { color: var(--ink); background: var(--panel); }
.cmdnav a.is-active { color: var(--ink); }
.cmdnav a.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -20px; height: 2px;
  background: var(--cge); border-radius: 2px 2px 0 0; box-shadow: 0 0 10px rgba(59,84,230,.7);
}

.user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.user-role { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

/* botón fantasma (Salir) */
.btn-ghost, .link-button {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 8px 13px; border-radius: 8px; cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn-ghost:hover, .link-button:hover { color: var(--ink); border-color: var(--faint); background: var(--panel); text-decoration: none; }
#logoutForm { margin: 0; }

/* nav antigua (compatibilidad) reestilizada como cmdnav */
.top-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.top-nav a {
  font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: none;
  padding: 9px 13px; border-radius: 8px;
}
.top-nav a:hover { color: var(--ink); background: var(--panel); text-decoration: none; }
.header-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.header-left h1 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--ink); white-space: nowrap; }
.header-logo { margin-left: auto; background: #fff; border-radius: 8px; padding: 6px 10px; display: flex; align-items: center; box-shadow: 0 3px 12px rgba(0,0,0,.45); }
.header-logo img { height: 20px; display: block; }

/* ============================ Lienzo / secciones ============================ */
main { padding: 22px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card h2, .card h3 { margin: 0 0 14px; font-weight: 600; letter-spacing: .01em; }
.card h2 { font-size: 16px; }
.card h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-family: var(--mono); font-weight: 500; }

.layout { display: grid; grid-template-columns: minmax(320px, 1fr) 360px; gap: 18px; align-items: start; }

.small { color: var(--faint); font-size: 13px; }
.hidden { display: none; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }

/* ============================ Tira de despacho (tally) ============================ */
.tally {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 13px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  overflow: hidden; margin-bottom: 20px;
}
.tally-item { display: flex; flex-direction: column; justify-content: center; padding: 15px 24px; border-right: 1px solid var(--line-soft); min-width: 128px; }
.tally-num { font-family: var(--mono); font-weight: 600; font-size: 30px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.tally-item.live .tally-num { color: var(--live); text-shadow: 0 0 18px rgba(255,176,32,.55); }
.tally-item.avail .tally-num { color: var(--ready); }
.tally-label { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 9px; }
.tally-spacer { flex: 1; border-right: 0; }
.tally-meta { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 7px; padding: 15px 24px; border-right: 0; }
.tally-meta .k { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; }
.tally-meta .clock { font-family: var(--mono); font-size: 16px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* ============================ Toolbar (buscador + segmentado) ============================ */
.toolbar, .dashboard-toolbar { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; transition: border-color .15s, box-shadow .15s;
}
.search svg { width: 16px; height: 16px; color: var(--faint); flex: none; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--ink); font-family: var(--sans); font-size: 14px; }
.search input::placeholder { color: var(--faint); }
.search:focus-within { border-color: var(--cge); box-shadow: 0 0 0 3px var(--cge-soft); }
/* buscador simple del dashboard antiguo */
.dashboard-toolbar #search { flex: 1 1 260px; height: 44px; padding: 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; color: var(--ink); font-family: var(--sans); font-size: 14px; }
.dashboard-toolbar #search::placeholder { color: var(--faint); }
.dashboard-toolbar #search:focus { outline: none; border-color: var(--cge); box-shadow: 0 0 0 3px var(--cge-soft); }

.segmented, .filters.segmented { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 0; }
.seg, .segmented button, .filters.segmented button {
  background: transparent; border: 0; cursor: pointer; color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 500; padding: 8px 15px; border-radius: 8px; transition: all .15s; margin: 0;
}
.seg:hover:not(.is-active), .segmented button:hover:not(.is-active), .filters.segmented button:hover:not(.active) { color: var(--ink); }
.seg.is-active, .segmented button.is-active, .filters.segmented button.active {
  background: var(--panel-hi); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; text-decoration: none;
}
.seg:focus-visible, .segmented button:focus-visible { outline: 2px solid var(--cge); outline-offset: 2px; }

/* ============================ Grilla de estaciones (dashboard) ============================ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 14px; }

.team-card, .tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 11px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 13px; padding: 16px 16px 15px;
  min-height: 150px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.team-card:hover, .tile:hover { transform: translateY(-2px); border-color: #34406e; box-shadow: 0 10px 28px rgba(0,0,0,.35); }

/* estado por LED + label + (en vivo) tinte de borde y glow — SIN rail lateral */
.team-card.state-en_vivo, .tile.live { border-color: rgba(255,176,32,.34); }
.team-card.state-en_vivo::after, .tile.live::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(140px 90px at 100% 0%, rgba(255,176,32,.11), transparent 68%);
}
.team-card.state-offline, .tile.off { opacity: .58; }

.tile-top { display: flex; align-items: center; gap: 9px; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.tile.live .led, .team-card.state-en_vivo .led {
  background: var(--live); box-shadow: 0 0 0 3px var(--live-dim), 0 0 12px 2px rgba(255,176,32,.55);
  animation: pulse 2s ease-in-out infinite;
}
.tile.avail .led, .team-card.state-disponible .led { background: var(--ready); box-shadow: 0 0 0 3px var(--ready-dim), 0 0 9px 1px rgba(55,198,232,.45); }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px var(--live-dim), 0 0 10px 1px rgba(255,176,32,.42); }
  50%     { box-shadow: 0 0 0 4px rgba(255,176,32,.22), 0 0 20px 5px rgba(255,176,32,.66); }
}

.state, .team-card-state { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.tile.live .state, .team-card.state-en_vivo .team-card-state { color: var(--live); }
.tile.avail .state, .team-card.state-disponible .team-card-state { color: var(--ready); }
.tile.off .state, .team-card.state-offline .team-card-state { color: var(--off); }
.station { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .06em; }

.name, .team-card-name { margin: 3px 0 0; font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: .01em; }
.aviso, .team-card-aviso { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .02em; }
.tile.live .aviso, .team-card.state-en_vivo .team-card-aviso { color: var(--ink); }
.aviso .lbl { color: var(--faint); }

.tile-foot { margin-top: auto; display: flex; flex-direction: column; gap: 11px; padding-top: 4px; }
.rec { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; color: var(--alert); }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--alert); animation: blink 1.2s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: .18; } }

.btn-enter, .enter-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--cge); color: #fff; border: 0; border-radius: 10px; padding: 11px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-enter:hover, .enter-btn:hover { background: var(--cge-hi); }
.btn-enter:focus-visible, .enter-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn-enter svg { width: 15px; height: 15px; }

.empty { padding: 40px; text-align: center; color: var(--faint); font-size: 14px; }

/* aparición escalonada */
.tile-appear { animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ============================ Panel de video ============================ */
.video-shell {
  position: relative;
  width: var(--video-view-width, min(60vw, calc(80vh * 4 / 3)));
  height: auto; max-width: 100%; aspect-ratio: 4 / 3; margin: 0 auto;
  background: #000; overflow: hidden; border-radius: 12px; border: 1px solid var(--line);
}
.video-shell video { width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.video-shell canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 2; }
#drawCanvas { cursor: crosshair; touch-action: none; pointer-events: auto; }
#remoteDrawCanvas { pointer-events: none; }

.viewer-controls { display: grid; gap: 10px; margin: 4px 0 14px; }
.viewer-controls .viewer-row { display: flex; align-items: center; gap: 12px; }
.viewer-controls label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.viewer-controls strong { font-family: var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.viewer-controls input[type="range"] { flex: 1; accent-color: var(--cge); }
.quick-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-sizes button { background: var(--panel-hi); color: var(--muted); font-family: var(--mono); font-size: 12px; padding: 6px 10px; border: 1px solid var(--line); }
.quick-sizes button:hover { color: var(--ink); border-color: var(--faint); background: var(--panel-hi); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.recording-panel { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }

/* telemetría (status-grid + badges como chips LED) */
.status-grid { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; align-items: center; font-size: 13.5px; }
.status-grid > span:nth-child(odd) { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; min-width: 104px; justify-content: flex-start;
  padding: 5px 10px; border-radius: 8px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase;
  background: var(--panel-hi); color: var(--muted); border: 1px solid var(--line-soft);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); flex: none; }
.badge.ok, .badge.connected, .badge.ready, .badge.stable, .badge.sending, .badge.receiving { background: var(--ok-dim); color: var(--ok); border-color: transparent; }
.badge.ok::before, .badge.connected::before, .badge.ready::before { background: var(--ok); box-shadow: 0 0 8px 1px rgba(53,208,138,.5); }
.badge.warn, .badge.pending, .badge.connecting, .badge.checking { background: var(--warn-dim); color: var(--warn); border-color: transparent; }
.badge.warn::before, .badge.pending::before, .badge.connecting::before, .badge.checking::before { background: var(--warn); box-shadow: 0 0 8px 1px rgba(255,176,32,.5); }
.badge.bad, .badge.error, .badge.failed, .badge.disconnected, .badge.closed { background: var(--bad-dim); color: var(--bad); border-color: transparent; }
.badge.bad::before, .badge.error::before, .badge.failed::before, .badge.disconnected::before, .badge.closed::before { background: var(--bad); box-shadow: 0 0 8px 1px rgba(255,92,72,.5); }
.badge.idle { background: var(--panel-hi); color: var(--muted); }

.session-row { display: flex; gap: 8px; margin: 10px 0 12px; }
.session-row input, .session-row select { flex: 1; min-width: 0; }
.link-box { padding: 10px 12px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line-soft); overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; color: var(--muted); }

#log { height: 200px; overflow: auto; white-space: pre-wrap; background: #05070F; color: #7FE6C0; border: 1px solid var(--line-soft); border-radius: 9px; padding: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; }

/* ============================ Formularios / inputs ============================ */
input, select, textarea { font: inherit; }
input[type="text"], input[type="password"], input[type="date"], input[type="search"], select,
.session-row input, .filters input, .login-form input, .data-table input {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 12px; border-radius: 9px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--cge); box-shadow: 0 0 0 3px var(--cge-soft); }
input[type="date"] { color-scheme: dark; }

.filters { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.filters label { display: grid; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ============================ Botones ============================ */
button {
  border: 0; border-radius: 9px; padding: 10px 14px;
  background: var(--cge); color: #fff; cursor: pointer; font-family: var(--sans); font-weight: 600; font-size: 13.5px;
  transition: background .15s, opacity .15s;
}
button:hover { background: var(--cge-hi); }
button:focus-visible { outline: 2px solid var(--cge); outline-offset: 2px; }
button.secondary { background: var(--panel-hi); color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover { background: #222f5e; }
button.danger { background: transparent; color: var(--alert); border: 1px solid rgba(255,92,72,.4); }
button.danger:hover { background: var(--bad-dim); }
button:disabled { opacity: .4; cursor: not-allowed; }

.button-link, .small-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; padding: 8px 12px; background: var(--cge); color: #fff;
  text-decoration: none; font-family: var(--sans); font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer;
}
.button-link:hover, .button-link:visited, .button-link:active { color: #fff; text-decoration: none; }
.button-link:hover { background: var(--cge-hi); }
.button-link.secondary { background: var(--panel-hi); color: var(--ink); border: 1px solid var(--line); }
.button-link.secondary:hover { background: #222f5e; color: var(--ink); }
.small-button.danger { background: transparent; color: var(--alert); border: 1px solid rgba(255,92,72,.4); }
.small-button.danger:hover { background: var(--bad-dim); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ============================ Tablas ============================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.recordings-table, .data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.recordings-table th, .data-table th {
  background: var(--panel); color: var(--muted); text-align: left; padding: 11px 12px;
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.recordings-table td, .data-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--ink); }
.recordings-table tr:last-child td, .data-table tr:last-child td { border-bottom: 0; }
.recordings-table tbody tr:hover, .data-table tbody tr:hover { background: rgba(255,255,255,.02); }
.recordings-table td:nth-child(1), .recordings-table td:nth-child(3) { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.data-table .danger { color: var(--alert); }

/* chip de estado activo/inactivo en tabla de cuentas */
.pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.pill.on { color: var(--ok); } .pill.on::before { background: var(--ok); box-shadow: 0 0 8px 1px rgba(53,208,138,.5); }
.pill.role { color: var(--ready); } .pill.role::before { background: var(--ready); }

/* ============================ Login ============================ */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -8%, rgba(59,84,230,.16), transparent 62%),
    var(--bg);
}
.login-page > div:first-child { display: none; } /* logo suelto antiguo: lo movemos a la card */
.login-wrap { width: min(420px, 100%); }
.login-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.login-brand { display: flex; justify-content: center; margin-bottom: 20px; }
.login-brand .logo-lozenge { padding: 9px 14px; }
.login-brand .logo-lozenge img { height: 30px; }
.login-card h1 { margin: 0 0 6px; font-size: 21px; font-weight: 700; text-align: center; letter-spacing: .01em; }
.login-card > .small { text-align: center; margin: 0 0 4px; }
.login-form { display: grid; gap: 14px; margin-top: 20px; }
.login-form label { display: grid; gap: 7px; font-family: var(--mono); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.login-form input { padding: 11px 12px; }
.login-form button { margin-top: 4px; padding: 12px; font-size: 14px; }

.alert {
  padding: 11px 13px; border-radius: 9px; background: var(--bad-dim); color: #FFC1B7;
  border: 1px solid rgba(255,92,72,.35); margin-top: 14px; font-size: 13.5px;
}

/* ============================ Responsive ============================ */
@media (max-width: 900px) {
  main, .wrap { padding: 14px; }
  .layout { grid-template-columns: 1fr; }
  .video-shell { width: 100% !important; height: auto !important; max-height: 62vh; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  header { gap: 12px; padding: 0 14px; }
  .cmdnav, .top-nav { display: none; }
  .tally { flex-wrap: wrap; } .tally-spacer { display: none; } .tally-meta { margin-left: auto; }
  .filters { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.live .led, .team-card.state-en_vivo .led, .rec-dot, .tile-appear { animation: none !important; }
  .team-card, .tile, button, a { transition: none !important; }
}
