/* EGP Elite Grand Prix — race control
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
   Paleta: la noche de la pista + los colores funcionales del árbol. */
:root {
  --night: #08090b;
  --deck: #111317;
  --deck-2: #181b21;
  --rule: #2a2f38;
  --ink: #f4f5f7;
  --dim: #9aa1ad;
  --faint: #5d636e;
  --silver: #d3d8df;
  --rt-red: #e10f1f;
  --amber: #ffb21a;
  --go: #2fe06f;
  --stop: #ff3b3b;
  --stage: #fff1c2;
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --text: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --rail-w: 252px;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font: 500 16px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.muted { color: var(--dim); font-weight: 500; }

/* ===================================================================== shell */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

/* ---------------------------------------------------------------- menú */
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0a1120 0%, var(--night) 100%);
  border-right: 1px solid var(--rule);
  padding: 18px 14px;
  overflow-y: auto;
  z-index: 30;
}
.rail-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); padding: 4px 6px 18px; }
.flag {
  width: 38px; height: 38px; border-radius: 8px; flex: none;
  background: repeating-conic-gradient(var(--ink) 0 25%, #0b1222 0 50%) 0 0 / 12.66px 12.66px;
  transform: skewX(-10deg);
  box-shadow: 0 0 0 2px var(--ink);
}
.flag.big { width: 72px; height: 72px; border-radius: 12px; background-size: 24px 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-egp { font: italic 900 34px/0.9 var(--display); letter-spacing: 1px; }
.brand-sub { font: 600 12px/1.2 var(--display); letter-spacing: 1.6px; color: var(--amber); text-transform: uppercase; margin-top: 4px; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin: 18px 10px 6px; font: 600 13px/1 var(--text); color: var(--faint); }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-md);
  color: var(--dim); text-decoration: none; font-weight: 600; font-size: 15px;
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { color: var(--ink); background: var(--deck); }
.nav-item.active { color: var(--ink); background: var(--deck-2); }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--amber);
}
.soon { margin-left: auto; font: italic 700 12px/1 var(--display); letter-spacing: .5px; color: var(--faint); border: 1px solid var(--rule); border-radius: 999px; padding: 3px 8px; }

.rail-foot { border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.me-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--deck-2); border: 1px solid var(--rule); font: italic 800 18px/1 var(--display); color: var(--amber);
}
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 13px; color: var(--dim); }

.scrim { position: fixed; inset: 0; background: rgba(3, 6, 12, .6); z-index: 25; }

