/* 4NDECIDED · Archivo
   Paleta Oxocarbon (https://github.com/nyoom-engineering/oxocarbon) con los nombres de variables de shadcn/ui. */
@font-face { font-family: "Bebas Neue"; src: url(/vendor/bebas-neue.woff2?v=5.2.5) format("woff2"); font-display: swap; }
@font-face { font-family: "Inter"; src: url(/vendor/inter.woff2?v=5.2.5) format("woff2"); font-weight: 100 900; font-display: swap; }

:root, :root[data-tema="dark"] {
  --background: #161616;       /* base00 */
  --foreground: #f2f4f8;       /* base05 */
  --card: #262626;             /* base01 */
  --card-foreground: #f2f4f8;
  --popover: #262626;
  --popover-foreground: #f2f4f8;
  --primary: #ee5396;          /* base10 */
  --primary-foreground: #161616;
  --secondary: #393939;        /* base02 */
  --secondary-foreground: #f2f4f8;
  --muted: #262626;
  --muted-foreground: #a2a9b0;
  --accent: #393939;
  --accent-foreground: #f2f4f8;
  --destructive: #fa4d56;
  --border: #393939;
  --input: #525252;            /* base03 */
  --ring: #78a9ff;             /* base09 */
  --radius: .5rem;
  --chart-1: #ee5396; --chart-2: #78a9ff; --chart-3: #08bdba; --chart-4: #be95ff; --chart-5: #42be65;
  --chart-6: #ff7eb6; --chart-7: #33b1ff;
  --grano-opacidad: .07;
  color-scheme: dark;
}
:root[data-tema="light"] {
  --background: #ffffff;
  --foreground: #161616;
  --card: #f2f4f8;
  --card-foreground: #161616;
  --popover: #ffffff;
  --popover-foreground: #161616;
  --primary: #d02670;
  --primary-foreground: #ffffff;
  --secondary: #dde1e6;
  --secondary-foreground: #161616;
  --muted: #f2f4f8;
  --muted-foreground: #525252;
  --accent: #dde1e6;
  --accent-foreground: #161616;
  --destructive: #da1e28;
  --border: #dde1e6;
  --input: #a2a9b0;
  --ring: #0f62fe;
  --chart-1: #d02670; --chart-2: #0f62fe; --chart-3: #009d9a; --chart-4: #8a3ffc; --chart-5: #198038;
  --chart-6: #9f1853; --chart-7: #0072c3;
  --grano-opacidad: .05;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(60rem 28rem at 85% -8%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
    radial-gradient(40rem 24rem at -10% 110%, color-mix(in srgb, var(--chart-2) 10%, transparent), transparent 70%),
    var(--background);
  background-attachment: fixed;
  color: var(--foreground);
}
.grano {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: var(--grano-opacidad); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; }
h3 { font-size: .95rem; font-weight: 600; margin-bottom: .75rem; }
.titular { font-family: "Bebas Neue", Impact, "Arial Narrow", sans-serif; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }
h1.titular { font-size: 2.4rem; }
h2.titular { font-size: 2.1rem; }
.suave { color: var(--muted-foreground); }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---- shadcn: tarjeta, botón, campo ---- */
.tarjeta {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 1.25rem;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; white-space: nowrap;
  height: 2.5rem; padding: 0 1rem; border-radius: var(--radius); border: 1px solid transparent;
  font: 500 .875rem/1 "Inter", sans-serif; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 1.1rem; height: 1.1rem; flex: none; }
.btn-primario { background: var(--primary); color: var(--primary-foreground); }
.btn-primario:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 88%, var(--foreground)); }
.btn-contorno { background: transparent; border-color: var(--input); color: var(--foreground); }
.btn-contorno:hover { background: var(--accent); }
.btn-fantasma { background: transparent; color: var(--foreground); }
.btn-fantasma:hover { background: var(--accent); }
.btn-icono { width: 2.5rem; padding: 0; }
.campo { display: flex; flex-direction: column; gap: .4rem; font-size: .8rem; font-weight: 500; min-width: 0; }
.campo > span { color: var(--muted-foreground); }
.campo input[type=password], .campo input[type=text] {
  height: 2.5rem; padding: 0 .75rem; border-radius: var(--radius);
  border: 1px solid var(--input); background: transparent; color: var(--foreground); font: inherit; font-size: .95rem;
}
.error { margin: 0; color: var(--destructive); font-size: .85rem; }

/* ---- acceso ---- */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.acceso-caja { width: min(26rem, 100%); display: grid; gap: 1rem; text-align: center; justify-items: stretch; padding: 2rem 1.5rem; }
.acceso-caja .campo { text-align: left; }
.acceso-logo { justify-self: center; border-radius: 1rem; border: 1px solid var(--border); }

/* ---- cabecera y pestañas ---- */
.cabecera {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 82%, transparent); backdrop-filter: blur(10px);
}
.marca { display: flex; align-items: center; gap: .75rem; color: var(--foreground); text-decoration: none; }
.marca img { border-radius: .5rem; border: 1px solid var(--border); }
.marca .titular { font-size: 1.6rem; }
.marca small { font-size: .95rem; color: var(--primary); letter-spacing: .12em; margin-left: .25rem; }
.pestanas { display: inline-flex; padding: .25rem; gap: .125rem; background: var(--muted); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); margin: 0 auto; }
.pestanas button {
  height: 2rem; padding: 0 .9rem; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted-foreground);
  font: 500 .875rem/1 "Inter", sans-serif; cursor: pointer; transition: background-color .15s, color .15s;
}
.pestanas button:hover { color: var(--foreground); }
.pestanas button[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.acciones { display: flex; align-items: center; gap: .25rem; }

main { padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 8rem; max-width: 80rem; margin: 0 auto; }
.vista-cab { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.25rem; }
.vista-cab p { margin: .5rem 0 0; max-width: 46rem; }
.pie { text-align: center; padding: 2rem 1rem 7rem; color: var(--muted-foreground); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

/* ---- filtros ---- */
.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }

/* ---- Choices.js con las variables ---- */
.choices { margin: 0; font-size: .875rem; }
.choices__inner {
  min-height: 2.5rem; padding: .3rem .5rem; border-radius: var(--radius); border: 1px solid var(--input);
  background: transparent; color: var(--foreground); font-size: .875rem;
}
.is-focused .choices__inner, .is-open .choices__inner { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
.choices__input { background: transparent; color: var(--foreground); margin-bottom: 0; padding: .25rem 0; }
.choices__placeholder { opacity: .7; }
.choices__list--multiple .choices__item {
  background: var(--secondary); border: 1px solid var(--border); color: var(--secondary-foreground);
  border-radius: calc(var(--radius) - 2px); padding: .15rem .5rem; margin: .15rem .25rem .15rem 0; font-size: .8rem; font-weight: 500;
}
.choices__list--multiple .choices__item.is-highlighted { background: var(--accent); border-color: var(--input); }
.choices[data-type*="select-multiple"] .choices__button { border-left: 1px solid var(--input); filter: invert(.6); }
.choices__list--dropdown, .choices__list[aria-expanded] {
  background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / .35); z-index: 30;
}
.is-open .choices__list--dropdown { border-color: var(--border); }
.choices__list--dropdown .choices__item--selectable.is-highlighted, .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background: var(--accent); color: var(--accent-foreground);
}
.choices__list--dropdown .choices__item { font-size: .875rem; }
.choices__list--dropdown .choices__item--selectable::after { display: none; }
.choices__item--disabled, .has-no-results { color: var(--muted-foreground); }
.choices[data-type*="select-multiple"] .choices__inner { cursor: pointer; }

