/* Gramola · Admin — mismo sistema de diseño que el juego: Archivo, papel, tinta y rojo; bordes marcados */
:root {
  --bg: #f3f2f2; --paper: #fff; --ink: #201e1d; --red: #ec3013; --red7: #ae1800; --ok: #1f9d55; --warn: #d98a00;
  --n1: #f7f6f6; --n2: #eae7e7; --n3: #d7d3d3; --n5: #9b9797; --n7: #605d5d;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 'Archivo', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.03em; }
.kicker, .lbl { font-weight: 800; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.lbl { display: block; color: var(--n7); margin: 14px 0 6px; }
.muted { color: var(--n7); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.red-t { color: var(--red); }

/* --- botones y campos */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--ink); background: var(--paper); padding: 7px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red7); border-color: var(--red7); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { border-color: var(--n3); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: 13px; border-width: 1.5px; }
.btn.big { padding: 14px 20px; font-size: 18px; font-weight: 800; width: 100%; margin-top: 18px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; }
.inp, select.inp, textarea.inp { width: 100%; border: 2px solid var(--ink); background: var(--paper); padding: 8px 10px; outline: none; }
.inp:focus { box-shadow: 0 0 0 3px rgba(236, 48, 19, .25); }
.inp.sm { padding: 4px 8px; border-width: 1.5px; width: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* --- entrada */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(440px, 100%); }
.login-logo { width: 190px; display: block; margin-bottom: 40px; }
.login h1 { font-weight: 300; font-size: 64px; line-height: .95; margin: 8px 0 10px; letter-spacing: -.045em; }
.login h1 b { font-weight: 800; color: var(--red); }
.msg { min-height: 1.4em; color: var(--red); font-weight: 600; margin-top: 14px; }

/* --- estructura */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #fff; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 22px 26px; }
.brand img { width: 120px; }
.brand span { font-weight: 800; font-size: 11px; letter-spacing: .14em; background: var(--red); padding: 3px 6px; }
.side nav { display: flex; flex-direction: column; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 22px; text-decoration: none; font-weight: 600; color: #cfcaca; border-left: 4px solid transparent; }
.side nav a i { font-style: normal; font-size: 11px; font-weight: 800; color: var(--n5); width: 18px; }
.side nav a b:empty { display: none; }
.side nav a b { margin-left: auto; font-size: 11px; background: #3a3736; padding: 1px 7px; border-radius: 9px; }
.side nav a b.live { background: var(--red); color: #fff; }
.side nav a:hover { color: #fff; background: #2a2827; }
.side nav a.on { color: #fff; border-left-color: var(--red); background: #2a2827; }
.side-foot { margin-top: auto; padding: 0 22px; display: flex; justify-content: space-between; color: var(--n5); font-size: 12px; }
.view { padding: 30px 40px 80px; min-width: 0; }
.head { display: flex; align-items: flex-end; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.head h1 { font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -.045em; }
.head .sub { color: var(--n7); margin-left: auto; font-weight: 600; }
h2.sec { font-size: 13px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; }
h2.sec::after { content: ''; flex: 1; height: 1px; background: var(--n3); }

/* --- tarjetas y cifras */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--paper); border: 2px solid var(--ink); padding: 14px 16px; }
.kpi .k { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--n7); }
.kpi .v { font-size: 38px; font-weight: 300; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--n7); }
.kpi.hot { background: var(--red); border-color: var(--red); color: #fff; }
.kpi.hot .k, .kpi.hot .s { color: #ffd9d2; }
.card { background: var(--paper); border: 2px solid var(--ink); padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* --- gráfico de barras */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; min-width: 4px; display: flex; flex-direction: column; justify-content: flex-end; position: relative; height: 100%; }
.chart .bar i { display: block; background: var(--ink); min-height: 1px; }
.chart .bar i.b { background: var(--red); }
.chart .bar:hover i { opacity: .75; }
.chart .bar:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11.5px; padding: 3px 7px; white-space: pre; z-index: 3; pointer-events: none; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--n7); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--n7); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; background: var(--ink); margin-right: 5px; vertical-align: -1px; }
.legend i.b { background: var(--red); }

/* --- tablas */
.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border: 2px solid var(--ink); }
.tbl th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--n7); padding: 9px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; position: sticky; top: 0; background: var(--paper); z-index: 1; }
.tbl th.s { cursor: pointer; }
.tbl th.s:hover { color: var(--ink); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--n2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--n1); }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .cov { width: 40px; height: 40px; object-fit: cover; display: block; background: var(--n2); }
.t-title { font-weight: 600; }
.t-art { color: var(--n7); font-size: 13px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border: 1.5px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); } .badge.no { color: var(--n5); } .badge.red { color: var(--red); } .badge.warn { color: var(--warn); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--n3); vertical-align: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(31, 157, 85, .2); }
.dot.sing { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(236, 48, 19, .15); } }
.diff { letter-spacing: 1px; color: var(--red); }

/* --- barra de herramientas */
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tools .inp { max-width: 340px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--n3); background: var(--paper); padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- salas en directo */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.room { background: var(--paper); border: 2px solid var(--ink); }
.room-h { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 2px solid var(--ink); }
.room-code { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.room-meta { font-size: 12.5px; color: var(--n7); line-height: 1.35; }
.room-st { padding: 10px 14px; background: var(--n1); border-bottom: 1px solid var(--n2); font-size: 13.5px; }
.room-st b { font-weight: 800; }
.pl { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--n2); }
.pl-sw { width: 6px; align-self: stretch; }
.pl-ph { width: 34px; height: 34px; object-fit: cover; background: var(--n2); flex: none; }
.pl-ph.none { display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--n5); }
.pl-n { font-weight: 600; }
.pl-x { font-size: 12px; color: var(--n7); }
.vu { width: 60px; height: 6px; background: var(--n2); position: relative; flex: none; }
.vu i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--red); }
.room-a { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px; }
.empty { padding: 40px; text-align: center; color: var(--n7); border: 2px dashed var(--n3); }

/* --- ficha de canción */
.sheet { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: start; }
.cover-big { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border: 2px solid var(--ink); background: var(--n2); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; margin-top: 12px; }
.facts dt { color: var(--n7); }
.facts dd { margin: 0; font-weight: 600; }
.tags { display: grid; grid-template-columns: 170px 1fr 28px; gap: 6px; align-items: center; }
.tags .k { font-weight: 800; font-size: 12px; letter-spacing: .06em; }
.files { font-size: 13px; }
audio { width: 100%; margin: 6px 0; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; max-height: 60vh; overflow: auto; padding: 2px; }
.cv { border: 2px solid var(--n3); background: var(--paper); cursor: pointer; text-align: left; padding: 0; position: relative; }
.cv:hover, .cv.sel { border-color: var(--red); }
.cv img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.cv .t { padding: 6px 8px; font-size: 12px; line-height: 1.3; }
.cv .src { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 2px 5px; background: var(--ink); color: #fff; }
.cv .src.deezer { background: #a238ff; }
.back { margin-bottom: 14px; }

/* --- actividad */
.ev { display: grid; grid-template-columns: 150px 90px 1fr; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--n2); font-size: 13.5px; background: var(--paper); }
.ev .w { color: var(--n7); font-variant-numeric: tabular-nums; }
.k-room { color: #2c6fd6; } .k-player { color: var(--ok); } .k-play { color: var(--red); } .k-admin { color: #8a3ad6; } .k-songs { color: var(--warn); } .k-records { color: #b0006e; }
.evs { border: 2px solid var(--ink); max-height: 70vh; overflow: auto; }

/* --- avisos */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 90vw; }
.toast.err { background: var(--red); }
.modal { position: fixed; inset: 0; background: rgba(32, 30, 29, .55); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal-box { background: var(--bg); border: 2px solid var(--ink); width: min(980px, 100%); max-height: 92vh; overflow: auto; padding: 22px; }
.modal-box h3 { font-size: 26px; font-weight: 300; letter-spacing: -.04em; margin-bottom: 8px; }
.progress { height: 8px; background: var(--n2); margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--red); width: 0; transition: width .2s; }
pre.out { background: var(--ink); color: #eee; padding: 10px; font-size: 12px; white-space: pre-wrap; max-height: 200px; overflow: auto; }

@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr 1fr; } .sheet { grid-template-columns: 220px 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .tools .inp { max-width: none; }
  .kpi .v { font-size: 30px; }
  .side { position: static; height: auto; padding: 12px 0; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .side nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; white-space: nowrap; }
  .side nav a.on { border-bottom-color: var(--red); }
  .side nav a i, .side-foot { display: none; }
  .brand { padding-bottom: 10px; }
  .view { padding: 20px 16px 60px; }
  .grid2, .grid3, .sheet { grid-template-columns: 1fr; }
  .rooms { grid-template-columns: 1fr; }
  .head h1 { font-size: 34px; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
  .tbl .hide-m { display: none; }
}

/* paginación */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.pager .btn.sm { min-width: 34px; }
.pager select.inp.sm { margin-left: 8px; }

/* selección y novedades */
.tbl td.ck, .tbl th.ck { width: 34px; padding-right: 0; cursor: pointer; }
.tbl input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; vertical-align: middle; }
.tbl tr.picked td { background: #fff3f0; }
.selbar { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--ink); color: #fff; padding: 10px 14px; margin-bottom: 10px; }
.selbar .btn.sm:not(.red) { background: transparent; color: #fff; border-color: #fff; }
.selbar .link { color: #ddd; margin-left: auto; }
#c-nn { font-weight: 600; }
.tbl .lang { width: 52px; text-align: center; padding-left: 4px; padding-right: 4px; }
.tbl .when { white-space: nowrap; min-width: 140px; }
.aviso-fijo { position: fixed; right: 20px; top: 20px; z-index: 45; display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 12px 14px 12px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.3); font-weight: 600; max-width: min(560px, calc(100vw - 40px)); }
.aviso-fijo + .aviso-fijo { top: 84px; }
.aviso-fijo .link { color: #ccc; }
