:root {
  --bg: #141414;
  --panel: #1b1b1b;
  --panel-2: #232323;
  --line: #333333;
  --line-2: #444444;
  --text: #ececec;
  --muted: #9a9a9a;
  --accent: #e5484d;
  --accent-2: #5ab0ff;
  --brand: #d9232d;
  --ok: #3ccf6a;
  --warn: #f2c230;
  --bad: #ef4444;
  --radius: 4px;
  --gap: 6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "DejaVu Sans", sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }
h3 { margin: 12px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; }
h3:first-child { margin-top: 2px; }

/* ── Marca ── */
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; white-space: nowrap; }
.brand b { color: var(--brand); font-weight: 800; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 900; font-size: 17px; }
.brand.big { font-size: 26px; justify-content: center; }
.brand.big .brand-mark { width: 40px; height: 40px; font-size: 24px; }

/* ── Login ── */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #202020, var(--bg)); padding: 16px; }
.login-card { width: min(360px, 100%); background: #1e1e1e; border: 1px solid var(--line); border-radius: 8px; padding: 28px; display: grid; gap: 12px; text-align: center; }

/* ── Estructura (móvil / ventana chica: desplazamiento normal) ── */
.app { padding: var(--gap); display: grid; gap: var(--gap); min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; min-height: 0; }
.panel-title { display: flex; justify-content: space-between; gap: 8px; padding: 5px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title b { color: var(--text); font-family: var(--mono); }

.monitor { display: grid; grid-template-columns: 1fr; gap: var(--gap); min-height: 0; }
.meter-panel, .graph { display: flex; flex-direction: column; position: relative; }
.canvas-box { position: relative; flex: 1; min-height: 0; }
.canvas-box canvas { display: block; width: 100%; }
.graph-label { position: absolute; right: 12px; top: 8px; font-size: 11px; color: var(--muted); pointer-events: none; }

/* ── Pantalla completa (escritorio / kiosco Full HD): todo entra sin desplazamiento ── */
@media (min-width: 1100px) and (min-height: 680px) {
  html, body { overflow: hidden; }
  /* Áreas con nombre: si el aviso está oculto, su fila queda en 0 y nada se descuadra. */
  .app {
    height: 100vh;
    grid-template-rows: auto auto minmax(150px, 0.42fr) auto minmax(0, 1fr);
    grid-template-areas: "top" "banner" "monitor" "nav" "content";
  }
  .app > .topbar { grid-area: top; }
  .app > .banner { grid-area: banner; }
  .app > .monitor { grid-area: monitor; }
  .app > .navrow { grid-area: nav; }
  .app > .content { grid-area: content; }
  .canvas-box canvas { position: absolute; inset: 0; height: 100%; }
  .content { overflow: auto; }
}

/* ── Barra superior ── */
.topbar {
  display: flex; align-items: stretch; gap: var(--gap); padding: var(--gap);
  background: linear-gradient(#282828, #1e1e1e); border: 1px solid var(--line-2); border-radius: var(--radius); min-width: 0;
}
.topbar .brand { padding: 0 10px; }
.top-cell {
  display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 0;
  flex: 0 1 220px; padding: 3px 10px;
  background: linear-gradient(#2d2d2d, #252525); border: 1px solid var(--line-2); border-radius: var(--radius);
}
.top-cell.grow { flex: 1 1 300px; }
.top-cell.narrow { flex: 0 1 150px; }
.top-cell .state-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.top-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.top-value { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.preset-bar { display: grid; grid-template-columns: repeat(6, minmax(40px, 54px)); gap: 4px; flex: 0 0 auto; }
.preset-btn {
  border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--text); cursor: pointer;
  background: linear-gradient(#303030, #262626); font-size: 17px; font-weight: 600; min-height: 44px;
}
.preset-btn:hover { border-color: var(--accent); }
.preset-btn.active { background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; }
.preset-btn.empty { color: #5e5e5e; }

.state-pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #2c2c2c; white-space: nowrap; }
.state-pill.ok { background: rgba(60, 207, 106, .18); color: var(--ok); }
.state-pill.warn { background: rgba(242, 194, 48, .18); color: var(--warn); }
.state-pill.bad { background: rgba(239, 68, 68, .2); color: var(--bad); }

.banner { padding: 6px 12px; border-radius: var(--radius); font-weight: 600; background: rgba(239, 68, 68, .15); border: 1px solid var(--bad); color: #ffb4b4; }
.banner.warn { background: rgba(242, 194, 48, .12); border-color: var(--warn); color: #ffe39a; }
.lufs-readouts b { font-size: 13px; }

/* ── Navegación ── */
.navrow { display: grid; grid-template-columns: auto 1fr; gap: var(--gap); }
.transport { display: grid; grid-template-columns: minmax(150px, 1fr); gap: 4px; }
.tabs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.tab, .btn.tile {
  min-height: 52px; font-size: 16px; border-radius: var(--radius); cursor: pointer; color: var(--text);
  border: 1px solid var(--line-2); background: linear-gradient(#303030, #252525); padding: 4px 8px;
}
.tab:hover, .btn.tile:hover { border-color: var(--accent); }
.tab.active { background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; }
#btnLive.live, #btnSrt.live { background: linear-gradient(#b02a2a, #7d1b1b); border-color: #e05252; }

/* ── Botones y formularios ── */
.btn { padding: 7px 14px; border-radius: var(--radius); cursor: pointer; color: var(--text); font: inherit; border: 1px solid var(--line-2); background: linear-gradient(#363636, #2a2a2a); }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; }
.btn.warn { border-color: #8a6d1a; }
.btn.danger { border-color: #8a2a2a; color: #ffb4b4; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
input, select { background: #0e0e0e; color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 9px; font: inherit; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent-2); }
input[type=range] { padding: 0; accent-color: var(--accent-2); flex: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent-2); }
.field { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.field.inline { display: flex; align-items: center; gap: 8px; }
.field.grow { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 6px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 8px; }
.stack { display: grid; gap: 8px; max-width: 360px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cols.wide-left { grid-template-columns: 1.2fr 1fr; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row .mono { min-width: 64px; text-align: right; }

/* ── Contenido ── */
.content { padding: 10px 16px 14px; min-height: 260px; }
.estado-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.now-playing { padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.np-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.np-title { font-size: 22px; font-weight: 600; color: #9fe3b0; word-break: break-word; }
.np-station { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 18px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--line); min-width: 0; }
.kv span:first-child { color: var(--muted); white-space: nowrap; }
.kv span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.buffer-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.bar { flex: 1; height: 12px; border-radius: 99px; background: #0e0e0e; border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, #363636, #5ab0ff); transition: width .4s; }

.preset-editor { display: grid; gap: 5px; }
.preset-row { display: grid; grid-template-columns: 26px minmax(110px, 180px) 1fr auto auto; gap: 6px; align-items: center; }
.preset-row .num { font-weight: 700; text-align: center; color: var(--muted); }
.preset-row.active .num { color: var(--accent-2); }

.srt-card, .enc-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: 10px 12px; }
.srt-card { margin-bottom: 6px; }

.enc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 10px; }
.enc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.enc-head input[data-f=name] { font-weight: 600; flex: 1 1 160px; }
.enc-stats { font-size: 12px; color: var(--muted); margin: -2px 0 8px; min-height: 1.2em; }
.enc-stats .err { color: #ffb4b4; }
.enc-summary { display: grid; gap: 6px; }
.enc-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); min-width: 0; }
.enc-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

.device-list { display: grid; gap: 4px; }
.device { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; border-radius: var(--radius); cursor: pointer; color: var(--text); font: inherit; border: 1px solid var(--line); background: var(--panel-2); }
.device:hover { border-color: var(--accent); }
.device.selected { border-color: #e5484d; background: rgba(229, 72, 77, .18); }
.device.disabled { opacity: .45; cursor: default; }
.device small { color: var(--muted); }

.iface-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; margin-top: 8px; }
.iface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: 12px; display: grid; gap: 8px; }
.iface-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.iface-head b { font-size: 15px; }
.iface .form-row input { width: 140px; }
.iface .radio-row { display: flex; gap: 14px; }
.wifi-list { display: grid; gap: 4px; margin-top: 8px; max-width: 640px; }
.wifi { display: grid; grid-template-columns: 1fr 70px 110px auto; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.signal { height: 6px; border-radius: 99px; background: #0e0e0e; overflow: hidden; }
.signal div { height: 100%; background: var(--ok); }
.notice { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); margin-bottom: 8px; }

.footer { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 4px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 6px; background: #292929; border: 1px solid var(--line-2); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.toast.bad { border-color: var(--bad); color: #ffc4c4; }
.toast.ok { border-color: var(--ok); }

/* ── Responsive ── */
@media (max-width: 1099px) {
  .monitor, .cols, .cols.wide-left, .navrow, .estado-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .top-cell, .top-cell.grow, .top-cell.narrow { flex: 1 1 40%; }
  .preset-bar { grid-template-columns: repeat(6, 1fr); width: 100%; }
  .enc-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .app { padding: 6px; }
  .tabs { grid-template-columns: repeat(3, 1fr); }
  .transport { grid-template-columns: repeat(2, 1fr); }
  .tab, .btn.tile { min-height: 44px; font-size: 14px; }
  .preset-row { grid-template-columns: 26px 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .preset-row input[data-field=name] { grid-column: 2 / -1; }
  .preset-row input[data-field=url] { grid-column: 1 / -1; }
  .preset-row [data-act=save] { grid-column: 1 / 3; }
  .wifi { grid-template-columns: 1fr 60px auto; }
  .wifi .sec { display: none; }
  .iface-list { grid-template-columns: 1fr; }
}

/* ── Estado del disco ── */
.disk-list { display: grid; gap: 10px; margin-bottom: 8px; }
.disk-card { border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); padding: 10px 14px; }
.disk-card.ok { border-left-color: var(--ok); }
.disk-card.warn { border-left-color: var(--warn); }
.disk-card.bad { border-left-color: var(--bad); }
.disk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.disk-head .state-pill { margin-left: auto; font-size: 14px; }
.disk-advice { margin: 6px 0; }
.disk-notes { margin: 0 0 8px; padding-left: 20px; color: #ffe39a; }
.disk-card.bad .disk-notes { color: #ffb4b4; }
.disk-card.ok .disk-notes { color: var(--muted); }

/* Menús desplegables con el estilo oscuro del panel (WebKit/surf usa el estilo del sistema si no) */
select {
  -webkit-appearance: none; appearance: none;
  background-color: #0e0e0e; color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238593a1'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
select option { background: #1b1b1b; color: var(--text); }

/* ── Grabaciones ── */
.rec-top { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin-bottom: 10px; }
.rec-now { flex: 1 1 280px; font-weight: 600; padding: 8px 12px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); }
.rec-now.on { border-color: var(--bad); color: #ffb4b4; }
.rec-now.on::before { content: "● "; color: var(--bad); }
#recManual.on { background: linear-gradient(#b02a2a, #7d1b1b); border-color: #e05252; }
.rec-list { display: grid; gap: 4px; }
.rec-item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: 6px 10px; }
.rec-row { display: grid; grid-template-columns: 120px 1fr 80px 70px auto; gap: 10px; align-items: center; }
.rec-row .when { font-family: var(--mono); font-size: 13px; }
.rec-row .live { color: var(--bad); font-weight: 600; }
.rec-actions { display: flex; gap: 4px; }
.rec-item audio { width: 100%; margin-top: 6px; height: 34px; }
.rec-schedules { display: grid; gap: 6px; margin-bottom: 8px; }
.sch-row { display: grid; grid-template-columns: 22px minmax(90px, 1fr) 118px 88px 88px 58px 58px 58px 62px 34px; gap: 6px; align-items: end; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.sch-row.on { border-left: 3px solid var(--ok); }
.sch-row .field { font-size: 11px; }
@media (max-width: 1099px) { .sch-row { grid-template-columns: 22px 1fr 1fr; } .rec-row { grid-template-columns: 1fr auto; } }

/* ── Ciudad ── */
.top-cell.city-name { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 18px; font-size: 19px; font-weight: 800; letter-spacing: .08em;
  color: #fff; background: linear-gradient(#c4232c, #8d161d); border-color: #e0444c; white-space: nowrap; }
.unlock-city { font-size: 20px; letter-spacing: .06em; }

/* ── Bloqueo de pantalla (kiosco) ── */
.lock-layer { position: fixed; inset: 0; z-index: 50; background: transparent; cursor: pointer; }
.lock-badge { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 51;
  padding: 10px 22px; border-radius: 99px; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
  color: #ffe39a; background: rgba(22, 22, 22, .92); border: 1px solid var(--warn); box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.lock-now { position: fixed; right: 14px; bottom: 14px; z-index: 40; padding: 6px 14px; border-radius: 99px; font: inherit;
  font-size: 13px; cursor: pointer; color: var(--muted); background: rgba(22, 22, 22, .9); border: 1px solid var(--line-2); }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(8, 8, 8, .65); padding: 16px; }
.modal-card { width: min(380px, 100%); background: #1e1e1e; border: 1px solid var(--line-2); border-radius: 8px; padding: 24px; display: grid; gap: 12px; text-align: center; }
.modal-card input { font-size: 18px; text-align: center; letter-spacing: .1em; }
.form-row.center { justify-content: center; }

.ico { width: 1em; height: 1em; vertical-align: -0.12em; }

/* ── Tono ── */
.tone-strip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 6px; border-top: 1px solid var(--line); font-size: 12px; }
.tone-label { color: var(--muted); white-space: nowrap; min-width: 92px; }
.tone-label b { color: var(--text); }
.tone-box { flex: 1; position: relative; height: 30px; }
.tone-box canvas { position: absolute; inset: 0; width: 100%; height: 100% !important; }
.tone-value { font-family: var(--mono); white-space: nowrap; min-width: 150px; text-align: right; }
.tone-count { white-space: nowrap; padding: 2px 10px; border-radius: 99px; background: rgba(60, 207, 106, .15); color: var(--ok); font-weight: 600; }
.tone-summary { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.tone-big { display: grid; place-items: center; min-width: 150px; padding: 8px 14px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line); }
.tone-big span { font-size: 40px; font-weight: 800; color: var(--ok); line-height: 1.1; }
.tone-big small { color: var(--muted); }
.tone-last { flex: 1; font-size: 15px; }
.tone-list { display: grid; gap: 3px; max-height: 100%; }
.tone-row { display: grid; grid-template-columns: 90px 110px 1fr; gap: 10px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); font-size: 13px; }
.tone-row .t { font-family: var(--mono); font-weight: 600; }
.tone-daily { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 110px; margin-bottom: 8px; }
.tone-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 10px; color: var(--muted); gap: 2px; }
.tone-day .bar { width: 100%; background: linear-gradient(#5ab0ff, #363636); border-radius: 3px 3px 0 0; min-height: 2px; }
.tone-day b { color: var(--text); font-size: 11px; }

/* ── Calendario ── */
.datepick { position: relative; display: inline-flex; align-items: center; gap: 4px; font-size: 15px; line-height: normal; }
.dp-btn { min-width: 36px; height: 34px; padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--line-2); color: var(--text);
  background: linear-gradient(#363636, #2a2a2a); font: inherit; font-size: 15px; cursor: pointer; }
.dp-btn:hover:not(:disabled) { border-color: var(--accent); }
.dp-btn:disabled { opacity: .35; cursor: default; }
.dp-label { min-width: 250px; font-weight: 600; text-transform: capitalize; }
.dp-label::after { content: " ▾"; color: var(--muted); }
.dp-today { font-size: 13px; }
.dp-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 330px; padding: 10px; border-radius: 8px;
  background: #1e1e1e; border: 1px solid var(--line-2); box-shadow: 0 12px 32px rgba(0,0,0,.55); }
.dp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 700; text-transform: capitalize; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0; }
.dp-day { position: relative; height: 40px; border-radius: 6px; border: 1px solid transparent; background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.dp-day:hover:not(:disabled) { border-color: var(--accent); }
.dp-day:disabled { opacity: .3; cursor: default; }
.dp-day.other { visibility: hidden; }
.dp-day.today { border-color: var(--accent-2); }
.dp-day.sel { background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; font-weight: 700; }
.dp-day .mark { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); font-size: 9px; line-height: 1;
  padding: 1px 4px; border-radius: 99px; background: rgba(60, 207, 106, .25); color: var(--ok); font-weight: 700; }
.dp-day .mark.warn { background: rgba(242, 194, 48, .25); color: var(--warn); }
.dp-day.sel .mark { background: rgba(255,255,255,.25); color: #fff; }
.tone-day { cursor: pointer; }
.tone-day:hover b { color: var(--accent-2); }

/* ── Logo ── */
.brand-logo { height: 54px; width: auto; align-self: center; margin: -2px 6px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.brand-logo.big { height: auto; width: min(260px, 80%); margin: 0 auto 4px; display: block; }

/* Valores de salud del equipo en la barra superior */
.top-value.warn { color: var(--warn); }
.top-value.bad { color: var(--bad); font-weight: 700; }

.tone-sig { white-space: nowrap; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: #2c2c2c; color: var(--muted); text-transform: uppercase; }
.tone-sig.st { background: rgba(90,176,255,.2); color: var(--accent-2); }
.tone-row { grid-template-columns: 90px 110px 1fr 170px; }
.tone-row .why { color: var(--muted); font-size: 12px; text-align: right; }

.tone-row .why .btn { margin-left: 8px; padding: 1px 7px; }

/* Relé de corte */
.relay-box { display: flex; flex-direction: column; gap: 10px; }
.relay-box select { min-width: 380px; }
.relay-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.relay-btns .btn small { opacity: .65; font-family: ui-monospace, monospace; margin-left: 4px; }
.relay-byte { display: inline-flex; gap: 6px; margin-left: auto; }
.relay-byte input { width: 80px; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.relay-history { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow: auto; }
.relay-row { display: grid; grid-template-columns: 80px 220px 160px 1fr; gap: 10px; font-size: 13px; padding: 3px 8px; border-radius: 4px; background: rgba(255,255,255,.03); }
.relay-row.ok span:last-child { color: var(--ok); }
.relay-row.bad span:last-child { color: var(--bad); }

/* Sistema: tres columnas que entran en una pantalla 1920x1080 sin bajar */
.sys-layout { display: grid; grid-template-columns: 1fr 1.15fr 1.15fr; gap: 14px; align-items: start; }
.sys-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; min-width: 0; }
.sys-card h3 { margin: 12px 0 6px; display: flex; align-items: baseline; gap: 10px; }
.sys-card h3:first-child { margin-top: 0; }
.sys-card h3 .small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: auto; }
.sys-kv { grid-template-columns: 1fr; gap: 0; }
.sys-kv .kv { padding: 3px 0; }
.sys-inline { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.sys-inline input:not([type=number]), .sys-inline select { flex: 1; min-width: 0; }
.sys-inline label { white-space: nowrap; }
.sys-btn3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sys-pw { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 6px; }
.sys-pw input { min-width: 0; }
.relay-box select, .sys-card select { min-width: 0; }
.relay-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 6px; }
.relay-grid .wide { grid-column: span 4; padding: 10px; font-size: 15px; }
.relay-grid .btn small { opacity: .65; font-family: var(--mono); margin-left: 4px; }
.relay-grid .relay-byte { grid-column: span 4; display: flex; gap: 8px; margin: 0; }
.relay-grid .relay-byte input { width: 90px; }
.sys-card .relay-history { max-height: 168px; }
.sys-card .relay-row { grid-template-columns: 62px 1fr 64px 170px; gap: 8px; font-size: 12px; }
.sys-card .relay-row span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-card p.small { margin: 4px 0 6px; }
/* Disco compacto dentro de la columna */
.sys-card .disk-card { padding: 8px 10px; }
.sys-card .disk-advice { margin: 4px 0; font-size: 13px; }
.sys-card .disk-notes { font-size: 12px; margin-bottom: 4px; }
.sys-card .disk-card .kv-grid { grid-template-columns: 1fr 1fr; gap: 0 14px; }
.sys-card .disk-card .kv { padding: 2px 0; font-size: 12px; }
.sys-card .disk-head .state-pill { font-size: 12px; }
@media (max-width: 1300px) { .sys-layout { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .sys-layout { grid-template-columns: 1fr; } .sys-pw { grid-template-columns: 1fr; } }

/* Prueba de resistencia del relé */
.relay-test { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; flex-wrap: wrap; }
.relay-test .rt-title { font-weight: 600; font-size: 13px; margin-right: 4px; }
.relay-test .rt-go { min-width: 58px; font-family: var(--mono); }
.relay-test select { margin-left: 4px; }
.relay-test #rtStop { margin-left: auto; }
.rt-status { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.rt-status .rt-bar { flex: 0 0 160px; height: 10px; border-radius: 5px; background: #2c2c2c; overflow: hidden; }
.rt-status .rt-bar div { height: 100%; width: 0; background: var(--accent-2); transition: width .3s; }
.rt-status.ok .rt-bar div { background: var(--ok); }
.rt-status.bad .rt-bar div { background: var(--bad); }
.rt-status.ok span { color: var(--ok); }
.rt-status.bad span { color: var(--bad); }
.sys-card .relay-row code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Reproductor de grabaciones */
.rec-player { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; padding: 8px 10px; border-radius: var(--radius); background: #111111; border: 1px solid var(--line-2); }
.rec-player .rp-play { width: 44px; height: 36px; padding: 0; font-size: 15px; background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; }
.rec-player .rp-seek { flex: 1 1 260px; min-width: 160px; accent-color: var(--accent-2); height: 6px; }
.rec-player .rp-time, .rec-player .rp-dur { font-size: 13px; min-width: 42px; text-align: center; }
.rec-player .rp-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rec-player .rp-opt select { padding: 3px 6px; }
.rec-player .rp-close { margin-left: auto; }
.rec-player .rp-msg { flex-basis: 100%; }
.rec-player .rp-msg:empty { display: none; }

/* Pestaña Audio: niveles y volumen */
.lvl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 10px; }
.lvl-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; }
.lvl-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.lvl-head h3 { margin: 0; }
.lvl-head .state-pill { margin-left: auto; font-size: 13px; }
.lvl-meter { display: grid; grid-template-columns: 16px 1fr 56px; gap: 8px; align-items: center; margin: 4px 0; }
.lvl-meter > span { color: var(--muted); font-size: 12px; }
.lvl-meter b { text-align: right; font-size: 14px; }
.lvl-bar { position: relative; height: 18px; background: #111111; border-radius: 3px; overflow: hidden; }
.lvl-bar div { height: 100%; width: 0; background: var(--ok); transition: width .05s linear; }
.lvl-bar div.warm { background: linear-gradient(90deg, var(--ok) 80%, var(--warn)); }
.lvl-bar div.hot { background: linear-gradient(90deg, var(--ok) 75%, var(--warn) 90%, var(--bad)); }
.lvl-bar i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--warn); left: 0; }
.lvl-scale { position: relative; height: 14px; margin: 0 64px 0 24px; font-size: 10px; color: var(--muted); }
.lvl-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.lvl-scale span:last-child { transform: translateX(-100%); }
.lvl-lufs { margin: 4px 0 8px; }
.lvl-ctrl { display: flex; align-items: center; gap: 8px; }
.lvl-ctrl .lvl-label { font-weight: 600; font-size: 13px; white-space: nowrap; margin-right: 4px; }
.lvl-ctrl input[type=range] { flex: 1; min-width: 120px; accent-color: var(--accent-2); }
.lvl-ctrl .lvl-val { min-width: 64px; text-align: center; font-size: 15px; font-weight: 700; }
@media (max-width: 1100px) { .lvl-grid { grid-template-columns: 1fr; } }

/* Barra superior: fuente + medidor pequeño de la entrada de línea */
.top-cell.src-cell { flex-direction: row; justify-content: space-between; gap: 14px; }
.src-cell .src-text { display: flex; flex-direction: column; align-items: center; min-width: 0; flex: 1; }
.src-cell .src-meter { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; flex: 0 1 170px; min-width: 120px; }
.src-meter .top-label { grid-column: 1 / 3; text-align: left; }
.src-meter .sm-bars { display: flex; flex-direction: column; gap: 3px; }
.src-meter .sm-bar { height: 6px; background: #111111; border-radius: 2px; overflow: hidden; }
.src-meter .sm-bar div { height: 100%; width: 0; background: var(--ok); transition: width .05s linear; }
.src-meter .sm-bar div.warm { background: linear-gradient(90deg, var(--ok) 80%, var(--warn)); }
.src-meter .sm-bar div.hot { background: linear-gradient(90deg, var(--ok) 75%, var(--warn) 90%, var(--bad)); }
.src-meter b { font-size: 12px; white-space: nowrap; min-width: 52px; text-align: right; }
/* Sin el texto "Fuente": el medidor de línea ocupa toda la casilla */
.top-cell.src-cell .src-meter { flex: 1 1 auto; width: 100%; row-gap: 3px; }
.src-meter .top-label { text-align: center; }
.src-meter .sm-bar { height: 8px; }
.src-meter b { font-size: 13px; }

/* Medidores HTML livianos: se escalan con transform (sin recalcular el diseño) y sin animaciones */
.src-meter .sm-bar div, .lvl-bar div { width: 100% !important; transform-origin: left center; transform: scaleX(0); transition: none !important; will-change: transform; }
#toneVal.over { color: #ff7b7b; }

/* Sistema: modo de operación */
.sys-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sys-kv { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.op-card h3 .state-pill { margin-left: auto; font-size: 12px; text-transform: none; letter-spacing: 0; }
.op-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.op-mode { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border-radius: var(--radius); cursor: pointer;
  background: #111111; border: 1px solid var(--line-2); color: var(--text, #f0f0f0); font: inherit; }
.op-mode b { font-size: 15px; }
.op-mode span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.op-mode.active { border-color: #e5484d; background: linear-gradient(#363636, #3a3a3a); box-shadow: 0 0 0 1px #e5484d inset; }
.op-mode.active span { color: #f0f0f0; }
.op-panel p.small { margin: 2px 0 0; }
.op-panel .sys-inline { flex-wrap: wrap; }
.cut-live { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 8px; border-radius: var(--radius); background: #111111; font-size: 13px; }
.cut-live #cutText { flex: 1; min-width: 0; }
.op-history { max-height: 96px; margin-top: 6px; }
.op-history:empty { display: none; }
.sys-card .relay-row.op-row { grid-template-columns: 62px 1fr; }
.sys-card .relay-row.op-row span:last-child { white-space: normal; }

/* Cuadro de diálogo propio (centrado) */
.dlg-back { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 8, 8, .62); }
.dlg-back.hidden { display: none; }
.dlg { width: min(520px, 100%); background: linear-gradient(#282828, #232323); border: 1px solid var(--line-2); border-top: 3px solid var(--accent-2);
  border-radius: 10px; box-shadow: 0 18px 60px rgba(0, 0, 0, .6); padding: 18px 22px 16px; }
.dlg h2 { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); font-weight: 700; }
.dlg-msg p { margin: 0 0 8px; color: var(--muted); line-height: 1.45; font-size: 14px; }
.dlg-msg p.dlg-q { color: #f0f0f0; font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.dlg input { width: 100%; margin: 4px 0 6px; font-size: 15px; padding: 8px 10px; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.dlg-btns .btn { min-width: 120px; padding: 9px 16px; font-size: 14px; }

/* ── Pautas ── */
.pt-layout { display: grid; grid-template-columns: minmax(300px, 1fr) 2.2fr; gap: 14px; align-items: start; }
.pt-main { min-height: 420px; }
.pt-days { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.pt-day { display: grid; gap: 1px; min-width: 92px; padding: 6px 10px; text-align: left; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line-2); background: linear-gradient(#303030, #252525); color: var(--text); font: inherit; }
.pt-day b { font-size: 13px; }
.pt-day small { color: var(--muted); font-size: 11px; }
.pt-day.sel { border-color: var(--accent-2); box-shadow: inset 0 0 0 1px var(--accent-2); background: linear-gradient(#3c3c3c, #2c2c2c); }
.pt-day.past { opacity: .55; }
.pt-day.bad small { color: var(--warn); }
.pt-tandas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 58vh; overflow: auto; }
.pt-tanda { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 6px 9px; }
.pt-tanda.now { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.pt-tanda.done { opacity: .5; }
.pt-tanda header { display: flex; justify-content: space-between; font-family: var(--mono); font-weight: 700; color: var(--accent-2); margin-bottom: 3px; }
.pt-spot { font-size: 12px; padding: 1px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-spot.miss { color: var(--warn); }
.pt-spot i { color: var(--muted); font-style: normal; font-family: var(--mono); margin-right: 4px; }
.pt-hist { display: grid; grid-template-columns: 62px 1fr; gap: 8px; font-size: 12px; padding: 2px 0; }
.pt-hist .bad { color: var(--warn); }
#ptMissing { margin-bottom: 8px; font-size: 12px; }
@media (max-width: 1100px) { .pt-layout { grid-template-columns: 1fr; } }

/* ── Principal: tanda local ── */
.pr-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; align-items: stretch; min-height: 100%; }
.pr-tanda { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; min-height: 460px; min-width: 0; }
.pr-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pr-head b { font-size: 18px; }
.pr-hint { margin-left: auto; }
.pr-mode { font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); }
.pr-mode.air { color: #fff; background: #b91c1c; border-color: #ef4444; }
.pr-mode.test { color: var(--warn); border-color: var(--warn); }
.pr-banner { margin: 12px 0 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); font-size: 15px; line-height: 1.5; }
.pr-banner big { display: block; font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.pr-banner.wait big { color: var(--accent-2); }
.pr-banner.armed { border-color: var(--warn); } .pr-banner.armed big { color: var(--warn); }
.pr-banner.air { border-color: var(--bad); background: rgba(239, 68, 68, .12); } .pr-banner.air big { color: #ff8a8a; }
.pr-prog { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pr-bar { flex: 1; height: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.pr-bar div { height: 100%; width: 0; background: linear-gradient(90deg, #ef4444, #f97316); transition: width .25s linear; }
.pr-spots { flex: 1; overflow: auto; }
.pr-row { display: grid; grid-template-columns: 34px 1fr 64px 86px; gap: 8px; align-items: center; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.pr-row .n { color: var(--muted); font-family: var(--mono); text-align: right; }
.pr-row .d { font-family: var(--mono); color: var(--muted); text-align: right; }
.pr-row .s { font-size: 11px; font-weight: 700; text-align: center; border-radius: 4px; padding: 1px 4px; }
.pr-row.on { background: rgba(239, 68, 68, .14); }
.pr-row.on .s { background: var(--bad); color: #fff; }
.pr-row.ok { opacity: .55; } .pr-row.ok .s { color: var(--ok); }
.pr-row.miss { color: var(--warn); } .pr-row.miss .s { color: var(--warn); border: 1px solid var(--warn); }
.pr-empty { margin: auto; text-align: center; color: var(--muted); max-width: 420px; padding: 40px 0; }
.pr-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pr-big { width: 100%; display: grid; gap: 2px; padding: 12px; font-size: 16px; font-weight: 700; letter-spacing: .04em; }
.pr-big small { font-size: 11px; font-weight: 400; letter-spacing: 0; opacity: .8; }
.pr-big:disabled { opacity: .35; cursor: not-allowed; }
.pr-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.pr-play { margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.pr-hours { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-h { font-family: var(--mono); font-weight: 700; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); cursor: pointer; }
.pr-h small { font-family: var(--font, inherit); font-weight: 400; color: var(--muted); margin-left: 4px; }
.pr-h.next { background: #b91c1c; border-color: #ef4444; color: #fff; } .pr-h.next small { color: #fecaca; }
.pr-h.loaded { box-shadow: inset 0 0 0 2px var(--warn); }
.pr-history { display: flex; flex-direction: column; max-height: 260px; overflow: auto; font-size: 12px; }
.pr-history div { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.pr-history .k-tanda { color: #ff8a8a; font-weight: 700; } .pr-history .k-fin { color: var(--ok); }
.pr-history .k-aviso, .pr-history .k-error { color: var(--warn); } .pr-history .k-carga { color: var(--accent-2); }
.pr-menu { position: fixed; z-index: 90; min-width: 240px; max-height: 70vh; overflow: auto; background: #1e1e1e; border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.5); padding: 4px; }
.pr-menu h4 { margin: 4px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pr-menu button { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 7px 10px; background: none; border: 0; border-radius: 4px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pr-menu button:hover { background: var(--accent); }
.pr-menu button.past { color: var(--muted); }
.pr-menu button span { color: var(--muted); font-size: 12px; }
.pr-menu .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.pr-menu .grid button { justify-content: center; font-family: var(--mono); font-weight: 700; }
.pr-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.pr-manual { width: min(380px, 100%); }
.pr-clock { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 6px; }
.pr-arrows { display: grid; gap: 6px; }
.pr-clock-face { font-size: 54px; font-weight: 700; color: var(--ok); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 18px; }
.pr-clock-info { text-align: center; min-height: 1.4em; }
@media (max-width: 1100px) { .pr-layout { grid-template-columns: 1fr; } }
.pr-h { cursor: default; }
.pr-row.pr-total { border-bottom: 0; border-top: 2px solid var(--line-2); font-weight: 700; }
.pr-row.pr-total .d { color: var(--text); }

/* ── Principal primero (antes que SEÑAL LIMA) y sin desplazamiento ── */
.navrow { grid-template-columns: 1fr auto; }
.navrow > .transport { order: 2; }
@media (min-width: 1100px) and (min-height: 680px) {
  .content:has(#tab-principal:not(.hidden)) { overflow: hidden; display: flex; flex-direction: column; }
  #tab-principal:not(.hidden) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #tab-principal .pr-layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  #tab-principal .pr-tanda { min-height: 0; }
  #tab-principal .pr-side { min-height: 0; overflow: hidden; }
  #tab-principal .pr-side > .sys-card { flex: 0 0 auto; }
  #tab-principal .pr-side > .pr-card-hours { flex: 0 1 auto; min-height: 70px; display: flex; flex-direction: column; }
  #tab-principal .pr-side > .pr-card-hist { flex: 1 1 90px; min-height: 70px; display: flex; flex-direction: column; }
  #tab-principal .pr-hours, #tab-principal .pr-history { min-height: 0; overflow: auto; max-height: none; }
}
.pr-banner { margin: 8px 0 6px; padding: 10px 14px; }
.pr-banner big { font-size: 22px; }
.pr-big { padding: 8px; }
.pr-side .sys-card h3 { margin-bottom: 4px; }
.pr-hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 4px; }
.pr-h { padding: 3px 6px; font-size: 13px; text-align: center; white-space: nowrap; }
.pr-h small { font-size: 11px; }
.pr-row { padding: 6px 8px; }

/* ── Pautas: una sola barra (la de las tandas), la página no se desplaza ── */
@media (min-width: 1100px) and (min-height: 680px) {
  .content:has(#tab-pautas:not(.hidden)) { overflow: hidden; display: flex; flex-direction: column; }
  #tab-pautas:not(.hidden) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #tab-pautas .pt-layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #tab-pautas .pt-layout > .sys-col { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
  #tab-pautas .pt-layout > .sys-col > .sys-card:last-child { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #tab-pautas #ptHistory { flex: 1; min-height: 0; max-height: none; }
  #tab-pautas .pt-main { min-height: 0; display: flex; flex-direction: column; }
  #tab-pautas .pt-tandas { flex: 1; min-height: 0; max-height: none; align-content: start; }
}

/* ── Luz "AL AIRE" (como la de un estudio) ── */
.onair-lamp { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 10px; border-radius: 6px;
  background: linear-gradient(#ef3340, #c4121f); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .14em;
  box-shadow: 0 0 0 1px #ff6b75, 0 0 18px rgba(239, 51, 64, .55); text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.onair-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; animation: onair-pulse 1.2s ease-in-out infinite; }
@keyframes onair-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .onair-dot { animation: none; } }
.pr-mode { font-weight: 600; letter-spacing: .04em; text-transform: none; font-size: 12px; }
.pr-mode.air { color: #ff8a93; background: transparent; border-color: rgba(239, 68, 68, .55); }

/* Cartel al aire: rojo sólido, spot grande y cuenta regresiva */
.pr-banner.air { display: flex; align-items: center; gap: 18px; background: linear-gradient(135deg, #b3121f, #7f0d17);
  border-color: #ef4444; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 0 24px rgba(239, 68, 68, .25); }
.pr-banner.armed:has(.air-main) { display: flex; align-items: center; gap: 18px; }
.air-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.air-kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.pr-banner.air .air-kicker, .pr-banner.air big { color: #fff; }
.pr-banner .air-main big { font-size: 26px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.air-note { font-size: 12px; opacity: .8; }
.air-clock { display: grid; justify-items: end; gap: 0; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.2); }
.air-clock b { font-family: var(--mono); font-size: 40px; line-height: 1; font-weight: 700; color: #fff; }
.pr-banner.armed .air-clock b { color: var(--warn); }
.air-clock span { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.pr-row.on .s { background: #ef3340; box-shadow: 0 0 10px rgba(239, 51, 64, .5); }

/* ── Liviano para el kiosco (sin aceleración gráfica): pocos repintados ── */
.onair-lamp { box-shadow: 0 0 0 1px #ff6b75; }                 /* sin resplandor difuso: es caro de pintar */
.onair-dot { box-shadow: none; animation: onair-blink 1.2s steps(2, jump-none) infinite; }  /* parpadea en 2 pasos, no a 60 cuadros/s */
@keyframes onair-blink { 0% { opacity: 1; } 100% { opacity: .25; } }
.pr-bar div { transition: none; }
.pr-banner.air { box-shadow: none; }
.pr-row.on .s { box-shadow: none; }

/* ── Sistema reorganizado ── */
.sys-layout { grid-template-columns: 1.1fr 1fr 1fr; }
.op-now { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; margin: 8px 0; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.op-now b { font-size: 15px; }
.op-set { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: 13px; }
.op-set > label { color: var(--muted); }
.op-set input[type=number] { width: 62px; }
.op-set small { display: block; margin-top: 2px; }
.op-set .dim { opacity: .45; }
.op-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.op-hist-title { margin-top: 14px; }
.relay-try { width: 100%; padding: 10px; margin: 4px 0 4px; }
.warn-note { color: var(--warn); margin: 0 0 8px; }
.sys-more { margin: 6px 0 4px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; }
.sys-more summary { cursor: pointer; padding: 8px 0; color: var(--muted); font-size: 13px; }
.sys-more[open] { padding-bottom: 10px; }
.sys-more[open] summary { color: var(--text); }
.sys-sub { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.sys-btn3 { margin-top: 4px; }
@media (max-width: 1100px) { .sys-layout { grid-template-columns: 1fr; } }

.disk-sum { margin: 4px 0 2px; }
.disk-more summary { cursor: pointer; font-size: 12px; color: var(--accent-2); padding: 2px 0; }
#relayHistory { max-height: 132px; }

/* Dispositivos de audio con nombre claro */
.device .dev-title { font-weight: 600; }
.device .dev-rec { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ok); border: 1px solid var(--ok); border-radius: 4px; padding: 0 5px; margin-left: 6px; }
.device.rec:not(.selected) { border-color: rgba(60, 207, 106, .45); }
.device .dev-state { color: var(--ok); font-weight: 600; white-space: nowrap; }

/* Lectura del tono: ancho fijo para que no "salte" cuando cambian los dígitos */
.tone-value { min-width: 0; flex: none; font-variant-numeric: tabular-nums; }
#toneVal, #tone35 { display: inline-block; width: 5ch; text-align: right; }
#toneThr { display: inline-block; width: 5ch; text-align: left; }
.tone-count { flex: none; min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; }
.tone-sig { flex: none; min-width: 58px; text-align: center; }

.upd-row { display: flex; gap: 10px; align-items: center; }
.upd-info { flex: 1; display: grid; gap: 3px; justify-items: start; }

/* Ventana "Recibiendo pauta de Lima" */
.sync-card { position: fixed; right: 18px; bottom: 18px; z-index: 70; width: min(440px, calc(100vw - 36px)); padding: 12px 14px;
  background: #1a1a1a; border: 1px solid var(--accent-2); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); display: grid; gap: 6px; }
.sync-card.done { border-color: var(--ok); }
.sync-head { display: flex; align-items: center; gap: 10px; }
.sync-head b { font-size: 15px; }
.sync-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent); color: #fff; }
.sync-card.done .sync-icon { background: var(--ok); color: #08130c; }
.sync-body { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.sync-bar { height: 8px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.sync-bar i { display: block; height: 100%; width: 0; background: var(--accent-2); }

/* ── Pestañas agrupadas ── */
.tabs { display: flex !important; gap: 4px; }
.tabs > .tab { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tabs > .tab-group { flex: 2.6 1 0; padding: 4px 6px; gap: 4px; cursor: default; }
.tab-glabel { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; opacity: .8; padding: 0 8px 0 4px; white-space: nowrap; }
.subtab { flex: 1; align-self: stretch; border: 1px solid rgba(255,255,255,.18); border-radius: calc(var(--radius) - 2px); background: rgba(0,0,0,.18);
  color: #f0f0f0; font: inherit; font-size: 15px; cursor: pointer; white-space: nowrap; min-width: 0; }
.subtab:hover { background: rgba(255,255,255,.12); }
.subtab.on { background: #fff; color: #1a1a1a; font-weight: 700; border-color: #fff; }
.tab-n { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 99px; background: rgba(255,255,255,.1); color: var(--muted); }
/* En modo corte automático, el botón SEÑAL LIMA (receptor) no aplica */
body.modo-corte .navrow > .transport { display: none; }
body.modo-corte .navrow { grid-template-columns: 1fr; }
@media (max-width: 600px) { .tabs { flex-wrap: wrap; } .tabs > .tab { flex: 1 1 30%; } .tabs > .tab-group { flex: 1 1 100%; } }

.upd-row { margin: 8px 0 2px; }
.upd-lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; white-space: nowrap; }
.upd-info { display: flex; }
#cityNote { margin: 2px 0 0; }
.sys-sub { margin: 6px 0 3px; }
.sys-card h3 { margin-top: 10px; }
.sys-card h3:first-child { margin-top: 0; }

/* ── Registros .log / .raz ── */
#tab-logs:not(.hidden) { display: flex; flex-direction: column; gap: 10px; height: 100%; min-height: 0; }
.lg-bar { display: flex; gap: 12px; align-items: center; }
.lg-date { display: flex; gap: 6px; align-items: center; }
.lg-input { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 14px; color-scheme: dark; }
.lg-resumen { flex: 1; color: var(--muted); font-size: 14px; }
.lg-buscar { width: 240px; }
.lg-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.lg-card { min-height: 0; display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lg-card header { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.lg-card header b { color: #f2c230; font-size: 15px; }
.lg-n { margin-left: auto; font: 12px var(--mono); color: var(--muted); background: rgba(255,255,255,.06); border-radius: 99px; padding: 2px 8px; }
.lg-card a.disabled { opacity: .4; pointer-events: none; }
.lg-list { flex: 1; min-height: 0; overflow: auto; background: #0e0e0e; padding: 4px 0; }
.lg-row { display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 4px 12px; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,.04); }
.lg-row:hover { background: rgba(255,255,255,.04); }
.lg-h { font-family: var(--mono); color: var(--muted); }
.lg-row b { color: #fff; font-family: var(--mono); }
.lg-row.man span:last-child { color: #5ab0ff; }
.lg-row.warn span:last-child { color: #f2c230; }
.lg-row.bad span:last-child { color: #ff7b72; }
.lg-vacio { padding: 20px; text-align: center; color: var(--muted); }
@media (min-width: 1100px) and (min-height: 680px) {
  .content:has(#tab-logs:not(.hidden)) { overflow: hidden; display: flex; flex-direction: column; }
  #tab-logs:not(.hidden) { flex: 1; }
}
@media (max-width: 1100px) { .lg-cols { grid-template-columns: 1fr; } .lg-list { max-height: 50vh; } .lg-bar { flex-wrap: wrap; } .lg-buscar { width: 100%; } }

/* Pautas: calendario común + resumen del día */
.pt-days { align-items: center; gap: 12px; }
.pt-diainfo { color: var(--muted); font-size: 14px; }
.pt-diainfo.bad { color: var(--warn); }

/* Grupo abierto: fondo oscuro como las demás pestañas; solo la sub-pestaña elegida resalta (igual que una pestaña activa) */
.tabs > .tab.tab-group { background: linear-gradient(#303030, #252525); border-color: var(--line-2); }
.tab-group .tab-glabel { color: var(--muted); opacity: 1; }
.subtab { background: rgba(255,255,255,.04); border-color: var(--line-2); color: var(--text); }
.subtab:hover { border-color: var(--accent); background: rgba(255,255,255,.08); }
.subtab.on { background: linear-gradient(#4a4a4a, #363636); border-color: #e5484d; color: #fff; font-weight: 700; }

/* ── Medidor IN (entrada de línea) estilo Omnia ── */
.in-meter { display: flex; align-items: center; gap: 10px; width: 100%; }
.in-label { font-size: 22px; font-weight: 700; color: #f0f0f0; letter-spacing: .02em; }
.in-body { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 3px; }
.in-bar { position: relative; height: 7px; border-radius: 2px; overflow: hidden;
  background: linear-gradient(90deg, #3ccf6a 0%, #3ccf6a 75%, #f2c230 83%, #f2c230 92%, #ef4444 96%); }
/* tapa oscura: deja ver los LEDs apagados (tenues) */
.in-bar > div { position: absolute; inset: 0; background: rgba(18,18,18,.88); transform-origin: right center; transform: scaleX(1); will-change: transform; transition: none !important; }
/* separaciones entre LEDs */
.in-bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 3px, #0e0e0e 3px 4px); pointer-events: none; }
.in-scale { position: relative; display: flex; justify-content: space-between; margin-top: 2px; padding-top: 5px; font: 11px var(--mono); color: #b8b8b8;
  background: repeating-linear-gradient(90deg, #8a8a8a 0 1px, transparent 1px calc((100% - 1px) / 6)) top / 100% 4px no-repeat; }
.in-scale span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.in-db { font-size: 12px; min-width: 52px; text-align: right; color: var(--muted); }
.top-cell.src-cell .in-meter { flex: 1 1 auto; }

/* IN y OUT del mismo ancho; CPU más angosta */
.in-label { min-width: 2.6em; }
.top-cell.cpu-cell { flex: 0 1 80px; }

/* IN/OUT de −60 a 0 dB (pasos de 12): amarillo desde −12, rojo desde −3 */
.in-bar { background: linear-gradient(90deg, #3ccf6a 0%, #3ccf6a 78%, #f2c230 81%, #f2c230 93%, #ef4444 96%); }
.in-scale { background: repeating-linear-gradient(90deg, #8a8a8a 0 1px, transparent 1px calc((100% - 1px) / 5)) top / 100% 4px no-repeat; }

/* Reloj en la barra superior */
.top-clock { font-size: 20px; font-weight: 700; letter-spacing: .03em; color: #f0f0f0; }
#topFecha { text-transform: capitalize; }

/* ── Pantallas angostas (ej. 1280x720 del kiosco): IN/OUT compactos, sin encimarse ── */
.top-cell.src-cell { min-width: 0; }
.in-body { min-width: 0; }
@media (max-width: 1500px) {
  .top-cell.narrow { flex: 0 1 96px; min-width: 0; }
  .top-cell.cpu-cell { flex: 0 1 58px; }
  .top-cell.src-cell { gap: 6px; padding-left: 8px; padding-right: 8px; overflow: hidden; }
  .in-meter { gap: 6px; }
  .in-label { font-size: 15px; min-width: 2.3em; }
  .in-db { display: none; }
  .in-scale { font-size: 9px; }
  .top-label { font-size: 9px; }
  .top-value, .state-pill { font-size: 12px; }
  .top-clock { font-size: 15px; }
}
/* El reloj nunca se corta */
.top-cell:has(#topHora) { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
#topFecha { white-space: nowrap; }
@media (max-width: 1500px) {
  .top-cell.city-name { padding: 0 12px; font-size: 16px; }
  .top-cell.narrow .top-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
/* Barra superior adaptable a cualquier monitor: las casillas crecen hasta que entre su texto */
@media (max-width: 1500px) {
  .top-cell.narrow { flex: 1 1 auto; min-width: 0; padding-left: 6px; padding-right: 6px; }
  .top-cell.cpu-cell { flex: 0 1 auto; }
  .top-cell.grow.src-cell { flex: 2 1 150px; }
}