/* ---------------------------------------------------------------- barra */
.main { min-width: 0; display: flex; flex-direction: column; }
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px; min-height: 68px;
  background: rgba(8, 9, 11, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.menu-btn { display: none; background: transparent; border: 1px solid var(--rule); border-radius: var(--r-md); padding: 8px; }
.menu-btn svg { width: 22px; height: 22px; display: block; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.bar-title { margin: 0; font: italic 800 30px/1 var(--display); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.phase {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--deck); border: 1px solid var(--rule);
  font: italic 700 17px/1 var(--display); letter-spacing: .5px; white-space: nowrap;
}
.phase-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.phase[data-phase="ARMED"] { border-color: #6b4a00; color: var(--amber); }
.phase[data-phase="ARMED"] .phase-dot { background: var(--amber); }
.phase[data-phase="TREE"], .phase[data-phase="RUNNING"] { background: var(--go); color: #03150a; border-color: var(--go); }
.phase[data-phase="TREE"] .phase-dot, .phase[data-phase="RUNNING"] .phase-dot { background: #03150a; animation: blink .6s steps(2) infinite; }
.phase[data-phase="FINISHED"] .phase-dot { background: var(--ink); }
.phase[data-phase="ABORTED"] { color: var(--stop); border-color: #6b1b1b; }
.phase[data-phase="ABORTED"] .phase-dot { background: var(--stop); }
@keyframes blink { 50% { opacity: 0; } }
.chip { padding: 6px 12px; border-radius: 999px; font: 600 14px/1 var(--text); }
.chip-sim { color: #9cd7ff; background: #0d2340; border: 1px solid #1d4a78; }
.link-state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--dim); white-space: nowrap; }
.link-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--stop); }
.link-state.ok .link-dot { background: var(--go); }
.lang { display: flex; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.lang button { background: transparent; border: 0; padding: 8px 12px; font-weight: 700; font-size: 14px; color: var(--dim); }
.lang button.active { background: var(--ink); color: var(--night); }
.db-alert { margin: 16px 24px 0; padding: 12px 16px; border-radius: var(--r-md); background: #2a0b0b; border: 1px solid #7a1f1f; color: #ffc9c9; font-weight: 600; }

.view { padding: 22px 24px 40px; }

/* ================================================================ consola */
.board {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 20px; align-items: stretch;
}
.lane {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,0) 40%),
    var(--deck);
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 16px 20px 18px;
  display: flex; flex-direction: column; gap: 4px;
  container-type: inline-size;
  transition: border-color .25s, box-shadow .25s, opacity .25s;
}
.lane.off { opacity: .32; }
.lane-top { display: flex; align-items: center; gap: 12px; }
.lane-letter {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm);
  background: var(--ink); color: var(--night); font: italic 900 30px/1 var(--display);
  transform: skewX(-8deg);
}
.lane-letter.sm { width: 30px; height: 30px; font-size: 20px; }
.lane-name { font: italic 700 22px/1 var(--display); color: var(--dim); letter-spacing: .3px; }
.win-light {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  background: #12301e; border: 2px solid #0a1a10; box-shadow: inset 0 -4px 8px rgba(0,0,0,.6);
}
.lane-status { margin: 6px 0 0; min-height: 24px; font: 600 17px/1.3 var(--text); color: var(--amber); }
.lane-et { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.et-tag { font: italic 700 18px/1 var(--display); color: var(--faint); }
.et-num {
  font: italic 800 clamp(64px, 18cqi, 132px)/0.92 var(--display);
  font-variant-numeric: tabular-nums; letter-spacing: -1px; white-space: nowrap;
  color: var(--ink);
}
.et-num.blank, .slip dd.blank { color: #2c3038; }
.lane-result { min-height: 28px; font: italic 900 26px/1 var(--display); letter-spacing: 1px; }
.slip {
  margin: 8px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.slip div { padding: 10px 10px 2px 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slip div:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--rule); }
.slip dt { font: 600 14px/1 var(--text); color: var(--dim); }
.slip dd { margin: 0; font: italic 700 clamp(22px, 8cqi, 34px)/1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
@container (min-width: 600px) {
  .slip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .slip div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
  .slip dd { font-size: clamp(22px, 5.2cqi, 36px); }
}
.slip dd.neg { color: var(--stop); }

.lane.win { border-color: var(--go); box-shadow: 0 0 0 1px var(--go) inset, 0 0 40px -12px rgba(47,224,111,.55); }
.lane.win .win-light { background: var(--go); border-color: #9bf5bc; box-shadow: 0 0 22px 6px rgba(47,224,111,.7); }
.lane.win .et-num { color: var(--go); }
.lane.win .lane-result { color: var(--go); }
.lane.lose .lane-result { color: var(--dim); }
.lane.red { border-color: var(--stop); box-shadow: 0 0 0 1px var(--stop) inset, 0 0 40px -12px rgba(255,59,59,.55); }
.lane.red .lane-result, .lane.red .lane-status { color: var(--stop); }
.lane.flash .et-num { animation: flash .5s steps(2) 6; }
@keyframes flash { 50% { opacity: .15; } }

/* ------------------------------------------------------------------ árbol */
.tree-col { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tree {
  display: grid; grid-template-columns: auto 42px auto; gap: 0 8px;
  padding: 14px 12px; border-radius: 20px;
  background:
    linear-gradient(90deg, #0c0d10, #1c1f25 50%, #0c0d10);
  border: 2px solid #33373f;
  box-shadow: 0 20px 40px -20px #000, inset 0 1px 0 rgba(255,255,255,.06);
}
.tree-side, .tree-pole { display: grid; grid-template-rows: 24px 24px repeat(5, 48px); gap: 8px; justify-items: center; align-items: center; }
.tree-pole span { font: 700 11px/1 var(--display); letter-spacing: 1px; color: var(--faint); }
.tree-pole i { width: 6px; height: 100%; background: #0c0d10; border-radius: 3px; }
.bulb {
  width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2a3142, #11151e 70%);
  border: 3px solid #05070b;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,.65);
  transition: background .04s, box-shadow .04s;
}
.bulb.pre { width: 24px; height: 24px; border-width: 2px; }
.bulb.on.pre { background: radial-gradient(circle at 35% 30%, #fff, var(--stage) 60%); box-shadow: 0 0 16px 4px rgba(255,241,194,.75); }
.bulb.on.amb { background: radial-gradient(circle at 35% 30%, #ffe2a3, var(--amber) 60%); box-shadow: 0 0 26px 8px rgba(255,178,26,.75); }
.bulb.on.grn { background: radial-gradient(circle at 35% 30%, #c8ffdc, var(--go) 60%); box-shadow: 0 0 30px 10px rgba(47,224,111,.8); }
.bulb.on.red { background: radial-gradient(circle at 35% 30%, #ffc4c4, var(--stop) 60%); box-shadow: 0 0 30px 10px rgba(255,59,59,.85); }
.tree-side.off { opacity: .22; }
.clock { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#clock { font: italic 800 36px/1 var(--display); font-variant-numeric: tabular-nums; color: var(--faint); }
#clock.live { color: var(--ink); }
#tree-label { font: italic 700 16px/1 var(--display); letter-spacing: 2px; color: var(--dim); }

/* ---------------------------------------------------------------- mandos */
.dock { margin-top: 18px; display: flex; flex-direction: column; gap: 16px; }
.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.act {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
  min-height: 78px; padding: 12px 18px; border-radius: var(--r-lg); min-width: 0;
  border: 1px solid var(--rule); background: var(--deck); text-align: left;
  transition: transform .06s, filter .15s, opacity .15s;
}
.act span, .act small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act span { font: italic 900 clamp(22px, 2.1vw, 32px)/1.05 var(--display); letter-spacing: .3px; }
.act small { font: 500 14px/1.2 var(--text); color: var(--dim); }
.act:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.act:disabled { opacity: .3; cursor: not-allowed; }
.act-arm { background: linear-gradient(180deg, #3a2800, #261a00); border-color: #6b4a00; }
.act-arm span { color: var(--amber); }
.act-start { background: linear-gradient(180deg, #0b3a1d, #072512); border-color: #155a30; }
.act-start span { color: var(--go); }
.act-start.ready { background: var(--go); border-color: var(--go); animation: ready 1.1s ease-in-out infinite; }
.act-start.ready span, .act-start.ready small { color: #03150a; }
@keyframes ready { 50% { box-shadow: 0 0 0 6px rgba(47,224,111,.25); } }
.act-abort { background: linear-gradient(180deg, #3d0c0c, #270707); border-color: #6b1b1b; }
.act-abort span { color: #ff7070; }

.setup { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; }
.opt { display: flex; align-items: center; gap: 10px; }
.opt-label { font-weight: 600; color: var(--dim); font-size: 15px; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; background: var(--deck); }
.seg button { border: 0; background: transparent; padding: 11px 16px; min-height: 46px; font-weight: 700; font-size: 15px; color: var(--dim); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.active { background: var(--ink); color: var(--night); }
.seg.locked { opacity: .45; pointer-events: none; }

/* ------------------------------------------------------------- simulador */
.sim { margin-top: 22px; border: 1px dashed #24507e; border-radius: var(--r-lg); background: #081325; }
.sim summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.sim summary::-webkit-details-marker { display: none; }
.sim summary span { font: italic 800 22px/1 var(--display); color: #9cd7ff; }
.sim summary small { color: var(--dim); font-size: 14px; }
.sim-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 20px 20px; }
.sim-lane { background: var(--deck); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.sim-lane h3 { margin: 0; display: flex; align-items: center; gap: 10px; font: italic 700 19px/1 var(--display); color: var(--dim); }
.sim-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.sim-btns .ghost-btn { flex: 1; }

/* ---------------------------------------------------------------- comunes */
.ghost-btn {
  background: transparent; border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 10px 14px; min-height: 44px; font-weight: 700; font-size: 15px; color: var(--ink);
}
.ghost-btn:hover { border-color: #3a4c74; }
.ghost-btn.strong { background: var(--deck-2); }
.solid-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--amber); color: #1b1200; border: 0; border-radius: var(--r-md);
  padding: 12px 18px; min-height: 48px; font: italic 800 20px/1 var(--display); letter-spacing: .3px; text-decoration: none;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--dim); }
.field input, .field select {
  background: var(--night); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 12px; font-size: 17px; width: 100%; min-height: 48px;
}
.sim .field input { font: italic 700 24px/1 var(--display); font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--stop); }
.card { background: var(--deck); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font: italic 800 24px/1.1 var(--display); }
.card-note { margin: -4px 0 14px; color: var(--dim); font-size: 15px; max-width: 70ch; }
.empty { color: var(--dim); margin: 14px 0 4px; }
.form-msg { margin: 10px 0 0; min-height: 22px; font-weight: 600; color: #ff9b9b; }
.form-msg.ok { color: var(--go); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-btns { display: flex; gap: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font: 600 13px/1.2 var(--text); color: var(--faint); padding: 10px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td.num { font: italic 700 19px/1 var(--display); font-variant-numeric: tabular-nums; }
td.neg { color: var(--stop); }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font: 700 13px/1 var(--text); }
.tag-admin { background: #3a2800; color: var(--amber); }
.tag-operator { background: #0d2340; color: #9cd7ff; }
.tag-on { background: #0b3a1d; color: var(--go); }
.tag-off { background: #3d0c0c; color: #ff8a8a; }
.tag-win { background: var(--go); color: #03150a; }

/* --------------------------------------------------------------- historial */
.history-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.runs tbody tr { cursor: pointer; }
.runs tbody tr:hover td { background: var(--deck-2); }
.runs tbody tr.sel td { background: #1a2640; }
.pair { display: inline-flex; gap: 10px; align-items: baseline; }
.pair small { font: 500 13px/1 var(--text); color: var(--dim); }
.ticket {
  position: sticky; top: 90px;
  background: #f4f1e6; color: #16130c; border-radius: 4px;
  padding: 22px 20px 26px;
  font: 500 15px/1.4 "Courier New", ui-monospace, monospace;
  box-shadow: 0 24px 40px -24px #000;
  -webkit-mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 0 0 / 18px 100% repeat-x;
          mask: radial-gradient(circle 7px at 50% 100%, transparent 98%, #000) 0 0 / 18px 100% repeat-x;
}
.ticket .empty { color: #6b6553; font-family: var(--text); }
.ticket h3 { margin: 0; text-align: center; font: italic 900 30px/1 var(--display); letter-spacing: 1px; }
.ticket .t-sub { text-align: center; margin: 4px 0 14px; font-size: 13px; }
.ticket table { font: inherit; }
.ticket th, .ticket td { border-bottom: 1px dashed #b9b29c; padding: 7px 4px; color: inherit; font-family: inherit; }
.ticket th { font-size: 12px; }
.ticket td.v { text-align: right; font-weight: 700; }
.ticket .t-win { margin-top: 14px; text-align: center; font: italic 900 24px/1 var(--display); }

/* ---------------------------------------------------------------- usuarios */
.users-layout { display: flex; flex-direction: column; gap: 20px; max-width: 1180px; }

/* ------------------------------------------------------------------ pronto */
.soon-card { max-width: 560px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.soon-card h2 { margin: 8px 0 0; font: italic 900 44px/1 var(--display); }
.soon-card p { margin: 0; color: var(--dim); font-size: 17px; max-width: 46ch; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: #2a0b0b; color: #ffd3d3; border: 1px solid #7a1f1f; border-radius: var(--r-md);
  padding: 14px 20px; font-weight: 700; max-width: calc(100% - 32px);
}

/* ============================================================== responsive */
@media (max-width: 1180px) {
  :root { --rail-w: 84px; }
  .rail { padding: 18px 10px; }
  .brand-text, .nav-group, .nav-item span, .soon, .me-text { display: none; }
  .rail-brand { justify-content: center; padding-bottom: 14px; }
  .nav-item { justify-content: center; padding: 13px; }
  .nav-item.active::before { left: -10px; }
  .me { justify-content: center; }
  .rail-foot .ghost-btn { padding: 8px 4px; font-size: 12px; }
  .history-layout { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: static; max-width: 420px; }
}
@media (max-width: 980px) {
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tree-col { grid-column: 1 / -1; order: -1; flex-direction: row; justify-content: center; gap: 24px; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --rail-w: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: 100%;
    transform: translateX(-100%); transition: transform .2s ease;
    padding: 18px 14px;
  }
  .rail.open { transform: none; }
  .brand-text, .nav-group, .nav-item span, .soon, .me-text { display: revert; }
  .brand-text { display: flex; }
  .me-text { display: flex; }
  .nav-item { justify-content: flex-start; padding: 12px; }
  .nav-item .soon { display: inline-block; }
  .me { justify-content: flex-start; }
  .menu-btn { display: block; }
  .bar { padding: 10px 14px; gap: 10px; min-height: 60px; }
  .bar { flex-wrap: wrap; }
  .bar-title { order: 3; flex-basis: 100%; font-size: 26px; }
  .link-state #link-text, .chip-sim { display: none; }
  .view { padding: 16px 14px 32px; }
  .board { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .tree-col { flex-direction: column; }
  .bulb { width: 42px; height: 42px; }
  .bulb.pre { width: 22px; height: 22px; }
  .tree-side, .tree-pole { grid-template-rows: 22px 22px repeat(5, 42px); gap: 7px; }
  .lane { padding: 16px; }
  .act { min-height: 74px; padding: 12px 14px; }
  .act span { font-size: 23px; }
  .act small { font-size: 13px; }
  .opt { flex-wrap: wrap; }
  .sim-grid { grid-template-columns: minmax(0, 1fr); padding: 0 14px 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .db-alert { margin: 12px 14px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================== acceso */
.gate {
  --brand: #e10f1f; --brand-2: #ff4d57; --carbon: #0a0d12;
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 520px);
  background: var(--carbon);
}
.gate-art {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 36px 44px; border-right: 1px solid #1c222c;
  background:
    radial-gradient(90% 70% at 30% 45%, rgba(225,15,31,.10), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,.35) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #151a22, #07090c);
}
.gate-status { display: flex; align-items: center; gap: 10px; font: 700 13px/1 var(--display); letter-spacing: 2.4px; color: #c7cdd8; }
.gate-status i { width: 9px; height: 9px; border-radius: 50%; background: var(--go); box-shadow: 0 0 10px var(--go); }
.gate-logo { position: relative; align-self: center; text-align: left; }
.egp-word { display: flex; align-items: baseline; font: 400 clamp(120px, 15vw, 210px)/.85 "Russo One", var(--display); transform: skewX(-10deg); letter-spacing: -4px; }
.egp-word .e { background: linear-gradient(180deg, #ff6b73 0%, var(--brand) 45%, #9e0a14 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(225,15,31,.35)); }
.egp-word .gp { background: linear-gradient(180deg, #ffffff 0%, #d7dce4 50%, #8c94a3 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.egp-tag { margin: 18px 0 0; font: 700 clamp(15px, 1.6vw, 22px)/1 var(--display); letter-spacing: 5px; color: #e6e9ef; }
.egp-tag b { color: var(--brand); }
.egp-stripes { display: flex; gap: 10px; margin-top: 22px; }
.egp-stripes i { width: 70px; height: 8px; background: var(--brand); transform: skewX(-35deg); }
.egp-stripes i:nth-child(2) { width: 48px; opacity: .7; }
.egp-stripes i:nth-child(3) { width: 26px; opacity: .45; }
.gate-foot { display: flex; align-items: center; gap: 12px; font: 600 13px/1 var(--text); color: #7d8696; }
.checker { width: 26px; height: 26px; background: repeating-conic-gradient(#e6e9ef 0 25%, #11151b 0 50%) 0 0 / 13px 13px; border-radius: 3px; }

.gate-panel {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: 44px 48px; background: linear-gradient(180deg, #11151c, #0b0e13);
}
.gate-panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, transparent); }
.gate-mobile-logo { display: none; }
.gate-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gate-label { font: 700 13px/1 var(--display); letter-spacing: 3px; color: var(--brand); }
.gate .lang { border-color: #2a313d; }
.gate .lang button.active { background: var(--brand); color: #ffffff; }
.gate-panel h1 { margin: 10px 0 0; font: 800 42px/1 var(--display); text-transform: uppercase; letter-spacing: 1px; }
.gate-panel section > p { margin: 8px 0 0; color: #9aa3b2; }
.gate-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.gate .field span { font: 700 12px/1 var(--display); letter-spacing: 2px; text-transform: uppercase; color: #aab2bf; }
.gate .field input, .gate .field select { background: #080a0e; border-color: #2a313d; min-height: 52px; }
.gate .field input:focus, .gate .field select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(225,15,31,.18); }
.gate :focus-visible { outline-color: var(--brand); }
.gate-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 58px; margin-top: 4px;
  border: 0; border-radius: var(--r-md); background: linear-gradient(90deg, #b30b18, var(--brand) 50%, var(--brand-2));
  color: #ffffff; font: 800 22px/1 var(--display); letter-spacing: 2px; text-transform: uppercase;
  box-shadow: 0 10px 28px rgba(225,15,31,.25); transition: filter .15s, transform .15s;
}
.gate-btn:hover { filter: brightness(1.08); }
.gate-btn:active { transform: translateY(1px); }
.gate-btn:disabled { opacity: .6; cursor: wait; }
.gate-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.gate-note { display: flex; align-items: center; gap: 10px; padding-top: 18px; border-top: 1px solid #1f2530; color: #7d8696; font-size: 14px; }
.gate-note svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.gate-home { color: #7d8696; font-size: 14px; text-decoration: none; }
.gate-home:hover { color: var(--brand); }
.form-error { margin: 0; min-height: 22px; color: #ff9b9b; font-weight: 600; }
.form-error:empty { min-height: 0; }
@media (max-width: 900px), (orientation: portrait) and (max-width: 1280px) {
  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate-art { display: none; }
  .gate-panel { justify-content: flex-start; min-height: 100vh; padding: 36px 22px 40px; }
  .gate-mobile-logo { display: block; text-align: center; padding: 18px 0 8px; }
  .gate-mobile-logo .egp-word { justify-content: center; font-size: 96px; }
  .gate-mobile-logo .egp-tag { font-size: 13px; letter-spacing: 3px; margin-top: 12px; }
  .gate-panel h1 { font-size: 34px; }
}

/* ============================================================ evento */
.event-strip {
  margin: 0 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  font: italic 700 20px/1.2 var(--display); color: var(--ink);
}
.event-strip small { font: 500 15px/1.2 var(--text); color: var(--dim); }
.event-strip.none { color: var(--dim); }

.driver {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
  background: var(--night); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 6px 8px 6px 6px;
}
.driver-num { display: flex; align-items: center; gap: 2px; background: var(--deck-2); border-radius: var(--r-sm); padding: 0 8px; }
.driver-num span { font: italic 800 26px/1 var(--display); color: var(--amber); }
.driver-num input {
  width: 74px; border: 0; background: transparent; padding: 8px 2px; min-height: 48px;
  font: italic 800 30px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.driver-num input::-webkit-outer-spin-button, .driver-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.driver-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.driver-info strong { font: italic 800 22px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver-info small { font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver.empty .driver-info strong { color: var(--faint); font-weight: 700; }
.driver-clear { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--rule); background: transparent; font-size: 22px; line-height: 1; color: var(--dim); flex: none; }
.driver.locked { opacity: .75; }
.driver.locked input, .driver.locked .driver-clear { pointer-events: none; }

.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--night);
}
.event-row.active { border-color: var(--go); }
.event-row h3 { margin: 0; font: italic 800 24px/1.1 var(--display); }
.event-row p { margin: 4px 0 0; color: var(--dim); font-size: 14px; }
.event-row .row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.event-pick { display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--dim); }
.event-pick select { background: var(--deck); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 10px 12px; min-height: 46px; font-weight: 700; max-width: 100%; }
.ghost-btn.danger { color: #ff8a8a; border-color: #5a1d1d; }
.solid-btn.wa { background: #25d366; color: #052e14; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--rule); background: transparent; color: var(--ink); text-decoration: none; font-weight: 700; }
.icon-btn.wa { color: #25d366; border-color: #1c5a35; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
td .acts { display: flex; gap: 6px; }

.ticket-num {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: var(--r-lg); border: 2px solid var(--amber); background: #1d1504;
}
.big-num { display: flex; align-items: baseline; gap: 4px; }
.big-num span { font: italic 900 56px/1 var(--display); color: var(--amber); }
.big-num b { font: italic 900 120px/.85 var(--display); color: var(--ink); }
.ticket-num-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ticket-num-text strong { font: italic 800 30px/1.1 var(--display); }
.ticket-num-text p { margin: 0; color: var(--dim); }

.class-grid, .podium-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.class-card { background: var(--deck); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.class-card header { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.class-card h3 { margin: 0; font: italic 900 34px/1 var(--display); color: var(--amber); }
.class-card header span { color: var(--dim); font-size: 14px; }
.class-card ol { list-style: none; margin: 0; padding: 4px 0; }
.class-card li { display: grid; grid-template-columns: 34px 58px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 9px 16px; }
.class-card li + li { border-top: 1px solid var(--rule); }
.class-card .pos { font: italic 800 20px/1 var(--display); color: var(--faint); }
.class-card .no { font: italic 800 22px/1 var(--display); color: var(--amber); }
.class-card .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.class-card .tm { font: italic 800 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.class-card li.p1 .pos { color: var(--amber); }
.class-card .manual { font-size: 12px; color: var(--dim); margin-left: 6px; }

.rt-hero {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px;
  padding: 18px 22px; border-radius: var(--r-lg); background: linear-gradient(90deg, #0b3a1d, var(--deck) 70%); border: 1px solid #155a30;
}
.rt-hero span { color: var(--dim); font-weight: 600; }
.rt-hero b { font: italic 900 56px/1 var(--display); color: var(--go); font-variant-numeric: tabular-nums; }
.rt-hero strong { font: italic 800 26px/1 var(--display); }
.podium { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 16px; }
.podium .step { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-md); background: var(--night); }
.podium .medal { font: italic 900 30px/1 var(--display); text-align: center; }
.podium .step:nth-child(1) .medal { color: #ffd34d; }
.podium .step:nth-child(2) .medal { color: #c9d3e6; }
.podium .step:nth-child(3) .medal { color: #d98b4a; }
.podium .who { min-width: 0; }
.podium .who b { display: block; font: italic 800 22px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium .who small { color: var(--dim); }
.podium .tm { font: italic 800 26px/1 var(--display); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .big-num b { font-size: 90px; }
  .event-row { grid-template-columns: minmax(0, 1fr); }
  .event-row .row-btns { justify-content: flex-start; }
  .driver-num input { width: 60px; font-size: 26px; }
}

/* categorías del evento */
.class-pick { grid-column: 1 / -1; border: 1px solid var(--rule); border-radius: var(--r-md); padding: 12px 14px 10px; margin: 0; }
.class-pick legend { padding: 0 6px; font-weight: 600; color: var(--dim); font-size: 14px; }
.class-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--night); color: var(--dim);
  font: italic 800 20px/1 var(--display);
}
.chip-check input:checked + span { background: var(--ink); color: var(--night); border-color: var(--ink); }
.chip-check.free input:checked + span { background: var(--amber); border-color: var(--amber); color: #1b1200; }
.chip-check input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.hint-line { margin: 10px 0 0; color: var(--dim); font-size: 14px; }
.tag-done { background: #3a2800; color: var(--amber); }
.mini-btn { padding: 6px 10px; min-height: 36px; font-size: 13px; }
.driver.done strong { color: var(--amber); }
.driver.empty .driver-info strong { white-space: normal; font: 600 16px/1.25 var(--text); color: var(--dim); }

.logo-img { display: block; width: 100%; height: auto; }
.gate .egp-word { transform: none; width: min(100%, 620px); filter: drop-shadow(0 8px 30px rgba(225,15,31,.28)); }
@media (max-width: 900px), (orientation: portrait) and (max-width: 1280px) { .gate-mobile-logo .egp-word { width: min(82%, 340px); margin: 0 auto; } }

/* ---------------------------------------------------- ajustes de pantalla chica */
.bar-right { min-width: 0; }
.event-pick { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.event-pick select { flex: 1 1 200px; min-width: 0; width: 100%; text-overflow: ellipsis; }
.event-row h3, .event-row p, .ticket-num-text strong { overflow-wrap: anywhere; }
.event-row > * { min-width: 0; }
@media (max-width: 380px) {
  .bar-right { gap: 8px; }
  .phase { padding: 6px 10px; font-size: 15px; }
  .bar .lang button { padding: 7px 9px; }
}
@media (max-width: 1000px) {
  .bar { flex-wrap: wrap; }
  .bar-right { flex-wrap: wrap; justify-content: flex-end; }
}
/* nombres largos: hasta 2 líneas en vez de cortarse */
.driver-info strong, .class-card .nm, .podium .who b {
  white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
td.wrap, td.name-cell { white-space: normal; overflow-wrap: anywhere; min-width: 140px; }
@media (max-width: 400px) {
  .driver-info strong { font-size: 19px; }
}

/* ============================================================ sensores */
.points-alert {
  display: block; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-md); text-decoration: none;
  background: #2a1d05; border: 1px solid #6b4a00; color: #ffd78a; font-weight: 600; font-size: 15px;
}
.points-alert.static { margin: 0; }
.sens-link { padding: 10px 14px; border-radius: var(--r-md); font-weight: 600; font-size: 15px; border: 1px solid var(--rule); background: var(--deck); color: var(--dim); }
.sens-link.radio { color: #a8f5c4; border-color: #155a30; background: #0b2616; }
.sens-link.none { color: #ffc9c9; border-color: #7a1f1f; background: #2a0b0b; }
.sens-link.sim { color: #9cd7ff; border-color: #1d4a78; background: #0d2340; }
.sens-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sens-lane .card-head { justify-content: flex-start; }
.pt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pt { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid var(--rule); }
.pt-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-name b { font: italic 800 20px/1.1 var(--display); }
.pt-name em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: 1px; }
.pt-unit { display: grid; grid-template-columns: 12px auto; column-gap: 8px; align-items: center; min-width: 0; }
.pt-unit .dot, .unit-id .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.pt.live .pt-unit .dot, .unit-id .dot.on { background: var(--go); box-shadow: 0 0 8px rgba(47,224,111,.6); }
.pt.live.blocked .pt-unit .dot { background: var(--amber); box-shadow: 0 0 8px rgba(255,178,26,.6); }
.pt-unit strong { font: italic 800 20px/1 var(--display); }
.pt-unit small { grid-column: 2; color: var(--dim); font-size: 13px; }
.pt-unit .none { grid-column: 1 / -1; color: #ff9b9b; font-weight: 600; }
.pt-act small { color: var(--faint); font-size: 13px; }
.pt.off .pt-name b, .pt.off .pt-unit { opacity: .45; }
.pt.off .pt-name b::after { content: " · OFF"; color: var(--stop); }
.ghost-btn.small, .solid-btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.ghost-btn.small.on { border-color: var(--go); color: var(--go); }

.sens-units { display: flex; flex-direction: column; gap: 10px; }
.unit-row {
  display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.2fr) minmax(220px, auto); gap: 8px 16px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--night);
}
.unit-row.offline { border-style: dashed; }
.unit-id { display: grid; grid-template-columns: 12px auto; column-gap: 8px; align-items: center; }
.unit-id strong { font: italic 900 24px/1 var(--display); color: var(--amber); }
.unit-pos { grid-column: 2; font-size: 14px; color: var(--ink); font-weight: 600; }
.unit-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--dim); font-size: 14px; }
.unit-meta .ok { color: var(--go); } .unit-meta .warn { color: var(--amber); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: -2px; }
.bars i { width: 4px; background: var(--rule); border-radius: 1px; }
.bars i:nth-child(1) { height: 4px; } .bars i:nth-child(2) { height: 7px; } .bars i:nth-child(3) { height: 10px; } .bars i:nth-child(4) { height: 14px; }
.bars.b1 i:nth-child(-n+1), .bars.b2 i:nth-child(-n+2), .bars.b3 i:nth-child(-n+3), .bars.b4 i:nth-child(-n+4) { background: var(--go); }
.bars.b1 i:nth-child(-n+1) { background: var(--stop); }
.unit-move { display: flex; gap: 8px; min-width: 0; }
.unit-move select { flex: 1; min-width: 0; background: var(--deck); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-md); padding: 8px 10px; min-height: 40px; font-weight: 600; }
.unit-note { grid-column: 1 / -1; margin: 0; font-weight: 600; font-size: 14px; }
.unit-note.wait { color: var(--amber); } .unit-note.ok { color: var(--go); } .unit-note.bad { color: #ff9b9b; }
@media (max-width: 1100px) {
  .unit-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .unit-move { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .sens-lanes { grid-template-columns: minmax(0, 1fr); }
  .unit-row { grid-template-columns: minmax(0, 1fr); }
  .pt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pt-act { grid-column: 1 / -1; }
  .pt-act .ghost-btn { width: 100%; }
}
.seg button:disabled { opacity: .35; cursor: not-allowed; }

/* login con la marca de un afiliado */
.org-logo-big { display: block; width: 100%; max-width: 420px; max-height: 260px; object-fit: contain; margin: 0 auto; }
.org-name-big { display: block; font: italic 900 clamp(44px, 7vw, 84px)/1 var(--display); color: #fff; overflow-wrap: anywhere; }
.gate-powered { margin: 18px 0 0; text-align: center; font-size: 12px; color: #6e7891; letter-spacing: .4px; }
.egp-tag { white-space: normal; text-align: center; letter-spacing: 3px; }
.gate-foot { font-size: 12px; }
.egp-tag small, .idle-tag small { display: inline-block; margin-top: 8px; font-size: .7em; letter-spacing: 3px; color: var(--rt-red, #e10f1f); }

.gate-lost { margin: 14px 0 0; color: #8b919b; font-size: 13px; }
.idle-note { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255,176,0,.1); border: 1px solid rgba(255,176,0,.45); color: #ffd98a; font-weight: 600; font-size: 14px; }
.idle-note[hidden] { display: none; }

/* categorías del evento: las elegidas llevan ✓ (blanco; Libre en amarillo) y las no incluidas quedan oscuras, para no confundirlas */
.class-checks .chip-check input:checked + span::before { content: "✓ "; font-weight: 900; }
.class-checks .chip-check input:not(:checked) + span { opacity: .55; }
