:root {
  --ground: #F5F1EA; --surface: #FFFFFF; --field: #FFFDFA; --ink: #1D1B18; --muted: #5B5650;
  --line: #E3DCD1; --line-2: #D5CCBF; --line-3: #EEE8DF; --tab: #EAE3D8;
  --accent: #B23A12; --accent-ink: #8A2B0C; --accent-soft: #F6E3D8; --accent-line: #E2B49C;
  --blue-soft: #DCE8F3; --blue-ink: #1F4E78;
  --ok: #2F6B45; --ok-soft: #E6F0E9; --ok-ink: #235236; --warn-soft: #FBF1E4; --warn-ink: #6B4A12;
  --radius: 16px; --display: "Fraunces", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); background: var(--ground); color: var(--ink); font-size: 16px; }
a { color: var(--accent-ink); } a:hover { color: #6B200A; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #1F4E78; outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Cabecera */
.topbar { height: 76px; padding: 0 48px; display: flex; align-items: center; gap: 40px;
  border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand span { font-family: var(--display); font-size: 22px; font-weight: 600; }
.nav { display: flex; gap: 6px; }
.nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 18px; border-radius: 999px; color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9A938A; }
.dot.ok { background: var(--ok); } .dot.busy { background: #C08A1C; } .dot.down { background: #B42318; }

/* Estructura */
main { padding: 40px 48px 64px; }
.view { display: none; }
.view.active { display: block; }
.layout-2 { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 32px; align-items: start; }
.layout-2r { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.narrow { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.page-head h1 { margin: 0; font-family: var(--display); font-size: 40px; font-weight: 600; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  display: flex; flex-direction: column; gap: 16px; }
.card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.card h2.display { font-family: var(--display); font-size: 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hint { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }
.sticky { position: sticky; top: 100px; }

/* Controles */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 500; }
input[type=text], input[type=url], input[type=search], input[type=password], input[type=email], input:not([type]), select {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
textarea { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--field);
  line-height: 1.6; resize: vertical; }
input[type=range] { accent-color: var(--accent); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row .push { margin-left: auto; }
.btn { min-height: 44px; padding: 0 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn-primary { min-height: 48px; padding: 0 24px; border: 0; background: var(--accent); color: #fff; font-size: 16px; font-weight: 600; }
.btn-primary:hover { background: #9A3210; color: #fff; }
.btn-primary[aria-disabled=true], .btn[aria-disabled=true], .btn-peligro[aria-disabled=true] { opacity: .6; cursor: not-allowed; }
.btn-peligro { min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: #B42318; color: #fff; font-size: 15px; font-weight: 600; }
.btn-peligro:hover { background: #8C1D18; }
.btn.peligro { color: #8C1D18; border-color: #E8B4AE; }
.btn-dark { border: 0; background: var(--ink); color: #fff; font-weight: 600; }
.btn-dark:hover { color: #fff; background: #000; }
.btn-ok { border: 0; background: var(--ok); color: #fff; font-weight: 600; }
.btn-dashed { border-style: dashed; }
.btn:disabled, .btn-primary:disabled, a.btn[aria-disabled=true] { background: #CFC7BB; color: #3E3A35; border-color: #CFC7BB; pointer-events: none; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; }
.pill[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: #fff; }
.chip-trait[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn.dark { border: 0; background: var(--ink); color: #fff; }
.icon-btn.big { width: 56px; height: 56px; }
.icon-btn:disabled { opacity: .45; }
.icon-btn.ghost { border: 0; background: transparent; }

/* Lista de voces */
.voice-list { display: flex; flex-direction: column; gap: 8px; }
.voice-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-3); }
.voice-row.selected { background: var(--accent-soft); border-color: var(--accent-line); }
.voice-row label { display: flex; align-items: center; gap: 14px; flex-grow: 1; cursor: pointer; }
.voice-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.voice-name { font-weight: 600; display: block; }
.voice-meta { font-size: 13px; color: var(--muted); display: block; }

/* Reproductor */
.player { display: flex; align-items: center; gap: 20px; }
.wave { flex-grow: 1; height: 56px; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.wave span { flex-grow: 1; border-radius: 2px; background: var(--line-2); min-width: 2px; }
.wave span.played { background: var(--accent); }
.time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 8px; background: var(--line-3); border-radius: 999px; overflow: hidden; }
.progress > div { height: 8px; background: var(--accent); width: 0; transition: width .4s; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { padding: 6px 12px; border-radius: 999px; font-size: 13px; background: var(--ok-soft); color: var(--ok-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5; background: var(--warn-soft); color: var(--warn-ink); }
.notice.error { background: #FDECEA; color: #8C1D18; }
.notice.ok { background: var(--ok-soft); color: var(--ok-ink); }
.ok-text { color: var(--ok); font-size: 14px; font-weight: 500; }

/* Podcast */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--tab); border-radius: 12px; align-self: flex-start; }
.tabs button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 9px; background: transparent; font-size: 15px; }
.tabs button[aria-selected=true] { background: var(--surface); font-weight: 600; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; padding: 24px; display: flex; align-items: center; gap: 20px; background: var(--field); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.file-chip { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--ground); border-radius: 12px; }
.turns { display: flex; flex-direction: column; gap: 10px; }
.turn { display: grid; grid-template-columns: 170px minmax(0, 1fr) 44px; gap: 10px; align-items: start; }
.turn select { font-weight: 600; }
.turn textarea { min-height: 48px; padding: 10px 12px; font-size: 15px; line-height: 1.5; resize: vertical; }
.role { padding: 14px; border: 1px solid var(--line-3); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.role-chip { align-self: flex-start; min-width: 96px; text-align: center; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.c0 { background: var(--accent-soft); color: var(--accent-ink); } .c1 { background: var(--blue-soft); color: var(--blue-ink); }
.c2 { background: #E6F0E9; color: #235236; } .c3 { background: #EFE7F5; color: #5B2A7A; }
.c4 { background: #FBF1E4; color: #6B4A12; } .c5 { background: #E5E7EB; color: #374151; }
.sentences { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.sentence { display: flex; gap: 10px; font-size: 14px; align-items: flex-start; }
.sentence .st { flex-shrink: 0; width: 18px; }
.check-list { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.check-list div { display: flex; align-items: center; gap: 10px; }

/* Catálogo */
.catalog { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.vcard h2 { margin: 0; font-size: 18px; }
.vcard p { margin: 0; font-size: 14px; line-height: 1.5; color: #3E3A35; }
.vcard .actions { display: flex; gap: 8px; margin-top: auto; }
.vcard .actions a { flex-grow: 1; min-height: 44px; }
.avatar { width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 22px; font-weight: 600; }
.avatar.f { background: var(--accent-soft); color: var(--accent-ink); } .avatar.m { background: var(--blue-soft); color: var(--blue-ink); }
.new-card { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 200px; }

/* Crear voz */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.steps li { padding: 12px 16px; border-radius: 12px; font-size: 15px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.steps li.done { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-soft); }
.steps li.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.proposals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.proposal { padding: 16px; border-radius: 12px; border: 1px solid var(--line-3); display: flex; flex-direction: column; gap: 14px; }
.proposal.chosen { border: 2px solid var(--accent); background: #FFF8F3; }
.take { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line-3); border-radius: 12px; flex-wrap: wrap; }
.take.approved { border: 2px solid var(--ok); }

.spinner { width: 18px; height: 18px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 15px; z-index: 20; }

/* Acceso y cuenta */
body[data-auth="pending"] .topbar, body[data-auth="pending"] main, body[data-auth="pending"] .login,
body[data-auth="out"] .topbar, body[data-auth="out"] main, body[data-auth="in"] .login { display: none; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; padding: 32px; gap: 18px; }
.login-card .brand { justify-content: center; }
.login-title { margin: 4px 0 0; font-family: var(--display); font-size: 30px; font-weight: 600; text-align: center; }
.login-card .btn-primary { width: 100%; }
.login-card .hint { text-align: center; }
.user-menu { position: relative; }
.user-btn { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 6px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.small { width: 32px; height: 32px; font-size: 15px; background: var(--ink); color: #fff; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(29, 27, 24, .14); padding: 6px; display: flex; flex-direction: column; z-index: 10; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-3); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.menu a, .menu button { min-height: 44px; padding: 0 12px; display: flex; align-items: center; border: 0; border-radius: 10px;
  background: transparent; font-size: 15px; color: var(--ink); text-decoration: none; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--ground); }
.dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: rgba(29, 27, 24, .45); }
.dialog h2 { margin: 0; font-size: 20px; }

/* Acceso: primera cuenta, entrar, doble factor y enlaces */
.login-card.ancha { max-width: 640px; }
.login-card .izq, .login-title.izq { text-align: left; }
.con-ver { display: flex; gap: 8px; }
.con-ver input { flex: 1; min-width: 0; }
.casilla { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 44px; cursor: pointer; }
.casilla input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.enlace-boton { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent-ink); text-decoration: underline; font-size: 14px; }
.error-form:empty, #login-aviso:empty, #enlace-copiado:empty { display: none; }
.error-form .notice, #login-aviso .notice { margin: 0; }
.codigo-consola { font-family: ui-monospace, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.codigo-6 { font-size: 22px; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.qr-y-clave { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.qr { width: 184px; height: 184px; flex: none; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.clave-manual { padding: 10px 12px; border-radius: 10px; background: var(--ground); font-family: ui-monospace, Consolas, monospace;
  font-size: 15px; letter-spacing: .08em; overflow-wrap: anywhere; user-select: all; }
.reglas { list-style: none; margin: 4px 0 0; padding: 0; font-size: 14px; }
.reglas li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.reglas li::before { content: "○"; width: 16px; text-align: center; color: var(--muted); }
.reglas li.cumple { color: var(--ok-ink); }
.reglas li.cumple::before { content: "✓"; color: var(--ok); font-weight: 700; }

/* Ajustes: Mi perfil y Ajustes del equipo */
.ajustes { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.ajustes-contenido { min-width: 0; }
.secciones { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 100px; }
.secciones .grupo { margin: 16px 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.secciones .grupo:first-child { margin-top: 0; }
.secciones a { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px;
  border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; }
.secciones a:hover { background: var(--surface); }
.secciones a[aria-current="page"] { background: var(--surface); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.secciones .cuenta { font-size: 13px; font-weight: 400; color: var(--muted); }
.cabeza-seccion { margin-bottom: 16px; }
.titulo-seccion { margin: 0; font-family: var(--display); font-size: 40px; font-weight: 600; }
.titulo-card { margin: 0 0 8px; font-size: 20px; }
.bloque { margin-top: 20px; }
.bloque:first-of-type, .cabeza-seccion + .bloque { margin-top: 0; }
.bloque h2 { margin: 0; font-size: 18px; }
.dato { margin: 4px 0 0; }
.estado-linea { margin: 0; line-height: 1.6; }
.solo { align-self: flex-start; }
.barra-personas { justify-content: space-between; margin-bottom: 12px; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.buscar { min-width: 260px; }
.tabla-card { padding: 12px 16px; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 15px; }
.tabla caption { text-align: left; font-weight: 600; margin-bottom: 8px; }
.tabla th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabla td, .tabla tbody th { padding: 12px; border-bottom: 1px solid var(--line-3); vertical-align: middle; }
.tabla tbody th { font-size: 15px; font-weight: 400; color: var(--ink); }
.tabla tr:last-child td, .tabla tr:last-child th { border-bottom: 0; }
.tabla tr.apagada td { color: var(--muted); }
.persona strong { display: block; }
.persona span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.sin-partir { white-space: nowrap; }
.estados { display: flex; flex-wrap: wrap; gap: 4px; }
.estado { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; white-space: nowrap; }
.estado::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado.activa { background: var(--ok-soft); color: var(--ok-ink); }
.estado.invitada { background: var(--blue-soft); color: var(--blue-ink); }
.estado.desactivada { background: #ECE8E2; color: #4A4640; }
.estado.bloqueada { background: var(--warn-soft); color: var(--warn-ink); }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acciones .btn { min-height: 44px; padding: 0 12px; font-size: 14px; white-space: nowrap; }
.acciones.con-menu { position: relative; }
.menu-fila { top: calc(100% + 6px); min-width: 280px; }
.menu .peligro-texto { color: #8C1D18; }
select.en-fila { min-height: 44px; padding: 0 10px; background: var(--field); }
.vacio { padding: 12px; }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-3); }
.interruptor:last-child { border-bottom: 0; }
.switch { position: relative; flex: none; width: 52px; height: 30px; padding: 0; border: 0; border-radius: 999px; background: #8C857C; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { left: 25px; }
.fijas { padding: 12px 14px; border-radius: 10px; background: var(--ground); font-size: 14px; color: #3E3A35; }
.fijas p { margin: 4px 0; }
.sesiones .fila { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-3); }
.sesiones .fila:last-child { border-bottom: 0; }
.roles-tarjetas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.roles-tarjetas .card { gap: 6px; }
.roles-tarjetas h2 { font-size: 17px; }
.matriz td:not(:first-child), .matriz thead th:not(:first-child) { text-align: center; }
.si { color: var(--ok-ink); font-weight: 600; }
.no { color: var(--muted); }
.dialog.ancho { width: min(640px, calc(100vw - 32px)); }
.texto-dialogo { margin: 0; line-height: 1.55; }
.enlace { display: flex; gap: 8px; align-items: stretch; }
.enlace input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* En la plataforma Studio */
.aviso-plataforma { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: var(--blue-ink);
  font-size: 14px; line-height: 1.5; }
.pagina-acceso .btn, .pagina-acceso form { width: 100%; }
.tabla-personas.en-plataforma thead th:last-child { display: none; } /* sin columna de acciones */
.desplazable:focus-visible { outline-offset: -3px; }

/* Espacios (parte 2): el selector, «Audios», Ajustes → Espacios y lo que cambia en las demás pantallas */
.marca { width: 28px; height: 28px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.marca.grande { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.espacio-sel { position: relative; flex: none; }
.espacio-btn { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 0 12px 0 8px; border: 1px solid var(--line-2);
  border-radius: 12px; background: var(--surface); font-size: 15px; font-weight: 500; max-width: 240px; }
.espacio-btn .nombre, .espacio-fijo .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.espacio-fijo { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; max-width: 240px; }
.desplegado { position: absolute; left: 0; top: calc(100% + 8px); z-index: 10; width: 340px; max-width: calc(100vw - 32px); background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(29, 27, 24, .14); padding: 6px; }
.lista-espacios { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.lista-espacios [role=option] { min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.lista-espacios [role=option]:hover, .lista-espacios [role=option][aria-selected=true] { background: var(--ground); }
.lista-espacios .datos { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lista-espacios .datos strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-espacios .datos > span { font-size: 13px; color: var(--muted); }
.marcado { color: var(--ok); font-weight: 700; }
.pie-lista { border-top: 1px solid var(--line-3); margin-top: 4px; padding: 10px 10px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.pie-lista a { min-height: 44px; display: flex; align-items: center; font-size: 15px; }
.etiqueta-archivado { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: #ECE8E2; color: #3E3A35; font-size: 12px; font-weight: 600; }
.menu-espacios { display: flex; flex-direction: column; border-bottom: 1px solid var(--line-3); margin-bottom: 4px; padding-bottom: 4px; }
.menu-espacios .grupo-menu { padding: 8px 12px 4px; }
.menu-espacios .pie-menu { padding: 4px 12px 8px; }
.menu-espacios [role=menuitemradio] { gap: 10px; min-height: 52px; }
.menu-espacios .datos-menu { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.menu-espacios .nombre-menu { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-espacios .datos-menu .hint { font-size: 13px; }
#user-menu:has(.menu-espacios:not([hidden])) { width: min(320px, calc(100vw - 32px)); }
.menu-espacios .marcado { margin-left: auto; }
@media (min-width: 721px) { .menu-espacios { display: none !important; } }
.elegir-espacio { display: flex; flex-direction: column; gap: 8px; }
.elegir-espacio label { min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line-3); border-radius: 12px; cursor: pointer; }
.elegir-espacio label:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.elegir-espacio input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.center-vacio { min-height: 50vh; display: grid; place-items: center; }
.sin-marco { border: 0; padding: 0; margin: 0; min-width: 0; }
.cargando { flex-direction: row; align-items: center; gap: 12px; color: var(--muted); }
.audios .tabla td { vertical-align: top; }
.audio-titulo strong { display: block; }
.audio-titulo span { font-size: 13px; color: var(--muted); }
.tipo { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tipo.loc { background: var(--blue-soft); color: var(--blue-ink); } .tipo.pod { background: var(--accent-soft); color: var(--accent-ink); }
.menu [aria-disabled=true] { color: #6B655E; cursor: not-allowed; }
.volver { min-height: 44px; display: inline-flex; align-items: center; }
.grupo-voces { margin: 8px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grupo-voces:not(:first-child) { margin-top: 28px; }
.vcard .actions.con-menu { position: relative; flex-wrap: wrap; }
.espacios-lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.esp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column;
  gap: 12px; text-decoration: none; color: var(--ink); }
.esp-card:hover { border-color: var(--line-2); color: var(--ink); }
.esp-card .cab { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.esp-card .cab strong { font-size: 17px; }
.esp-card .cifras { font-size: 14px; color: var(--muted); }
.esp-card.archivada { background: #F3EFE8; border-style: dashed; border-color: #A89F92; } /* sin opacidad: el texto conserva su contraste */
.ia-hueco { font-size: 13px; color: var(--muted); }
.de-quien { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.de-quien ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.pestanas button { min-height: 44px; padding: 0 16px; border: 0; background: none; font-size: 15px; border-bottom: 3px solid transparent; }
.pestanas button[aria-selected=true] { border-bottom-color: var(--accent); font-weight: 600; }
.colores { display: flex; gap: 8px; flex-wrap: wrap; }
.colores button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; padding: 0; }
.colores button[aria-checked=true] { outline: 3px solid var(--ink); outline-offset: 2px; }
.reparto-fila { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.dic { width: 100%; border-collapse: collapse; font-size: 15px; }
.dic th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px 8px; }
.dic td { padding: 4px 8px; }
.dic input { width: 100%; }
.lectura dl { margin: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 16px; font-size: 15px; }
.lectura dt { color: var(--muted); }
.lectura dd { margin: 0; overflow-wrap: anywhere; }
.casillas-espacios { display: flex; flex-direction: column; gap: 6px; }
.casillas-espacios .fila { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; align-items: center; }
.techo { font-size: 13px; color: var(--muted); }
.espacios-de { font-size: 14px; }

.brand span, .nav a { white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar { padding: 0 24px; gap: 20px; }
  .nav a { padding: 0 12px; }
  .status span:last-child { display: none; } /* el estado completo queda en el título del punto */
  .layout-2, .layout-2r { grid-template-columns: 1fr; }
  .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky { position: static; }
  .user-name { display: none; }
  .ajustes { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
  .roles-tarjetas { grid-template-columns: 1fr; }
}
@media (min-width: 721px) and (max-width: 900px) {
  .topbar .brand span { display: none; } /* cabe todo en una línea; el logotipo sigue llevando al inicio */
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; gap: 12px; height: auto; flex-wrap: wrap; padding-block: 12px; }
  .topbar-right .status span:last-child { display: none; }
  .nav { flex-wrap: wrap; gap: 2px; }
  .nav a { padding: 0 10px; }
  .desplazable { overflow-x: auto; }
  main { padding: 24px 16px; }
  .catalog, .grid-3, .grid-2, .proposals, .steps { grid-template-columns: minmax(0, 1fr); } /* un desplegable largo no ensancha la columna */
  .turn { grid-template-columns: 1fr 44px; } .turn select { grid-column: 1 / -1; }
  /* Ajustes en estrecho: una columna; las secciones, una fila que se parte; la tabla de personas, tarjetas. */
  .ajustes { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .secciones { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .secciones .grupo, .secciones .cuenta { display: none; }
  .secciones a { border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); }
  .secciones a[aria-current="page"] { box-shadow: none; border-color: var(--ink); background: var(--ink); color: #fff; }
  .titulo-seccion, .page-head h1 { font-size: 28px; }
  .buscar { min-width: 0; width: 100%; }
  .tarjetas-movil { padding: 0; border: 0; background: transparent; }
  .tabla-personas thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabla-personas, .tabla-personas tbody { display: block; }
  .tabla-personas tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; padding: 14px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .tabla-personas td { display: block; padding: 0; border: 0; }
  .tabla-personas td.persona, .tabla-personas td:nth-child(2), .tabla-personas td:last-child { flex: 1 1 100%; }
  .tabla-personas select.en-fila, .tabla-personas .acciones, .tabla-personas .acciones .btn { width: 100%; }
  .menu-fila { left: 0; right: 0; min-width: 0; }
  .sesiones .fila { flex-wrap: wrap; }
  .sesiones .fila .btn { width: 100%; }
  .matriz { font-size: 14px; }
  .matriz td, .matriz th { padding: 8px 6px; }
  .qr-y-clave { flex-direction: column; align-items: stretch; }
  .qr { align-self: center; }
  .espacio-sel { display: none !important; } /* en el móvil, la lista va en el menú de la cuenta */
  .espacios-lista, .de-quien { grid-template-columns: 1fr; }
  .reparto-fila, .lectura dl, .casillas-espacios .fila { grid-template-columns: 1fr; }
  .tabla-audios td { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- la IA (parte 4; maqueta docs/maquetas/fase-d-ia.html) */
/* El interruptor, con 44 px de zona de toque. */
.switch44 { position: relative; flex: none; width: 52px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.switch44::before { content: ""; position: absolute; left: 0; top: 7px; width: 52px; height: 30px; border-radius: 999px; background: #8C857C; }
.switch44::after { content: ""; position: absolute; top: 10px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch44[aria-checked="true"]::before { background: var(--ok); }
.switch44[aria-checked="true"]::after { left: 25px; }
.switch44:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; border-radius: 999px; }
.resumen { display: flex; gap: 24px; flex-wrap: wrap; font-size: 15px; }
.resumen strong { font-size: 22px; font-family: var(--display); display: block; }
.conexiones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.conexion { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.conexion .cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conexion .cab strong { font-size: 17px; }
.conexion dl { margin: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.conexion dt { color: var(--muted); }
.conexion dd { margin: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.modelo-linea { display: block; flex-basis: 100%; }
.btn.mini { min-height: 44px; padding: 0 12px; font-size: 14px; }
.lugar { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.lugar.nube { background: var(--blue-soft); color: var(--blue-ink); }
.lugar.local { background: var(--ok-soft); color: var(--ok-ink); }
.lugar.plataforma { background: #EFE7F5; color: #5B2A7A; }
.estado.lenta { background: var(--warn-soft); color: var(--warn-ink); }
.estado.error { background: #FDECEA; color: #8C1D18; }
.estado.sinprobar { background: #ECE8E2; color: #3E3A35; }
.ancho-tabla { overflow-x: auto; min-width: 0; max-width: 100%; }
.modelos-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.modelos-tabla th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.modelos-tabla td { padding: 4px 8px; border-bottom: 1px solid var(--line-3); vertical-align: middle; }
.modelos-tabla td .casilla { display: inline-flex; margin-right: 10px; }
.modelos-tabla .modelo-id { overflow-wrap: anywhere; }
.modelos-tabla input[type=text] { width: 90px; }
.cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cifra { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cifra .valor { font-family: var(--display); font-size: 26px; font-weight: 600; }
.cifra .sub { font-size: 13px; color: var(--muted); }
/* Barras: bien (azul), aviso desde el 80 % (ámbar con rayas) y agotado (rojo con marca al final). La cifra, siempre al lado. */
.barra { height: 10px; border-radius: 999px; background: #EEE8DF; overflow: hidden; }
.barra > span { display: block; height: 100%; background: #1F4E78; }
.barra.aviso > span { background: repeating-linear-gradient(135deg, #8A5A00 0 6px, #A87310 6px 10px); }
.barra.pasada > span { background: #B42318; box-shadow: inset -6px 0 0 #1D1B18; }
.desglose { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.desglose .card h2, .bloque h2 { margin-top: 0; }
.fila-barra { display: grid; grid-template-columns: 170px minmax(0, 1fr) 190px; gap: 12px; align-items: center; font-size: 14px; padding: 6px 0; }
.fila-barra > span:first-child { overflow-wrap: anywhere; }
.fila-barra.corta { grid-template-columns: minmax(0, 1fr) auto; }
.desglose .fila-barra { grid-template-columns: minmax(90px, 1fr) minmax(60px, 1fr) auto; }
.fila-barra .num { text-align: right; font-variant-numeric: tabular-nums; }
.mes { font-family: var(--display); font-size: 32px; margin: 0; }
.radios { display: flex; flex-direction: column; gap: 8px; }
.radios label { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-3); border-radius: 12px; cursor: pointer; }
.radios label:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.radios input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.importe { display: flex; align-items: center; gap: 8px; }
.importe input { width: 120px; }
.tarea-tabla { width: 100%; border-collapse: collapse; font-size: 15px; }
.tarea-tabla th { text-align: left; font-size: 13px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tarea-tabla td { padding: 12px 10px; border-bottom: 1px solid var(--line-3); vertical-align: top; min-width: 200px; }
.tarea-tabla select { width: 100%; }
.incidencias { margin: 0; padding-left: 18px; }
.incidencias li { margin: 6px 0; font-size: 14px; line-height: 1.45; }
.incidencias .cuando { color: var(--muted); margin-right: 6px; }
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.cargando { display: flex; flex-direction: row; align-items: center; gap: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .conexiones, .desglose { grid-template-columns: minmax(0, 1fr); }
  .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .fila-barra, .desglose .fila-barra { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .fila-barra.corta { grid-template-columns: minmax(0, 1fr); }
  .fila-barra .num { text-align: left; }
}
@media (max-width: 720px) {
  .cifras { gap: 10px; }
  .cifra { padding: 14px; }
  .cifra .valor { font-size: 22px; }
  .conexion dl { grid-template-columns: minmax(0, 1fr); }
  .conexion dt { margin-top: 6px; }
  .mes { font-size: 26px; flex-basis: 100%; order: -1; }
  .tarea-tabla td { min-width: 0; }
  .tarea-tabla, .tarea-tabla tbody, .tarea-tabla tr, .tarea-tabla td { display: block; }
  .tarea-tabla thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tarea-tabla td { padding: 8px 0; border: 0; }
  .tarea-tabla tr { border-bottom: 1px solid var(--line-3); padding-bottom: 8px; }
}
@media (max-width: 420px) { .cifras { grid-template-columns: minmax(0, 1fr) !important; } }