/* ---- DataTables con las variables ---- */
.dt-container { color: var(--foreground); font-size: .875rem; }
.dt-container .dt-layout-row { margin: .75rem 0; gap: 1rem; }
.dt-container .dt-search input, .dt-container .dt-length select {
  height: 2.25rem; padding: 0 .65rem; border-radius: var(--radius); border: 1px solid var(--input);
  background: transparent; color: var(--foreground); font: inherit; margin-left: .5rem;
}
.dt-container .dt-length select option { background: var(--popover); color: var(--popover-foreground); }
.dt-container .dt-search input:focus, .dt-container .dt-length select:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
table.dataTable { border-collapse: collapse; width: 100%; color: var(--foreground); }
table.dataTable thead th, table.dataTable thead td {
  border-bottom: 1px solid var(--border) !important; padding: .6rem .75rem; text-align: left; font-size: .72rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); font-weight: 600;
}
table.dataTable tbody tr { background: transparent !important; }
table.dataTable tbody tr > * { box-shadow: none !important; background-color: transparent; }
table.dataTable tbody td { padding: .55rem .75rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); vertical-align: middle; }
table.dataTable tbody tr:hover > * { box-shadow: none !important; background: color-mix(in srgb, var(--accent) 55%, transparent) !important; color: var(--foreground) !important; }
table.dataTable tbody tr.sonando > * { background: color-mix(in srgb, var(--primary) 14%, transparent) !important; color: var(--foreground) !important; box-shadow: none !important; }
table.dataTable tbody tr.sonando td:nth-child(2) { color: var(--primary); font-weight: 600; }
table.dataTable.no-footer { border-bottom: 0; }
table.dataTable td.num, table.dataTable th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.dataTable thead .dt-orderable-asc, table.dataTable thead .dt-orderable-desc { cursor: pointer; }
table.dataTable thead > tr > th.dt-orderable-asc:hover, table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: none; color: var(--foreground); }
table.dataTable thead > tr > th.dt-ordering-asc, table.dataTable thead > tr > th.dt-ordering-desc { color: var(--foreground); }
.dt-container .dt-info { color: var(--muted-foreground); }
.dt-container .dt-paging .dt-paging-button {
  min-width: 2.25rem; height: 2.25rem; padding: 0 .5rem; margin-left: .25rem; border-radius: var(--radius);
  border: 1px solid var(--input) !important; background: transparent !important; color: var(--foreground) !important;
}
.dt-container .dt-paging .dt-paging-button:hover:not(.disabled) { background: var(--accent) !important; color: var(--accent-foreground) !important; }
.dt-container .dt-paging .dt-paging-button.current, .dt-container .dt-paging .dt-paging-button.current:hover {
  background: var(--primary) !important; color: var(--primary-foreground) !important; border-color: var(--primary) !important;
}
.dt-container .dt-paging .dt-paging-button.disabled { opacity: .4; }
.dt-empty { color: var(--muted-foreground); text-align: center; padding: 2rem 0 !important; }
.icono-celda { display: inline-flex; width: 2.1rem; height: 2.1rem; padding: 0; }
.vista-previa { width: 7.5rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: calc(var(--radius) - 2px); background: var(--secondary); border: 1px solid var(--border); display: block; cursor: pointer; }
.vista-previa-ph { display: grid; place-items: center; color: var(--muted-foreground); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.etiqueta { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: var(--secondary); color: var(--secondary-foreground); font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.enlace-fila { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.enlace-fila:hover { color: var(--primary); }

/* ---- subidas ---- */
.zona {
  display: grid; gap: .25rem; justify-items: center; text-align: center; padding: 2rem 1rem; cursor: pointer;
  border: 1.5px dashed var(--input); border-radius: calc(var(--radius) + 2px); background: color-mix(in srgb, var(--background) 40%, transparent);
  transition: border-color .15s, background-color .15s;
}
.zona:hover, .zona.sobre { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.zona strong { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; font-size: 1.5rem; letter-spacing: .06em; text-transform: uppercase; }
.nota { font-size: .8rem; margin: .5rem 0 0; }
.cola { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .5rem; }
.cola li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: center; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; }
.cola .barra { grid-column: 1 / -1; height: .35rem; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.cola .barra i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.cola .estado { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.cola li.ok .estado { color: var(--chart-5); }
.cola li.mal .estado { color: var(--destructive); }
.cola li.mal .barra i { background: var(--destructive); }

/* ---- estadísticas ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { padding: 1rem 1.25rem; }
.kpi span { display: block; color: var(--muted-foreground); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.kpi strong { font-family: "Bebas Neue", Impact, sans-serif; font-weight: 400; font-size: 2.6rem; letter-spacing: .04em; line-height: 1.1; }
.kpi small { color: var(--muted-foreground); font-size: .8rem; margin-left: .25rem; }
.graficos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(30rem, 100%), 1fr)); gap: 1rem; }
.graficos .ancho { grid-column: 1 / -1; }
.grafico { height: 20rem; width: 100%; }
.graficos .ancho .grafico { height: 22rem; }

/* ---- reproductor ---- */
.reproductor {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: minmax(10rem, 1fr) auto minmax(14rem, 2fr) 7rem; align-items: center; gap: 1rem;
  padding: .75rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
}
.rep-info { display: grid; min-width: 0; }
.rep-info strong, .rep-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-info span { font-size: .8rem; }
.rep-control { display: flex; align-items: center; gap: .25rem; }
.rep-barra { display: flex; align-items: center; gap: .6rem; }
.tiempo { font-size: .75rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: center; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: .35rem; border-radius: 999px; background: var(--secondary); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: .95rem; height: .95rem; border-radius: 50%; background: var(--primary); border: 2px solid var(--background); }
input[type=range]::-moz-range-thumb { width: .95rem; height: .95rem; border-radius: 50%; background: var(--primary); border: 2px solid var(--background); }
.rep-vol { display: block; }

/* ---- visor ---- */
.visor { width: min(70rem, 94vw); padding: 0; border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); background: var(--card); color: var(--card-foreground); }
.visor::backdrop { background: rgb(0 0 0 / .72); backdrop-filter: blur(3px); }
.visor-cab { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem .5rem .5rem 1rem; border-bottom: 1px solid var(--border); }
.visor-cab strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor-cuerpo { display: grid; place-items: center; background: #000; }
.visor-cuerpo video, .visor-cuerpo img { max-width: 100%; max-height: 78vh; display: block; }

@media (max-width: 1100px) {
  .pestanas { order: 3; width: 100%; justify-content: space-between; margin: 0; }
  .pestanas button { flex: 1; padding: 0 .4rem; }
  .acciones { margin-left: auto; }
  .reproductor { grid-template-columns: 1fr auto; row-gap: .5rem; }
  .rep-barra { grid-column: 1 / -1; order: 3; }
  .rep-vol { display: none; }
  .vista-cab h2.titular { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* =====================================================================================================
   Móvil y táctil (se añade al final para pisar lo anterior)
   ===================================================================================================== */
* { -webkit-tap-highlight-color: transparent; }
button, a, summary, .zona, select, input[type=range] { touch-action: manipulation; }
.solo-movil { display: none; }
.celda-titulo .t { overflow-wrap: anywhere; }
.celda-titulo .meta { display: none; }
.filtros-caja > summary { display: none; }
main { padding-bottom: calc(8rem + env(safe-area-inset-bottom)); }
.reproductor { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }

select.selector {
  height: 2.5rem; padding: 0 .75rem; border-radius: var(--radius); border: 1px solid var(--input);
  background: transparent; color: var(--foreground); font: inherit; font-size: .95rem;
}
select.selector option { background: var(--popover); color: var(--popover-foreground); }

/* deslizadores con zona táctil cómoda: la pista es fina, el pulgar grande */
input[type=range] { height: 1.75rem; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: .35rem; border-radius: 999px; background: var(--secondary); }
input[type=range]::-moz-range-track { height: .35rem; border-radius: 999px; background: var(--secondary); }
input[type=range]::-webkit-slider-thumb { width: 1.2rem; height: 1.2rem; margin-top: calc((.35rem - 1.2rem) / 2); }
input[type=range]::-moz-range-thumb { width: 1.2rem; height: 1.2rem; }

.filtros-caja > summary::-webkit-details-marker { display: none; }

@media (max-width: 1100px) {
  body { font-size: 15px; }

  /* cabecera: la primera fila (marca y botones) se va al bajar; las pestañas se quedan fijas */
  .cabecera { top: -3.5rem; padding: 0 1rem .5rem; gap: 0 .5rem; flex-wrap: wrap; }
  .marca { flex: 1; min-width: 0; min-height: 3.5rem; }
  .marca img { width: 34px; height: 34px; }
  .marca .titular { font-size: 1.4rem; white-space: nowrap; }
  .marca small { display: none; }
  .acciones { min-height: 3.5rem; gap: 0; margin-left: 0; }
  .btn-icono { width: 2.75rem; height: 2.75rem; }
  #b-salir { width: 2.75rem; height: 2.75rem; padding: 0; border-color: transparent; }
  #b-salir .txt { display: none; }
  .pestanas { order: 3; width: 100%; margin: 0; }
  .pestanas button { flex: 1; height: 2.5rem; padding: 0 .25rem; font-size: .82rem; }

  main { padding: 1rem .75rem calc(9rem + env(safe-area-inset-bottom)); }
  .vista-cab { margin-bottom: .75rem; }
  .vista-cab p { font-size: .9rem; }
  h2.titular { font-size: 1.9rem; }
  .tarjeta { padding: .75rem; border-radius: calc(var(--radius) + 2px); }

  /* filtros plegables */
  .filtros-caja { margin-bottom: .75rem; }
  .filtros-caja > summary {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem; height: 2.75rem; padding: 0 .9rem;
    border: 1px solid var(--input); border-radius: var(--radius); cursor: pointer; font-weight: 500; list-style: none;
  }
  .filtros-caja > summary::after {
    content: ""; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px); margin-left: auto; transition: transform .15s;
  }
  .filtros-caja[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
  .filtros-caja[open] > summary { margin-bottom: .75rem; }
  .cuenta { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; margin-left: .4rem; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-size: .75rem; font-weight: 700; }
  .filtros { grid-template-columns: 1fr; gap: .75rem; margin-bottom: 0; }
  .solo-movil { display: flex; margin-bottom: .75rem; }
  select.selector, .campo input[type=password], .choices__input, .dt-container .dt-search input { font-size: 16px; }
  select.selector, .choices__inner { min-height: 2.75rem; height: 2.75rem; }
  .choices__inner { height: auto; }

  /* tablas en forma de lista */
  table.dataTable .solo-escritorio { display: none; }
  .celda-titulo .meta { display: block; margin-top: .15rem; font-size: .75rem; color: var(--muted-foreground); letter-spacing: .02em; }
  table.dataTable thead { display: none; }
  table.dataTable tbody td { padding: .6rem .35rem; }
  table.dataTable tbody td:first-child { padding-left: 0; width: 1%; }
  .icono-celda { width: 2.75rem; height: 2.75rem; }
  .vista-previa { width: 6.5rem; }
  .dt-container .dt-layout-row { flex-direction: column; align-items: stretch; gap: .5rem; margin: .5rem 0; }
  .dt-container .dt-layout-cell { width: 100%; }
  .dt-container .dt-length { display: none; }
  .dt-container .dt-search { display: block; }
  .dt-container .dt-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dt-container .dt-search input { width: 100%; height: 2.75rem; margin: 0; }
  .dt-container .dt-info { text-align: center; }
  .dt-container .dt-paging { display: flex; justify-content: center; }
  .dt-container .dt-paging .dt-paging-button { min-width: 2.75rem; height: 2.75rem; }
  .dt-container .dt-paging .dt-paging-button.first, .dt-container .dt-paging .dt-paging-button.last { display: none; }

  /* subidas */
  .zona { padding: 1.5rem 1rem; }
  .cola li { grid-template-columns: 1fr; }
  .cola .estado { grid-row: 2; }
  .cola .barra { grid-column: 1; }

  /* estadísticas */
  .kpi { padding: .75rem 1rem; }
  .kpi strong { font-size: 2.1rem; }
  .grafico, .graficos .ancho .grafico { height: 16rem; }

  /* reproductor compacto */
  .reproductor { grid-template-columns: 1fr auto; gap: .35rem .75rem; padding: .5rem 1rem calc(.5rem + env(safe-area-inset-bottom)); }
  .rep-control .btn { width: 2.75rem; height: 2.75rem; }
  .rep-barra { grid-column: 1 / -1; order: 3; }
  .rep-vol { display: none; }

  /* visor casi a pantalla completa */
  .visor { width: calc(100vw - 1rem); }
  .visor-cuerpo video, .visor-cuerpo img { max-height: 70vh; }
}

/* móvil en horizontal: poca altura, la cabecera no se queda fija */
@media (max-height: 520px) and (max-width: 960px) {
  .cabecera { position: static; }
  .reproductor { padding-top: .35rem; padding-bottom: calc(.35rem + env(safe-area-inset-bottom)); }
  .visor-cuerpo video, .visor-cuerpo img { max-height: 62vh; }
}

/* el campo de búsqueda de DataTables lleva su propia regla más específica */
.dt-container .dt-search input[type="search"], .dt-container .dt-search input {
  border: 1px solid var(--input) !important; border-radius: var(--radius) !important; background: transparent !important;
  color: var(--foreground) !important; padding: 0 .75rem !important;
}
.dt-container .dt-search input:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.choices { border-radius: var(--radius); }
.is-open .choices__inner { border-radius: var(--radius) var(--radius) 0 0; }
.choices__list--dropdown { border-radius: 0 0 var(--radius) var(--radius); }
@media (max-width: 1100px) {
  .dt-container .dt-paging .dt-paging-button { min-width: 2.75rem !important; padding: 0 .5rem !important; }
}

/* =====================================================================================================
   Editar nombre y detalles, e historial
   ===================================================================================================== */
.nota-fila { display: block; max-width: 36rem; margin-top: .1rem; font-size: .8rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visor.editor { width: min(36rem, calc(100vw - 1rem)); max-height: calc(100vh - 1.5rem); overflow: auto; }
@supports (height: 100dvh) { .visor.editor { max-height: calc(100dvh - 1.5rem); } }
.editor-cuerpo { display: grid; gap: .9rem; padding: 1rem; }
.editor-cuerpo p { margin: 0; }
.campo textarea {
  padding: .6rem .75rem; border-radius: var(--radius); border: 1px solid var(--input); background: transparent;
  color: var(--foreground); font: inherit; font-size: .95rem; resize: vertical; min-height: 5rem;
}
.campo input[type=text] { width: 100%; }
.con-sufijo { display: flex; align-items: center; border: 1px solid var(--input); border-radius: var(--radius); }
.con-sufijo:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.con-sufijo input { flex: 1; min-width: 0; border: 0 !important; outline: 0 !important; background: transparent; }
.sufijo { padding: 0 .75rem 0 0; color: var(--muted-foreground); font-variant-numeric: tabular-nums; font-weight: 500; }
.editor-botones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--card); }
.editor-botones .espacio { margin-right: auto; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.hist li { display: grid; gap: .35rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; }
.hist .h-d { overflow-wrap: anywhere; }
.hist .btn { justify-self: start; height: 2.25rem; }

@media (max-width: 1100px) {
  .campo textarea, .campo input[type=text] { font-size: 16px; }
  .campo input[type=text] { height: 2.75rem; }
  .editor-botones .btn { height: 2.75rem; }
  .hist .btn { height: 2.75rem; }
}

/* =====================================================================================================
   Reproductor: barra, pantalla «Sonando ahora», deslizadores con zona cargada
   ===================================================================================================== */
.reproductor { grid-template-columns: minmax(11rem, 1.1fr) auto minmax(14rem, 2fr) 10rem; }
.rep-info { display: flex; align-items: center; gap: .75rem; min-width: 0; padding: .25rem; margin: -.25rem; border: 0; border-radius: var(--radius); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rep-info:hover { background: var(--accent); }
.rep-portada { flex: none; width: 44px; height: 44px; border-radius: .4rem; border: 1px solid var(--border); object-fit: cover; }
.rep-textos { display: grid; min-width: 0; }
.rep-textos strong, .rep-textos span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-textos span { font-size: .8rem; }
.rep-control .btn.activo { color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
.rep-control .btn-primario.activo { color: var(--primary-foreground); background: var(--primary); }
.rep-vol { display: flex; align-items: center; gap: .25rem; }
.rep-vol .btn { flex: none; }
.rep-vol input { min-width: 0; }

/* barra de posición: lo reproducido, lo ya cargado y lo que falta */
input[data-rep="pos"] { --prog: 0%; --buf: 0%; }
input[data-rep="pos"]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--primary) var(--prog), color-mix(in srgb, var(--muted-foreground) 45%, var(--secondary)) var(--prog), color-mix(in srgb, var(--muted-foreground) 45%, var(--secondary)) var(--buf), var(--secondary) var(--buf));
}
input[data-rep="pos"]::-moz-range-track {
  background: linear-gradient(to right, var(--primary) var(--prog), color-mix(in srgb, var(--muted-foreground) 45%, var(--secondary)) var(--prog), color-mix(in srgb, var(--muted-foreground) 45%, var(--secondary)) var(--buf), var(--secondary) var(--buf));
}
input[data-rep="vol"] { --prog: 80%; }
input[data-rep="vol"]::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--primary) var(--prog), var(--secondary) var(--prog)); }
input[data-rep="vol"]::-moz-range-track { background: linear-gradient(to right, var(--primary) var(--prog), var(--secondary) var(--prog)); }

/* esperando datos */
.btn.cargando svg { opacity: 0; }
.btn.cargando { position: relative; }
.btn.cargando::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1.1rem; height: 1.1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: gira .7s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.cargando::after { animation-duration: 2s; } }

.etiqueta-letra { margin-left: .35rem; background: color-mix(in srgb, var(--chart-4) 22%, var(--secondary)); font-size: .65rem; vertical-align: middle; }

/* pantalla «Sonando ahora» */
.visor.ahora { width: min(60rem, calc(100vw - 1rem)); max-height: calc(100vh - 1.5rem); overflow: hidden; }
@supports (height: 100dvh) { .visor.ahora { max-height: calc(100dvh - 1.5rem); } }
.ahora-cuerpo { display: grid; grid-template-columns: minmax(16rem, 22rem) 1fr; gap: 1.5rem; padding: 1.25rem; max-height: calc(100vh - 6rem); overflow: auto; }
@supports (height: 100dvh) { .ahora-cuerpo { max-height: calc(100dvh - 6rem); } }
.ahora-izq { display: grid; gap: .75rem; align-content: start; justify-items: center; text-align: center; }
.ahora-izq > * { width: 100%; }
.ahora-izq h3.titular { font-size: 1.9rem; margin: .25rem 0 0; overflow-wrap: anywhere; }
.ahora-izq p { margin: 0; }
.ahora-portada { width: min(14rem, 60%); height: auto; aspect-ratio: 1; justify-self: center; border-radius: 1rem; border: 1px solid var(--border); box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
.ahora-control { display: flex; justify-content: center; align-items: center; gap: .25rem; }
.btn-icono.grande { width: 3.5rem; height: 3.5rem; border-radius: 999px; }
.btn-icono.grande svg { width: 1.5rem; height: 1.5rem; }
.rep-vol.visible { display: flex; justify-content: center; }
.rep-vol.visible input { max-width: 12rem; }
.ahora-der h4 { margin: 0 0 .5rem; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.ahora-der h4:not(:first-child) { margin-top: 1.25rem; }
.letra { margin: 0; padding: .9rem 1rem; max-height: 20rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--background) 45%, transparent); font: inherit; font-size: 1rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.letra.vacia { color: var(--muted-foreground); font-size: .9rem; }
.a-cola { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.a-cola button { display: flex; justify-content: space-between; gap: .75rem; width: 100%; min-height: 2.5rem; padding: .35rem .65rem; border: 0; border-radius: var(--radius); background: transparent; color: var(--foreground); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.a-cola button:hover { background: var(--accent); }
.a-cola .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-cola .suave { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; }

@media (max-width: 1100px) {
  .reproductor { grid-template-columns: 1fr auto; }
  .rep-extra { display: none; }
  .rep-info { min-height: 2.75rem; }
  .rep-portada { width: 40px; height: 40px; }
  .ahora-cuerpo { grid-template-columns: 1fr; gap: 1rem; padding: 1rem; }
  .ahora-izq h3.titular { font-size: 1.6rem; }
  .ahora-portada { width: min(10rem, 45%); }
  .letra { max-height: 16rem; }
  .a-cola button { min-height: 2.75rem; }
}

/* ajustes móviles del reproductor */
@media (max-width: 1100px) {
  .reproductor .rep-vol { display: none; }
  .ahora-izq .rep-barra { order: 0; grid-column: auto; }
}
@media (pointer: coarse) { .ahora-der .nota { display: none; } }

/* =====================================================================================================
   Quién eres, preguntas y registro
   ===================================================================================================== */
.quien-caja { width: min(34rem, 100%); }
.quien-caja .acceso-logo { width: 96px; height: 96px; }
.quien-lista { display: grid; gap: .6rem; }
.quien-op {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; padding: .6rem 1rem;
  border: 1px solid var(--input); border-radius: var(--radius); background: transparent; color: var(--foreground);
  font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s, transform .1s;
}
.quien-op:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); }
.quien-op:active { transform: scale(.99); }
.quien-op .rol { color: var(--muted-foreground); font-size: .85rem; letter-spacing: .04em; }
.quien-op .nom { font-family: "Bebas Neue", Impact, sans-serif; font-size: 1.7rem; letter-spacing: .06em; text-transform: uppercase; line-height: 1; }

.btn.persona { gap: .4rem; border-color: color-mix(in srgb, var(--primary) 55%, var(--input)); }
.btn.persona .nom { font-weight: 600; }

/* pestañas: ahora son seis; en pantallas estrechas se desplazan en horizontal */
.pestanas button { position: relative; }
.pestanas .cuenta { margin-left: .3rem; vertical-align: middle; }
@media (max-width: 1100px) {
  .pestanas { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .pestanas::-webkit-scrollbar { display: none; }
  .pestanas button { flex: none; padding: 0 .75rem; }
  .btn.persona { max-width: 6.5rem; padding: 0 .6rem; }
  .btn.persona .nom { overflow: hidden; text-overflow: ellipsis; }
}

/* burbuja de preguntas en cada fila */
.btn-preg { position: relative; }
.btn-preg .cuenta-mini { position: absolute; top: .1rem; right: .1rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .2rem; border-radius: 999px; background: var(--secondary); color: var(--secondary-foreground); font-size: .65rem; font-weight: 700; line-height: 1.05rem; text-align: center; }
.btn-preg.con-abiertas { color: var(--primary); }
.btn-preg.con-abiertas .cuenta-mini { background: var(--primary); color: var(--primary-foreground); }

.check { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: .75rem; font-size: .9rem; color: var(--muted-foreground); cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
#t-preguntas tbody tr { cursor: pointer; }
.espacio-arriba { margin-top: 1rem; }

/* hilo de preguntas */
.hilo { display: grid; gap: .9rem; max-height: 22rem; overflow: auto; padding-right: .25rem; }
.pregunta { padding: .8rem .9rem; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--background) 35%, transparent); }
.pregunta.resuelta { border-color: color-mix(in srgb, var(--chart-5) 45%, var(--border)); }
.pr-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; font-size: .85rem; }
.pregunta .texto, .respuestas .texto { margin: .35rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.pr-acciones { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .5rem; }
.enlace-accion { padding: .35rem 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.enlace-accion:hover { text-decoration: underline; }
.respuestas { list-style: none; margin: .7rem 0 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--border); display: grid; gap: .7rem; }
.respuestas:empty { display: none; }
.pr-form { display: grid; gap: .6rem; }
.pr-botones { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

/* registro */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: baseline; gap: .5rem; padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: .85rem; }
.chip .suave { font-size: .78rem; }

@media (max-width: 1100px) {
  .quien-op { min-height: 3.75rem; }
  .quien-op .nom { font-size: 1.5rem; }
  .pr-botones .btn { flex: 1; height: 2.75rem; }
  .hilo { max-height: 18rem; }
  #g-registro.grafico { height: 14rem; }
}

/* cabecera en pantallas estrechas: sin el texto del título (el logo ya lo lleva) para que quepa el botón de persona */
@media (max-width: 460px) {
  .marca .titular { display: none; }
  .btn.persona { max-width: 7rem; }
}

/* =====================================================================================================
   Móvil: tablas de ancho fijo (una nota larga ya no ensancha la tabla más que la pantalla)
   ===================================================================================================== */
@media (max-width: 1100px) {
  .dt-container table.dataTable { table-layout: fixed !important; width: 100% !important; }
  table.dataTable colgroup { display: none; }   /* las columnas ocultas seguirían ocupando sitio en el diseño fijo */
  table.dataTable td.col-play { width: 3.25rem; padding-right: .25rem; }
  table.dataTable td.col-accion { width: 2.75rem; padding-left: 0; padding-right: 0; text-align: center; }
  table.dataTable td.col-vista { width: 7.1rem; padding-right: .5rem; }
  .nota-fila { white-space: normal; max-width: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .celda-titulo .meta { overflow-wrap: anywhere; }
}

@media (max-width: 1100px) {
  table.dataTable tbody td.col-play, table.dataTable tbody td.col-play:first-child { width: 3.25rem; padding-left: 0; padding-right: .25rem; }
  table.dataTable tbody td.col-accion { width: 2.75rem; }
  table.dataTable tbody td.col-vista, table.dataTable tbody td.col-vista:first-child { width: 7.1rem; padding-left: 0; }
}

/* móvil: «Filtros» y «Ordenar» comparten fila; la búsqueda y la lista van debajo a todo el ancho */
@media (max-width: 1100px) {
  .tarjeta:has(> .solo-movil) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; align-items: start; }
  .tarjeta:has(> .solo-movil) > * { min-width: 0; }
  .tarjeta:has(> .solo-movil) > :not(.filtros-caja):not(.solo-movil) { grid-column: 1 / -1; }
  .tarjeta:has(> .solo-movil) > .filtros-caja { grid-column: 1; margin: 0; }
  .tarjeta:has(> .solo-movil) > .filtros-caja[open] { grid-column: 1 / -1; }
  .tarjeta:has(> .solo-movil) > .solo-movil { grid-column: 2; margin: 0; }
  .tarjeta:has(> .filtros-caja[open]) > .solo-movil { grid-column: 1 / -1; }
  .solo-movil > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .solo-movil select.selector { width: 100%; }
  .filtros-caja > summary { padding: 0 .75rem; }
}

@media (max-width: 1100px) {
  .nota a { display: inline-block; padding: .5rem 0; }
  .btn-preg .cuenta-mini { font-size: .7rem; min-width: 1.15rem; height: 1.15rem; line-height: 1.15rem; }
}

/* =====================================================================================================
   Móvil: los diálogos son «hojas» ancladas abajo, a todo el ancho
   ===================================================================================================== */
@media (max-width: 760px) {
  dialog.visor, dialog.visor.editor, dialog.visor.ahora {
    width: 100%; max-width: 100%; box-sizing: border-box; margin: auto 0 0 0; border-radius: 1rem 1rem 0 0; border-width: 1px 0 0 0;
    max-height: 92vh; padding-bottom: env(safe-area-inset-bottom);
  }
  @supports (height: 100dvh) { dialog.visor, dialog.visor.editor, dialog.visor.ahora { max-height: 92dvh; } }
  dialog.visor[open] { animation: hoja .2s ease-out; }
  @keyframes hoja { from { transform: translateY(1.5rem); opacity: .6; } to { transform: none; opacity: 1; } }
  @media (prefers-reduced-motion: reduce) { dialog.visor[open] { animation: none; } }
  .visor-cab { padding: .25rem .25rem .25rem 1rem; min-height: 3.25rem; position: sticky; top: 0; z-index: 1; background: var(--card); }
  .ahora-cuerpo { max-height: calc(92vh - 3.5rem); }
  @supports (height: 100dvh) { .ahora-cuerpo { max-height: calc(92dvh - 3.5rem); } }
  .editor-botones { padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  .visor-cuerpo video, .visor-cuerpo img { max-height: 60vh; width: 100%; }

  /* los enlaces de acción del hilo, con zona táctil cómoda */
  .enlace-accion { min-height: 2.75rem; padding: 0 .35rem; display: inline-flex; align-items: center; }
  .pr-acciones { gap: 0 .25rem; margin-top: .15rem; }
  .etiqueta-letra { font-size: .7rem; }

  /* filas de la bandeja y del registro: una flecha indica que se abren */
  #t-preguntas tbody td.celda-titulo { position: relative; padding-right: 1.6rem; }
  #t-preguntas tbody td.celda-titulo::after { content: "›"; position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); font-size: 1.6rem; line-height: 1; color: var(--muted-foreground); }
}
@media (pointer: coarse) { .visor-cab .btn:focus-visible { outline: none; } }

@media (max-width: 1100px) {
  .letra { max-height: none; }                 /* la hoja ya se desplaza: nada de scroll dentro de scroll */
  .ahora-der h4:not(:first-child) { margin-top: 1rem; }
}
@media (pointer: coarse) { .rep-vol.visible { display: none; } }   /* en el móvil se usan los botones del teléfono */

/* pantallas muy estrechas (320 px) */
@media (max-width: 340px) {
  main { padding-left: .5rem; padding-right: .5rem; }
  .tarjeta { padding: .6rem; }
  h2.titular { font-size: 1.6rem; }
  .quien-op { padding: .5rem .75rem; }
  .quien-op .rol { font-size: .78rem; }
  .btn.persona { max-width: 5.5rem; }
  .pestanas button { padding: 0 .6rem; font-size: .78rem; }
  .cabecera { padding-left: .6rem; padding-right: .6rem; }
}

@media (max-width: 1100px) { .vista-cab .solo-escritorio { display: none; } }

/* pantallas bajas (móvil en horizontal): el título de la sección sobra, la pestaña ya lo dice */
@media (max-height: 520px) and (max-width: 1100px) {
  .vista-cab { display: none; }
  main { padding-top: .6rem; }
  .pie { padding-bottom: 5rem; }
}

@media (max-width: 760px) {
  .acceso { align-items: start; padding-top: min(12vh, 5rem); }
  .acceso-caja .campo input[type=password] { height: 3rem; }
  .acceso-caja .btn { height: 3rem; font-size: 1rem; }
}

@media (max-width: 1100px) { .nota a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .1rem; } }
