:root {
  --bg: #0f1420;
  --bg-2: #161d2c;
  --bg-3: #1e2739;
  --line: #2b3548;
  --txt: #e8edf6;
  --txt-2: #9aa8c0;
  --acc: #4f8cff;
  --acc-2: #35d18b;
  --warn: #ffb340;
  --err: #ff6b6b;
  --radio: 10px;
  --fuente: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--fuente);
  font-size: 14px;
}

a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- cabecera -- */

header.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

header.top h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  letter-spacing: .2px;
}

header.top .marca {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  display: grid; place-items: center;
  font-weight: 700; color: #0b1020;
}

nav.tabs { margin-left: auto; display: flex; gap: 8px; }

nav.tabs a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--txt-2);
  border: 1px solid transparent;
}
nav.tabs a:hover { color: var(--txt); text-decoration: none; background: var(--bg-3); }
nav.tabs a.activo { color: var(--txt); background: var(--bg-3); border-color: var(--line); }

/* ---------------------------------------------------------------- layout -- */

main { padding: 22px; max-width: 1500px; margin: 0 auto; }

.grid { display: grid; gap: 18px; }
.grid.dos { grid-template-columns: 380px 1fr; align-items: start; }
.grid.tres { grid-template-columns: 300px 1fr 320px; align-items: start; }

@media (max-width: 1100px) {
  .grid.dos, .grid.tres { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--txt-2);
  font-weight: 600;
}

.fila { display: flex; gap: 10px; align-items: center; }
.fila.wrap { flex-wrap: wrap; }
.crecer { flex: 1; min-width: 0; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------------------------------------------------------- formularios -- */

label.campo { display: block; margin-bottom: 12px; }
label.campo > span {
  display: block;
  font-size: 12px;
  color: var(--txt-2);
  margin-bottom: 5px;
}

input[type="text"], input[type="date"], input[type="time"], input[type="number"],
select, textarea {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--acc);
}
input[type="color"] {
  width: 42px; height: 34px; padding: 2px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 8px;
}
textarea { resize: vertical; min-height: 60px; }

button {
  background: var(--bg-3);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
button:hover { border-color: var(--acc); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.pri { background: var(--acc); border-color: var(--acc); color: #08101f; font-weight: 600; }
button.pri:hover { filter: brightness(1.1); }
button.ok { background: var(--acc-2); border-color: var(--acc-2); color: #06180f; font-weight: 600; }
button.peligro { color: var(--err); border-color: #4a2731; }
button.peligro:hover { background: #3a1d25; border-color: var(--err); }
button.mini { padding: 4px 8px; font-size: 12px; }

.check {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
}
.check:hover { background: var(--bg-3); }
.check input { width: 16px; height: 16px; accent-color: var(--acc); }

/* ---------------------------------------------------------------- listas -- */

.lista { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }

.item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid transparent;
}
.item:hover { border-color: var(--line); }
.item img { width: 34px; height: 34px; object-fit: contain; background: #0a0e17; border-radius: 6px; }
.item .nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

.torneo {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radio);
  padding: 14px;
  cursor: pointer;
}
.torneo:hover { border-color: var(--acc); }
.torneo.activo { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc) inset; }
.torneo h3 { margin: 0 0 8px; font-size: 15px; }
.torneo .meta { color: var(--txt-2); font-size: 12px; line-height: 1.6; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--txt-2);
}
.pill.si { color: var(--acc-2); border-color: #1f4636; }
.pill.no { color: var(--warn); border-color: #4a3a1c; }

/* --------------------------------------------------------------- editor -- */

.editor-lienzo {
  position: relative;
  margin: 0 auto;
  background: #0a0e17 repeating-conic-gradient(#141a27 0% 25%, #0f141f 0% 50%) 50% / 22px 22px;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.editor-lienzo img.base { display: block; width: 100%; height: auto; pointer-events: none; }

.caja {
  position: absolute;
  border: 2px solid rgba(79, 140, 255, .9);
  background: rgba(79, 140, 255, .12);
  cursor: move;
}
.caja[data-grupo="texto"] { border-color: rgba(53, 209, 139, .9); background: rgba(53, 209, 139, .12); }
.caja.sel { box-shadow: 0 0 0 2px #fff inset; z-index: 5; }
.caja .etiqueta {
  position: absolute;
  top: -20px; left: -2px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px 5px 0 0;
  background: rgba(79, 140, 255, .9);
  color: #06101f;
  white-space: nowrap;
}
.caja[data-grupo="texto"] .etiqueta { background: rgba(53, 209, 139, .9); }
.caja .tirador {
  position: absolute;
  right: -6px; bottom: -6px;
  width: 12px; height: 12px;
  border-radius: 3px;
  background: #fff;
  cursor: nwse-resize;
}
.caja.oculta { opacity: .3; border-style: dashed; }

.numeros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------------------------------------------------------- avisos -- */

#avisos {
  position: fixed;
  right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 100;
  max-width: 380px;
}
.aviso {
  padding: 11px 14px;
  border-radius: 9px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  animation: entrar .18s ease-out;
}
.aviso.ok { border-color: #1f4636; }
.aviso.err { border-color: #4a2731; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }

.vacio { color: var(--txt-2); font-size: 13px; padding: 10px 2px; }

.cargando { opacity: .55; pointer-events: none; }

.zona-drop {
  border: 1.5px dashed var(--line);
  border-radius: 9px;
  padding: 16px;
  text-align: center;
  color: var(--txt-2);
  cursor: pointer;
  font-size: 13px;
}
.zona-drop:hover, .zona-drop.encima { border-color: var(--acc); color: var(--txt); }

.previa {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0a0e17;
  display: block;
}
