/* ==========================================================================
   pages-admin.css — RESERVADO (placeholder)
   Dueño: el agente de la fase siguiente que ajusta las paginas propias del
   panel de admin (/bans, /keys, /servers, /users, /config, /logs...).
   Se carga despues de glass.css, dashboard.css y pages-panel.css.
   Usar selectores con alcance de pagina para no filtrar estilos a otras.
   ========================================================================== */

/* ==========================================================================
   /users: tabla de permisos por seccion (views/partials/perm-matrix.ejs)
   ========================================================================== */
.perm-box { display: flex; flex-direction: column; gap: 12px; }
.perm-box .field { margin: 0; }
.perm-owner-note { padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); background: var(--accent-soft, rgba(255, 57, 71, 0.1)); border: 1px solid rgba(255, 57, 71, 0.25); }
.perm-owner-note[hidden], .perm-table[hidden] { display: none; }
.perm-table { display: flex; flex-direction: column; gap: 6px; }
.perm-group-title { margin-top: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.perm-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.08)); background: rgba(255, 255, 255, 0.025);
}
.perm-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 200px; font-size: 14px; font-weight: 600; color: var(--text); }
.perm-name small { font-size: 12px; font-weight: 400; color: var(--muted-2); overflow-wrap: anywhere; }
.perm-sensitive { align-self: flex-start; margin-top: 2px; }
.perm-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.08)); }
.perm-opt { position: relative; margin: 0; cursor: pointer; }
.perm-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.perm-opt span { display: inline-block; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.perm-opt input:checked + span { color: #fff; background: rgba(255, 255, 255, 0.12); }
.perm-opt-view input:checked + span { background: rgba(94, 200, 255, 0.22); color: #d6f1ff; }
.perm-opt-manage input:checked + span { background: linear-gradient(135deg, #ff3947 0%, #a01a26 100%); color: #fff; }
.perm-opt input:focus-visible + span { outline: 2px solid #ff6b75; outline-offset: 1px; }
html[data-theme="light"] .perm-row { background: #fff; border-color: #e7e3dc; }
html[data-theme="light"] .perm-seg { background: #f1efea; border-color: #e7e3dc; }
html[data-theme="light"] .perm-opt input:checked + span { color: #18181b; background: #e4e0d8; }
html[data-theme="light"] .perm-opt-view input:checked + span { background: #d8efff; color: #0b4a6e; }
@media (max-width: 520px) { .perm-seg { width: 100%; } .perm-opt { flex: 1 1 0; } .perm-opt span { width: 100%; text-align: center; padding: 7px 4px; } }
/* resumen de permisos en la tabla de admins */
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 420px; }
.perm-chip { font-size: 11px; padding: 2px 8px; border-radius: 9999px; border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.1)); color: var(--muted); }
.perm-chip.is-manage { color: #ffb3b9; border-color: rgba(255, 57, 71, 0.35); }
/* contraseña temporal recien creada (se muestra una vez) */
.temp-pass { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.temp-pass code { font-size: 18px; letter-spacing: 0.06em; padding: 6px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); color: #fff; user-select: all; }
html[data-theme="light"] .temp-pass code { background: #f1efea; color: #18181b; }
/* solo lectura */
.wv-readonly-banner { margin-bottom: 16px; }

/* ==========================================================================
   Efectos de temporada (views/effects.ejs)
   ========================================================================== */
.fx-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.fx-main > .btn { margin-bottom: 18px; }
.fx-side { position: sticky; top: 90px; }
@media (max-width: 1100px) { .fx-layout { grid-template-columns: minmax(0, 1fr); } .fx-side { position: static; } }

.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.fx-card { position: relative; display: block; cursor: pointer; }
.fx-card input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fx-card-body {
  display: flex; align-items: flex-start; gap: 10px; height: 100%;
  padding: 12px; border-radius: 12px;
  border: 1px solid var(--g-border, rgba(255, 255, 255, 0.09));
  background: var(--g-subtle, rgba(255, 255, 255, 0.03));
  transition: border-color 0.15s ease, background 0.15s ease;
}
.fx-card:hover .fx-card-body { border-color: var(--g-border-bright, rgba(255, 255, 255, 0.22)); }
.fx-card input:checked + .fx-card-body { border-color: rgba(255, 57, 71, 0.65); background: rgba(255, 57, 71, 0.09); box-shadow: inset 0 0 0 1px rgba(255, 57, 71, 0.35); }
.fx-card input:focus-visible + .fx-card-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-card-icon {
  flex-shrink: 0; display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--g-border, rgba(255, 255, 255, 0.09));
  background: var(--g-subtle, rgba(255, 255, 255, 0.03));
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.fx-card-icon svg { width: 16px; height: 16px; }
.fx-card:hover .fx-card-icon { color: var(--text); }
.fx-card input:checked + .fx-card-body .fx-card-icon { color: var(--accent); border-color: rgba(255, 57, 71, 0.35); background: rgba(255, 57, 71, 0.1); }
.fx-card-text { min-width: 0; }
.fx-card-text strong { display: block; font-size: 13px; color: var(--text); }
.fx-card-text small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

.fx-intensity { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.fx-intensity-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fx-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--g-border, rgba(255, 255, 255, 0.09)); background: var(--g-subtle, rgba(255, 255, 255, 0.03)); }
.fx-seg label { position: relative; cursor: pointer; }
.fx-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fx-seg span { display: block; padding: 6px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background 0.15s ease, color 0.15s ease; }
.fx-seg label:hover span { color: var(--text); }
.fx-seg input:checked + span { background: rgba(255, 57, 71, 0.16); color: var(--text); }
.fx-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Vista previa: mini panel oscuro con el efecto encima */
.fx-preview { position: relative; height: 280px; overflow: hidden; border-radius: 12px; background: #060505; border: 1px solid rgba(255, 255, 255, 0.08); }
.fx-preview-mock { position: absolute; inset: 0; z-index: 0; }
.fx-preview-mock span { position: absolute; display: block; border-radius: 6px; }
.fx-mock-side { left: 0; top: 0; bottom: 0; width: 22%; border-radius: 0 !important; border-right: 1px solid #161515; background: radial-gradient(130% 34% at 0% 100%, rgba(255, 57, 71, 0.06), transparent 72%), #060505; }
.fx-mock-top { left: 22%; right: 0; top: 0; height: 30px; border-radius: 0 !important; border-bottom: 1px solid #161515; }
.fx-mock-title { left: 28%; top: 48px; width: 32%; height: 12px; background: #1c1b1b; }
.fx-mock-card { background: #0b0a0a; border: 1px solid #1c1b1b; }
.fx-mock-a { left: 28%; right: 6%; top: 76px; height: 70px; border-radius: 10px !important; }
.fx-mock-b { left: 28%; width: 31%; top: 158px; height: 96px; border-radius: 10px !important; }
.fx-mock-c { left: 63%; right: 6%; top: 158px; height: 96px; border-radius: 10px !important; }

/* ==========================================================================
   Dashboard admin: tarjetas "ultimos 7 dias" (views/dashboard.ejs)
   Tarjeta 1: total + variacion + barras verticales (rectangulares) por accion.
   Tarjeta 2: jugadores detectados + checks mas detectados en barras
   segmentadas. Mismos tonos en las dos (rojo, naranja, amarillo, verde, azul).
   ========================================================================== */
.adash-grid { align-items: stretch; }
.adash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* (0,3,0)+ para ganarle a panel-flat.css `.wave-body.wave-app .wave-section { margin-bottom: 16px }`:
   si no, cada tarjeta suma su margen al gap de la columna (doble espacio). */
.wave-body.wave-app .adash-col > .wave-section,
.wave-body.wave-app .adash-grid > .wave-section { margin-bottom: 0; }
.wave-body.wave-app .adash-grid { gap: 16px; margin-bottom: 16px; }
.adash-col > .sev-card { flex: 1 1 auto; display: flex; flex-direction: column; }
.sev-card > .sev-body { flex: 1 1 auto; }

/* --c / --c2: color de la barra. --ct: texto de ese tono sobre fondo claro (tema claro). */
.sev-ban { --c: #ff3947; --c2: #ff737c; --ct: #c81e2b; }
.sev-kick { --c: #ff7a1a; --c2: #ffa05a; --ct: #b0440a; }
.sev-warn { --c: #ffc53d; --c2: #ffd977; --ct: #855600; }
.sev-logged { --c: #34c759; --c2: #67dd88; --ct: #15803d; }
.sev-ignored { --c: #3b82f6; --c2: #72a6ff; --ct: #1d4ed8; }

/* Total + variacion */
.sev-total { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sev-total strong {
  font-size: 40px; font-weight: 700; line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sev-delta {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px; font-weight: 700; line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.sev-delta.is-up { color: #ff737c; background: rgba(255, 57, 71, 0.12); border-color: rgba(255, 57, 71, 0.26); }
.sev-delta.is-down { color: #4ade80; background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.24); }
.sev-delta.is-flat,
.sev-delta.is-new { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: var(--border); }
.sev-sub { margin: 6px 0 0; font-size: 12.5px; color: var(--muted-2); }

/* Tarjeta 1: barras verticales */
.sev-body { display: flex; flex-direction: column; }
.sev-bars {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  min-height: 220px;
  margin-top: 22px;
}
.sev-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.sev-tube {
  position: relative;
  flex: 1 1 auto;
  width: 100%; max-width: 74px;
  min-height: 150px;
  border-radius: 4px; /* casi recto (a pedido: barras rectangulares, no capsulas) */
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.045) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.sev-pct {
  position: absolute; top: 9px; left: 10px; z-index: 1;
  font-size: 12px; font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sev-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  /* 30px reservados arriba para el % (si no, una barra de ~90% lo tapa). La escala sigue lineal. */
  height: calc((100% - 30px) * var(--p, 0));
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c2) 0%, var(--c) 70%);
  animation: sevGrow 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sevGrow { from { height: 0; } }
.sev-label {
  max-width: 100%;
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sev-count { margin-top: -6px; font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* Tarjeta 2: filas con barra segmentada */
.seg-list { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
/* Columnas fijas: todas las filas quedan alineadas (dot | nombre | barra | %) */
.seg-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 190px) minmax(0, 1fr) 56px;
  align-items: center;
  gap: 12px;
}
.seg-dot {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0 6px, transparent 7px), rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.seg-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.seg-name strong { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-name small { font-size: 11.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-bar {
  position: relative;
  height: 18px;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.11) 0 3px, transparent 3px 6px);
}
.seg-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: var(--w, 0%);
  background-image: repeating-linear-gradient(90deg, var(--c) 0 3px, transparent 3px 6px);
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.55), #000 80%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.55), #000 80%);
  animation: segGrow 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes segGrow { from { width: 0; } }
.seg-pct {
  min-width: 48px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--c);
  font-size: 12px; font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Tema claro */
html[data-theme="light"] .sev-tube { background: linear-gradient(180deg, rgba(0, 0, 0, 0.075), rgba(0, 0, 0, 0.04)); box-shadow: none; }
html[data-theme="light"] .seg-bar { background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 3px, transparent 3px 6px); }
html[data-theme="light"] .seg-dot { background: radial-gradient(circle, var(--c) 0 6px, transparent 7px), rgba(0, 0, 0, 0.05); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .sev-delta.is-flat,
html[data-theme="light"] .sev-delta.is-new { background: rgba(0, 0, 0, 0.04); }
/* Los tonos claros (amarillo, rosa, verde) no se leen sobre blanco: texto mas oscuro */
html[data-theme="light"] .sev-delta.is-up { color: #c81e2b; }
html[data-theme="light"] .sev-delta.is-down { color: #15803d; }
html[data-theme="light"] .seg-pct { color: var(--ct, var(--c)); }

/* color-mix con var() siempre "parsea", asi que el respaldo de arriba solo
   sirve si el mix va dentro de @supports. */
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .seg-pct { border-color: color-mix(in srgb, var(--c) 38%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); }
}

/* Segun el ancho de la TARJETA (no de la pantalla): entre 901 y 1279 px, con la
   barra lateral fija, cada tarjeta mide 350-480 px y la barra de los checks
   quedaba en 0 px. */
.sev-body, .seg-card > .wave-section-body { container-type: inline-size; }
@container (max-width: 420px) {
  .seg-row { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "dot name pct" "bar bar bar"; row-gap: 8px; }
  .seg-dot { grid-area: dot; }
  .seg-name { grid-area: name; }
  .seg-pct { grid-area: pct; }
  .seg-bar { grid-area: bar; }
  .sev-bars { gap: 6px; }
  .sev-label { max-width: calc(100% + 6px); font-size: 10px; letter-spacing: -0.02em; }
}

/* Actividad: misma altura que la columna izquierda y con scroll adentro (sin franja vacia). */
@media (min-width: 901px) {
  .wave-body.wave-app .adash-grid > .wave-section { display: flex; flex-direction: column; contain: size; }
  .wave-body.wave-app .adash-grid > .wave-section > .wave-section-body { flex: 1 1 0; min-height: 0; overflow-y: auto; }
}
@media (max-width: 900px) {
  .adash-grid .wave-activity-row:nth-child(n+13) { display: none; }
}

/* Celular */
@media (max-width: 640px) {
  .sev-total strong { font-size: 34px; }
  .sev-bars { gap: 6px; min-height: 190px; }
  .sev-label { font-size: 10px; letter-spacing: -0.02em; }
  .seg-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "dot name pct" "bar bar bar";
    row-gap: 8px;
  }
  .seg-dot { grid-area: dot; }
  .seg-name { grid-area: name; }
  .seg-pct { grid-area: pct; }
  .seg-bar { grid-area: bar; }
}

@media (prefers-reduced-motion: reduce) {
  .sev-fill, .seg-fill { animation: none; }
}

/* ==========================================================================
   Clientes: acciones por cuenta y "Eliminar" con confirmacion escrita
   (views/accounts.ejs). El cuadro se abre DENTRO de la celda: un popup
   absoluto lo recortaria el scroll horizontal de la tabla.
   ========================================================================== */
.acc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.acc-actions form { margin: 0; }
.acc-delete > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.acc-delete > summary::-webkit-details-marker { display: none; }
.acc-delete > summary svg { width: 13px; height: 13px; flex: none; }
.acc-delete[open] { flex-basis: 100%; }
.acc-delete-form {
  display: grid; gap: 8px;
  width: min(320px, 100%);
  margin-top: 8px; padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 57, 71, 0.34);
  background: rgba(255, 57, 71, 0.06);
}
.acc-delete-form p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--pf-text-2, #a1a1aa); white-space: normal; }
.acc-delete-form input[type="text"] { width: 100%; }
.acc-delete-form .btn { justify-self: start; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }