/* Musicbot — consola de control
   Superficies de aluminio neutro + un solo acento ambar ("al aire").
   Barlow para la interfaz, Barlow Semi Condensed para titulos, IBM Plex Mono solo para datos tecnicos. */

:root {
  --housing: #e1e5e3;
  --panel: #f3f5f4;
  --screen: #ffffff;
  --sunken: #e9ecea;
  --ink: #141a17;
  --ink-2: #48524d;
  --ink-3: #66706b;
  --line: #cfd5d2;
  --line-2: #b6bfba;
  --amber: #f2a900;
  --amber-hi: #ffbd1f;
  --on-amber: #1b1300;
  --amber-text: #7f5300;
  --amber-wash: #fff3d1;
  --live: #137c45;
  --err: #b8281a;
  --err-wash: #fbe7e4;
  --warn: #8c5800;
  --warn-wash: #fbf0d9;
  --focus: #141a17;
  --shadow: 0 1px 0 rgba(20, 26, 23, .06), 0 8px 24px rgba(20, 26, 23, .08);
  --groove: rgba(20, 26, 23, .07);

  --ui: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --r: 6px;
  --rail: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --housing: #121514;
    --panel: #1a1e1c;
    --screen: #212624;
    --sunken: #171a19;
    --ink: #e8ecea;
    --ink-2: #aab3ae;
    --ink-3: #8b948f;
    --line: #2d3330;
    --line-2: #3d4541;
    --amber: #f2b01e;
    --amber-hi: #ffc443;
    --amber-text: #f2b01e;
    --amber-wash: #2e2610;
    --live: #45c784;
    --err: #f0705d;
    --err-wash: #3a1d19;
    --warn: #e6a640;
    --warn-wash: #33280f;
    --focus: #e8ecea;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .45);
    --groove: rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --housing: #121514;
  --panel: #1a1e1c;
  --screen: #212624;
  --sunken: #171a19;
  --ink: #e8ecea;
  --ink-2: #aab3ae;
  --ink-3: #8b948f;
  --line: #2d3330;
  --line-2: #3d4541;
  --amber: #f2b01e;
  --amber-hi: #ffc443;
  --amber-text: #f2b01e;
  --amber-wash: #2e2610;
  --live: #45c784;
  --err: #f0705d;
  --err-wash: #3a1d19;
  --warn: #e6a640;
  --warn-wash: #33280f;
  --focus: #e8ecea;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .45);
  --groove: rgba(255, 255, 255, .05);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--housing);
  color: var(--ink);
  font: 400 15px/1.45 var(--ui);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden], .hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* ---------------------------------------------------------------- controles */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--screen); color: var(--ink);
  font-weight: 500; font-size: 14px; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--on-amber); font-weight: 600; }
.btn.primary:hover { background: var(--amber-hi); border-color: var(--amber-hi); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.block { width: 100%; }
.ib {
  width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none;
  border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--ink-2); cursor: pointer;
}
.ib:hover { background: var(--sunken); color: var(--ink); }
.ib:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
.ib.danger:hover { color: var(--err); }

.input, .select {
  height: 36px; width: 100%; padding: 0 11px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--screen); color: var(--ink); outline: none;
}
.input::placeholder { color: var(--ink-3); }
.input:focus, .select:focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:disabled, .select:disabled { opacity: .5; cursor: not-allowed; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--amber); margin: 0; flex: none; }
input[type="range"] { accent-color: var(--amber); }
input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--ink-2); }

/* pestañas subrayadas */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px 9px; border: 0; background: none;
  color: var(--ink-2); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--amber); }
.tab .n { font-size: 12px; color: var(--ink-3); }

.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- caratula */
.art {
  position: relative; display: block; flex: none; overflow: hidden; border-radius: 4px;
  background-color: var(--sunken);
  background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0 3px, var(--groove) 3px 4px);
  color: var(--ink-3); border: 1px solid var(--line);
}
.art::after { /* sello central del "disco" */
  content: ''; position: absolute; left: 50%; top: 50%; width: 26%; height: 26%; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--panel); border: 1px solid var(--line-2);
}
.art[data-k="auto"]::after { background: var(--amber-wash); border-color: var(--amber); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.art.s { width: 34px; height: 34px; border-radius: 3px; }

/* ---------------------------------------------------------------- acceso */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate-box { width: 100%; max-width: 380px; }
.gate-box .mark { margin-bottom: 28px; }
.gate-box h1 { font: 600 26px/1.15 var(--display); margin: 0 0 6px; }
.gate-box p { color: var(--ink-2); margin: 0 0 20px; }
.gate-box .field + .field { margin-top: 12px; }
.gate-box .btn { height: 40px; }
.btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.discord:hover { background: #4752c4; border-color: #4752c4; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-err { color: var(--err); font-size: 13.5px; min-height: 20px; margin-top: 10px; }

.mark { display: inline-flex; align-items: center; gap: 10px; font: 600 19px/1 var(--display); letter-spacing: .01em; color: var(--ink); text-decoration: none; }
.mark svg { width: 26px; height: 26px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.rail {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 12px 12px;
  border-right: 1px solid var(--line); background: var(--housing); min-height: 0;
}
.rail .mark { padding: 2px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: var(--r);
  background: none; color: var(--ink-2); font-weight: 500; cursor: pointer; text-align: left;
}
.nav button:hover { background: var(--panel); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--panel); color: var(--ink); box-shadow: inset 3px 0 0 var(--amber); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.botcard, .usercard { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border-radius: var(--r); }
.usercard { grid-template-columns: 32px minmax(0, 1fr); row-gap: 4px; }
.usercard .uacts { grid-column: 2; display: flex; gap: 2px; margin-left: -7px; }
.botcard { background: var(--panel); border: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--sunken); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 13px; overflow: hidden; color: var(--ink-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who { min-width: 0; }
.who b { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.lamp.on { background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 22%, transparent); }
.lamp.air { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 28%, transparent); }
.lamp.warn { background: var(--warn); }
.lamp.err { background: var(--err); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }

/* barra de contexto: servidor · canal · conexion · bot */
.ctx {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 20px; min-height: 58px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.ctx-guild { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gicon { width: 30px; height: 30px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 13px; overflow: hidden; flex: none; }
.gicon img { width: 100%; height: 100%; object-fit: cover; }
.ctx-guild .gname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.ctx-guild .select { height: 32px; width: auto; max-width: 220px; font-weight: 600; }
.ctx-sep { width: 1px; height: 24px; background: var(--line); }
.ctx-voice { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ctx-voice .select { height: 32px; width: auto; min-width: 180px; max-width: 280px; }
.ctx-voice .btn { height: 32px; }
.ctx-status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.ctx-status b { color: var(--ink); font-weight: 600; }
.ctx-bot { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ctx-bot .select { height: 32px; width: auto; min-width: 180px; }
.ctx h1 { font: 600 20px/1.2 var(--display); margin: 0; }

.view { flex: 1; min-height: 0; display: flex; }

/* ---------------------------------------------------------------- reproductor */
.player { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.col + .col { border-left: 1px solid var(--line); }
.mod-h { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 50px; flex: none; }
.mod-h h2 { font: 600 16px/1.2 var(--display); margin: 0; display: flex; align-items: baseline; gap: 8px; }
.mod-h h2 small { font: 400 13px var(--ui); color: var(--ink-2); }
.mod-h .acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.deck { padding: 22px 20px 18px; border-bottom: 1px solid var(--line); flex: none; }
.deck-top { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 20px; align-items: start; }
.deck .art.big { width: 148px; height: 148px; border-radius: 6px; }
.deck-title {
  font: 600 29px/1.08 var(--display); margin: 2px 0 10px; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.deck.idle .deck-title { color: var(--ink-3); }
.deck-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--ink-2); }
.deck-meta span { display: inline-flex; align-items: center; gap: 6px; }
.deck-meta a { color: var(--amber-text); font-weight: 500; text-decoration: none; }
.deck-meta a:hover { text-decoration: underline; }
.state-word { font-weight: 600; color: var(--ink); }
.state-word.air { color: var(--amber-text); }

/* regla de tiempo: marcas cada minuto calculadas desde la duracion real */
.ruler { margin-top: 20px; }
.ruler-bar {
  position: relative; height: 22px; cursor: default; touch-action: none;
}
.ruler-bar .rail-line { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--line); }
.ruler-bar .ticks { position: absolute; left: 0; right: 0; top: 16px; height: 6px;
  background-image: linear-gradient(to right, var(--line-2) 1px, transparent 1px); background-repeat: repeat-x; background-size: var(--tick, 25%) 6px; }
.ruler-bar .fill { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--ink); width: 0; }
.ruler-bar .head { position: absolute; top: 4px; width: 3px; height: 14px; border-radius: 2px; background: var(--amber); left: 0; transform: translateX(-1px); }
.ruler-bar.seekable { cursor: pointer; }
.ruler-bar .hover-t { position: absolute; top: -22px; transform: translateX(-50%); padding: 1px 6px; border-radius: 4px; background: var(--ink); color: var(--panel); font: 500 12px var(--mono); pointer-events: none; display: none; }
.ruler-bar.seekable:hover .hover-t { display: block; }
.timecode { display: flex; justify-content: space-between; margin-top: 4px; font: 500 13px var(--mono); color: var(--ink-2); }
.timecode .now { color: var(--ink); }

.transport { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tp { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--screen); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.tp:hover { border-color: var(--ink-3); }
.tp:disabled { opacity: .38; cursor: not-allowed; }
.tp.play { width: 54px; height: 54px; background: var(--amber); border-color: var(--amber); color: var(--on-amber); }
.tp.play:hover:not(:disabled) { background: var(--amber-hi); border-color: var(--amber-hi); }
.tp.play .i { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.tp-sep { flex: 1; min-width: 8px; }
.modes { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.modes .btn[aria-pressed="true"] { border-color: var(--amber); background: var(--amber-wash); color: var(--amber-text); }
.modes-lbl { font-size: 13.5px; color: var(--ink-2); margin-left: 6px; }
.modes .select { height: 28px; width: auto; font-size: 13.5px; padding-left: 8px; }
.vol { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.vol input { width: 140px; }
.vol output { font: 500 12.5px var(--mono); width: 34px; text-align: right; color: var(--ink); }

.note { margin-top: 14px; padding: 9px 12px; border-left: 3px solid var(--line-2); background: var(--sunken); color: var(--ink-2); font-size: 13.5px; border-radius: 0 var(--r) var(--r) 0; }
.note b { color: var(--ink); }

/* ---------------------------------------------------------------- listas */
.scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.rows { list-style: none; margin: 0; padding: 0 8px 12px; }
.row {
  display: grid; grid-template-columns: 26px 34px minmax(0, 1fr) 52px var(--acts, 96px); align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 10px; border-radius: var(--r);
}
.row.noidx { grid-template-columns: 34px minmax(0, 1fr) 52px var(--acts, 96px); }
/* ancho fijo de acciones por lista: las duraciones quedan alineadas aunque cambien los permisos */
#ytResults { --acts: 64px; } #plList { --acts: 128px; } #plTracks, #topList, #histList { --acts: 32px; } #bkList { --acts: 96px; }
.row .acts { justify-content: flex-end; }
.row .dur { text-align: right; }
.row:hover, .row:focus-within { background: var(--sunken); }
.row .idx { font: 500 12px var(--mono); color: var(--ink-3); text-align: right; }
.row .t { min-width: 0; }
.row .t b { display: block; font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t span { display: block; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t span.mine { color: var(--amber-text); }
.row .dur { font-size: 13px; color: var(--ink-2); padding-left: 6px; }
.row .acts { display: flex; gap: 2px; opacity: 0; }
.row:hover .acts, .row:focus-within .acts { opacity: 1; }
@media (hover: none) { .row .acts { opacity: 1; } }
.empty { padding: 28px 20px; color: var(--ink-2); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

.queue-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* fuentes (agregar musica) */
.src { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.src .tabs { padding: 0 12px; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-tools { padding: 14px 20px 10px; display: flex; flex-direction: column; gap: 10px; flex: none; }
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar .input { flex: 1; min-width: 160px; }
.hint { font-size: 13px; color: var(--ink-2); margin: 0; }
.sub-h { font: 600 14px var(--display); color: var(--ink-2); padding: 14px 18px 4px; margin: 0; }

.drop {
  margin: 4px 20px 0; border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 28px 16px; text-align: center; cursor: pointer;
  color: var(--ink-2); background: var(--screen); display: block;
}
.drop:hover, .drop.over { border-color: var(--amber); background: var(--amber-wash); color: var(--ink); }
.drop b { display: block; color: var(--ink); font-weight: 600; margin: 6px 0 2px; }
.upbar { margin: 12px 20px 0; }
.meter { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--amber); }

/* estados de "sin bot" */
.standby { flex: 1; display: grid; place-items: center; padding: 32px 20px; }
.standby-box { max-width: 460px; }
.standby-box h2 { font: 600 24px/1.2 var(--display); margin: 10px 0 6px; }
.standby-box p { color: var(--ink-2); margin: 0 0 18px; }
.standby-box .bar { gap: 10px; }

/* ---------------------------------------------------------------- configuracion */
.cfg { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.subnav { border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.subnav button { text-align: left; height: 36px; padding: 0 12px; border: 0; border-radius: var(--r); background: none; color: var(--ink-2); font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 9px; }
.subnav button:hover { background: var(--sunken); color: var(--ink); }
.subnav button[aria-current="true"] { color: var(--ink); background: var(--screen); box-shadow: inset 3px 0 0 var(--amber); }
.cfg-body { min-height: 0; overflow: auto; }
.cfg-sec { padding: 20px 24px 40px; max-width: 980px; }
.cfg-sec > header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.cfg-sec > header h2 { font: 600 22px/1.2 var(--display); margin: 0 0 4px; }
.cfg-sec > header p { margin: 0; color: var(--ink-2); max-width: 64ch; }
.cfg-sec > header .acts { margin-left: auto; display: flex; gap: 8px; flex: none; }

.bots { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--screen); min-height: 420px; }
.botlist { border-right: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; align-self: start; }
.botlist button { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px; border: 0; border-radius: var(--r); background: none; text-align: left; cursor: pointer; }
.botlist button:hover { background: var(--sunken); }
.botlist button[aria-current="true"] { background: var(--sunken); box-shadow: inset 3px 0 0 var(--amber); }
.botlist .st { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.editor { min-width: 0; display: flex; flex-direction: column; }
.ed-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-head .who b { font-size: 17px; }
.ed-head .acts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.ed-alert { margin: 14px 20px 0; padding: 10px 12px; border-radius: var(--r); background: var(--err-wash); color: var(--err); font-size: 14px; }
.ed-alert.warn { background: var(--warn-wash); color: var(--warn); }
.group { padding: 18px 20px 6px; }
.group + .group { border-top: 1px solid var(--line); }
.group h3 { font: 600 15px var(--display); margin: 0 0 10px; color: var(--ink); }
.fld { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 6px 18px; padding: 10px 0 10px 12px; margin-left: -12px; border-left: 3px solid transparent; }
.fld > label, .fld > .lbl { font-weight: 500; font-size: 14px; padding-top: 8px; }
.fld .ctl { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fld .ctl .row-ctl { display: flex; gap: 8px; align-items: center; }
.fld .ctl .row-ctl .select, .fld .ctl .row-ctl .input { flex: 1; }
.fld small { font-size: 12.5px; color: var(--ink-2); }
.fld .was { display: none; font-size: 12.5px; color: var(--amber-text); }
.fld.changed { border-left-color: var(--amber); }
.fld.changed .was { display: block; }
.fld .err-msg { display: none; font-size: 13px; color: var(--err); }
.fld.invalid .err-msg { display: block; }
.fld.invalid .input, .fld.invalid .select { border-color: var(--err); }
.fld.toggle > .ctl { padding-top: 8px; }
.range-ctl { display: flex; align-items: center; gap: 12px; }
.range-ctl input { flex: 1; max-width: 320px; }
.range-ctl output { font: 500 13px var(--mono); width: 40px; }
.pwwrap { position: relative; }
.pwwrap .input { padding-right: 76px; }
.pwwrap .btn { position: absolute; right: 4px; top: 4px; height: 28px; }

.savebar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 12px 20px; margin-top: auto;
  border-top: 1px solid var(--line); background: var(--screen); border-radius: 0 0 var(--r) 0;
}
.savebar .msg { font-size: 14px; color: var(--ink-2); margin-right: auto; display: flex; align-items: center; gap: 8px; }
.savebar.dirty .msg { color: var(--ink); font-weight: 500; }
.savebar.dirty { box-shadow: inset 0 3px 0 var(--amber); }

.panelbox { border: 1px solid var(--line); border-radius: var(--r); background: var(--screen); }
.panelbox + .panelbox { margin-top: 16px; }
.panelbox .group:first-child { padding-top: 16px; }
.panelbox .savebar { position: static; border-radius: 0 0 var(--r) var(--r); }
.steps { margin: 0 0 4px; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.steps li { margin: 3px 0; }
.kv { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kv .grow { flex: 1; min-width: 200px; }
.statusline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------------------------------------------------------------- logs */
.logs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.log-tools .input { flex: 1 1 200px; min-width: 160px; max-width: 340px; }
.log-tools .select { width: auto; height: 34px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--screen); }
.seg button { height: 32px; padding: 0 11px; border: 0; background: none; color: var(--ink-2); font-size: 13.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--sunken); color: var(--ink); box-shadow: inset 0 -2px 0 var(--amber); }
.seg .n { font: 500 11.5px var(--mono); color: var(--ink-3); }
.log-tools .spacer { flex: 1; }
.log-table { flex: 1; min-height: 0; overflow: auto; font-family: var(--mono); font-size: 12.5px; background: var(--screen); }
.lrow { display: grid; grid-template-columns: 112px 70px 140px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 4px 20px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); cursor: pointer; }
.lrow:hover { background: var(--sunken); }
.lrow:focus-visible { outline-offset: -2px; }
.lrow .ts { color: var(--ink-3); white-space: nowrap; }
.lrow .lv { display: inline-flex; align-items: center; gap: 6px; font-family: var(--ui); font-size: 12.5px; font-weight: 600; }
.lrow .lv.info { color: var(--ink-2); font-weight: 500; }
.lrow .lv.warn { color: var(--warn); }
.lrow .lv.error { color: var(--err); }
.lrow .srcc { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow.error .msg { color: var(--err); }
.lrow.open .msg { white-space: pre-wrap; word-break: break-word; }
.lrow mark { background: var(--amber-wash); color: inherit; outline: 1px solid var(--amber); border-radius: 2px; }
.ldetail { grid-column: 1 / -1; margin: 6px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); font-family: var(--ui); font-size: 13px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; cursor: auto; }
.ldetail dt { color: var(--ink-2); }
.ldetail dd { margin: 0; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.ldetail .btn { font-family: var(--ui); }
.log-foot { display: flex; gap: 12px; align-items: center; padding: 8px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* ---------------------------------------------------------------- dialogos y avisos */
dialog { border: 1px solid var(--line-2); border-radius: 10px; padding: 0; background: var(--screen); color: var(--ink); box-shadow: var(--shadow); max-width: min(520px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(10, 14, 12, .45); }
.dlg { padding: 20px 22px; }
.dlg h2 { font: 600 20px/1.2 var(--display); margin: 0 0 8px; }
.dlg p { color: var(--ink-2); margin: 0 0 14px; }
.dlg .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; max-width: min(520px, 100vw); border-radius: 0; border-width: 0 0 0 1px; }
.lyr-body { white-space: pre-wrap; line-height: 1.65; font-size: 16px; padding: 0 22px 30px; overflow: auto; }
.drawer .dlg { position: sticky; top: 0; background: var(--screen); border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer .dlg h2 { margin: 0; flex: 1; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--ink); color: var(--panel); font-size: 14px; box-shadow: var(--shadow); }
.toast .lamp { margin-top: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .player { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .player .col { min-height: auto; }
  .player .col + .col { border-left: 0; border-top: 1px solid var(--line); }
  .player .scroll { max-height: 520px; }
}
@media (max-width: 900px) {
  :root { --rail: 0px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  .rail .mark { padding: 0 6px 0 0; }
  .rail .mark span { display: none; }
  .nav { flex-direction: row; }
  .nav button { height: 34px; padding: 0 10px; }
  .nav button[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--amber); }
  .rail-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; gap: 4px; }
  .botcard { display: none; }
  .usercard { padding: 0; grid-template-columns: 30px auto; gap: 4px; align-items: center; }
  .usercard .uacts { margin-left: 0; }
  .usercard .who { display: none; }
  .cfg { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .subnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .subnav button { flex: none; }
  .bots { grid-template-columns: minmax(0, 1fr); }
  .botlist { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; }
  .botlist button { flex: none; min-width: 200px; }
  .lrow { grid-template-columns: 70px 56px minmax(0, 1fr); }
  .lrow .srcc { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .nav button span { display: none; }
  .ctx { padding: 10px 14px; gap: 10px; }
  .ctx-sep { display: none; }
  .ctx-voice, .ctx-bot { flex: 1 1 100%; margin-left: 0; }
  .ctx-voice .select, .ctx-bot .select { flex: 1; min-width: 0; max-width: none; }
  .deck { padding: 16px 14px; }
  .deck-top { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .deck .art.big { width: 96px; height: 96px; }
  .deck-title { font-size: 22px; }
  .transport { gap: 8px; }
  .tp-sep { flex-basis: 100%; height: 0; }
  .vol { flex: 1; }
  .vol input { flex: 1; width: auto; }
  .mod-h, .pane-tools, .queue-foot { padding-left: 14px; padding-right: 14px; }
  .mod-h .acts .btn span { display: none; }
  .mod-h .acts .btn { padding: 0 8px; }
  .modes-lbl { margin-left: 0; }
  .row { grid-template-columns: 20px 34px minmax(0, 1fr) var(--acts, 96px); }
  .row.noidx { grid-template-columns: 34px minmax(0, 1fr) var(--acts, 96px); }
  .row .dur { display: none; }
  .cfg-sec { padding: 16px 14px 30px; }
  .cfg-sec > header { flex-direction: column; }
  .cfg-sec > header .acts { margin-left: 0; }
  .fld { grid-template-columns: minmax(0, 1fr); }
  .fld > label, .fld > .lbl { padding-top: 0; }
  .ed-head .acts { margin-left: 0; width: 100%; }
  .log-tools { padding: 10px 14px; }
  .lrow { padding: 4px 14px; grid-template-columns: 62px minmax(0, 1fr); }
  .lrow .lv { display: none; }
  .lrow.warn { box-shadow: inset 3px 0 0 var(--warn); }
  .lrow.error { box-shadow: inset 3px 0 0 var(--err); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Botones que son enlaces (Conectar cuenta de Spotify) */
a.btn { text-decoration: none; }
.btn.disabled { opacity: .45; cursor: not-allowed; }
