/* Portal de transcripción y Cuentas de transcripción: estilos comunes,
   con la misma identidad que el editor de transcripción. */
:root {
  --navy: #00A2E0; --navy-oscuro: #0089BE; --ink: #171A1F; --muted: #565D66; --faint: #8A8F98;
  --bg: #F2F3F5; --card: #FFFFFF; --line: #E2E5E9; --ok: #2E7D46; --ok-bg: #E4F3E9;
  --aviso: #9A5B00; --aviso-bg: #FFF3DC; --error: #B23A3A; --error-bg: #F3E4E4; --info-bg: #E3F4FB;
}
* { box-sizing: border-box; min-width: 0; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; font-family: 'IBM Plex Sans', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
h1, h2, h3 { font-family: 'Space Grotesk', system-ui, sans-serif; margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: var(--navy-oscuro); }
[hidden] { display: none !important; }

/* La barra superior toma el color, el alto y el logotipo de «Aspecto del
   portal» (aspecto-panel.js); estos son los valores mientras carga. */
header { position: relative; background: var(--cab-fondo, var(--navy)); color: var(--cab-texto, #fff); padding: 0 20px; height: var(--cab-alto, 72px); display: flex; align-items: center; gap: 14px; }
header .logo { width: 26px; height: 26px; border-radius: 7px; background: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 11px; color: var(--navy); flex-shrink: 0; }
/* Título centrado en la barra (no lo desplazan el logo ni los botones), en
   Bricolage Grotesque seminegrita de 36 px. */
header .marca { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: 'Bricolage Grotesque', Arial, sans-serif; font-weight: 600; font-size: 36px; line-height: 1; letter-spacing: 0; white-space: nowrap; pointer-events: none; color: var(--cab-texto, #fff); }
header .espacio { flex: 1; }
header .quien { font-size: 13px; text-align: right; line-height: 1.25; overflow: hidden; }
header .quien small { display: block; opacity: 0.85; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .btn-cab { background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 7px; padding: 6px 11px; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; opacity: 0.92; position: relative; z-index: 1; }
header .btn-cab:hover { opacity: 1; background: rgba(127,127,127,0.15); }
header .quien { position: relative; z-index: 1; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px; }

.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.pestanas button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pestanas button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--navy); }

.barra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.barra .crece { flex: 1; }
.buscar { width: 260px; max-width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 7px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn-primario { background: var(--navy); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--navy-oscuro); }
.btn-borde { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-borde:hover:not(:disabled) { border-color: #C5CAD1; }
.btn-peligro { background: #fff; color: var(--error); border-color: #E7C9C9; }
.btn-peligro:hover:not(:disabled) { background: var(--error-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-enlace { background: none; border: 0; padding: 0; color: var(--navy-oscuro); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.tarjeta { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.aviso { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; line-height: 1.45; }
.aviso.info { background: var(--info-bg); }
.aviso.warn { background: var(--aviso-bg); color: #5E3A00; }
.aviso.err { background: var(--error-bg); color: #6E2020; }
.aviso.ok { background: var(--ok-bg); color: #1D4D2C; }

.consumo-pill { font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.consumo-pill strong { color: var(--ink); }
.consumo-pill.agotado { border-color: #E7C9C9; color: var(--error); }

/* Lista de transcripciones */
.lista { display: flex; flex-direction: column; }
.fila { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 14px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.fila:last-child { border-bottom: 0; }
.fila .t { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.fila .t a { color: var(--ink); text-decoration: none; }
.fila .t a:hover { color: var(--navy-oscuro); text-decoration: underline; }
.fila .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow-wrap: anywhere; }
.fila .acciones { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.vacio { padding: 40px 20px; text-align: center; color: var(--muted); }
.vacio strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 6px; }

.estado { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.estado.cola { background: #EEF0F3; color: var(--muted); }
.estado.proc { background: var(--info-bg); color: #00668C; }
.estado.ok { background: var(--ok-bg); color: var(--ok); }
.estado.rev { background: #E6EEFB; color: #2856A3; }
.estado.err { background: var(--error-bg); color: var(--error); }
.estado.sub { background: var(--aviso-bg); color: var(--aviso); }
.progreso { height: 5px; background: #E7EAEE; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progreso > div { height: 100%; background: var(--navy); transition: width .4s; }
.fase { font-size: 11.5px; color: var(--faint); margin-top: 4px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Menú de descargas */
.menu { position: relative; display: inline-block; }
.menu-lista { position: fixed; max-height: calc(100vh - 16px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 4px; z-index: 20; min-width: 190px; }
.menu-lista a, .menu-lista button { display: block; width: 100%; text-align: left; padding: 8px 11px; border-radius: 6px; color: var(--ink); text-decoration: none; background: none; border: 0; font-size: 13.5px; }
.menu-lista a:hover, .menu-lista button:hover { background: var(--bg); }

/* Diálogos */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,0.25); color: var(--ink); }
dialog::backdrop { background: rgba(23, 26, 31, 0.45); }
.dlg-cab { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.dlg-cab h2 { font-size: 17px; flex: 1; }
.dlg-cuerpo { padding: 16px 20px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; }
.dlg-pie { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cerrar { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 6px; }

.campo { display: flex; flex-direction: column; gap: 5px; }
.campo label, .campo .etq { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; width: 100%; }
.campo input:focus, .campo select:focus, .campo textarea:focus, .buscar:focus { outline: 2px solid rgba(0,162,224,0.35); border-color: var(--navy); }
.campo .ayuda { font-size: 12px; color: var(--faint); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input, .campo .check input { width: auto; padding: 0; }

.zona-archivo { border: 2px dashed #C9D0D8; border-radius: 10px; padding: 22px 16px; text-align: center; color: var(--muted); background: #FAFBFC; cursor: pointer; }
.zona-archivo.encima { border-color: var(--navy); background: var(--info-bg); }
.zona-archivo strong { color: var(--ink); display: block; margin-bottom: 4px; overflow-wrap: anywhere; }
.zona-archivo input { display: none; }

.subida { display: flex; flex-direction: column; gap: 8px; }
.subida .barra-sub { height: 10px; background: #E7EAEE; border-radius: 5px; overflow: hidden; }
.subida .barra-sub > div { height: 100%; width: 0; background: var(--navy); transition: width .3s; }
.subida .datos { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }

.enlace-copiar { display: flex; gap: 6px; }
.enlace-copiar input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }

table.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tabla th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tabla td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tabla tr:last-child td { border-bottom: 0; }
table.tabla th.num { text-align: right; }
table.tabla select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
table.tabla tr.clic { cursor: pointer; }
table.tabla tr.clic:hover td { background: #F8FAFB; }
.tabla-scroll { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.etiqueta { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #EEF0F3; color: var(--muted); }
.etiqueta.ok { background: var(--ok-bg); color: var(--ok); }
.etiqueta.off { background: var(--error-bg); color: var(--error); }

.cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cifra { padding: 14px 16px; }
.cifra .v { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cifra .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.medidor { height: 6px; background: #E7EAEE; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.medidor > div { height: 100%; background: var(--navy); }
.medidor.alto > div { background: #D98B1E; }
.medidor.lleno > div { background: var(--error); }
h3.sec { font-size: 15px; margin: 18px 0 10px; }

/* Vista previa de la barra (Aspecto del portal) */
.vista-barra { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-radius: 8px; overflow: hidden; }
.vista-barra img { height: 50%; width: auto; max-width: 24%; object-fit: contain; }
.vista-barra #vistaTitulo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: 'Bricolage Grotesque', Arial, sans-serif; font-weight: 600; font-size: 22px; white-space: nowrap; }
.campo input[type="color"] { height: 40px; padding: 3px; cursor: pointer; }
.vista-barra .vista-salir { border: 1px solid currentColor; border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }

@media (max-width: 760px) {
  header { padding: 0 12px; gap: 10px; }
  header .marca { position: static; transform: none; flex: 1; text-align: center; font-size: 20px; white-space: normal; }
  header .quien { display: none; }
  main { padding: 14px 16px 32px; }
  .fila { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .fila .acciones { justify-content: flex-start; }
  .buscar { width: 100%; }
  .dos { grid-template-columns: 1fr; }
  .cifras { grid-template-columns: 1fr; }
  .barra .crece { display: none; }
}
@media (max-width: 560px) {
  header .marca { display: none; }
  header .espacio { flex: 1; }
}
