/* ====================================================================
   Caso «Panel de preferencias» — app «Agenda Fácil» (FICTICIA)
   --------------------------------------------------------------------
   La cargan las DOS versiones (con barreras y corregida) para que se vean igual. Lo que cambia es el
   marcado y el comportamiento: los componentes de la versión con barreras (.pestana de <div>, .interruptor,
   .deslizador, .item-orden…) tienen su par accesible (.pestana de <button>, .sw, input range, lista con
   botones…). Las barreras de ESTILO (sin foco, pie que tapa, textos grises, íconos de 16 px) viven en la
   hoja o el <style> de index.html con su B#, no acá.

   Tema claro y oscuro con variables; «Modo oscuro» cambia el atributo data-oscuro de <html>.
   Sin fuentes ni imágenes de otros sitios: tipografía del sistema.
   ==================================================================== */
:root {
    --fondo: #f5f6fb;
    --tarjeta: #ffffff;
    --tinta: #1c1f2e;
    --suave: #4b5066;
    --borde: #aeb4c8;
    --acento: #3b3fa8;
    --acento-tinta: #ffffff;
    --acento-suave: #e8eafc;
    --foco: #1d2a8f;
    --ok: #14663a;
    --error: #9b1c1c;
}
html[data-oscuro] {
    --fondo: #12131c;
    --tarjeta: #1e2030;
    --tinta: #eef0fa;
    --suave: #c3c8e0;
    --borde: #6b7192;
    --acento: #a9aeff;
    --acento-tinta: #10112a;
    --acento-suave: #2c2f4d;
    --foco: #ffd84d;
    --ok: #7be3a9;
    --error: #ff9f9f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--fondo);
    color: var(--tinta);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}

.saltar {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    color: #1d2a8f;
    padding: 10px 14px;
    z-index: 5;
}
.saltar:focus { left: 8px; top: 8px; }

.app-cab {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #3b3fa8;
    color: #ffffff;
    padding: 14px 20px;
}
.app-logo { font-size: 1.3rem; font-weight: 800; letter-spacing: 0.01em; }
.app-sub { font-size: 0.95rem; color: #e1e3ff; }

.pagina { max-width: 720px; margin: 0 auto; padding: 20px 16px 40px; }
.pagina h1 { margin: 6px 0 14px; font-size: 1.7rem; line-height: 1.2; }
.seccion-app {
    background: var(--tarjeta);
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 18px 18px 20px;
    margin: 0 0 16px;
}
.seccion-app h2 { margin: 0 0 10px; font-size: 1.2rem; line-height: 1.25; }

/* Texto de ayuda de la versión con barreras: gris claro (B17, 1.4.3). El de la corregida: contraste suficiente. */
.ayuda-baja { margin: 6px 0 0; color: #a3aab8; font-size: 0.9rem; }
.ayuda { margin: 6px 0 0; color: var(--suave); font-size: 0.95rem; }

.entrada {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 2px solid #6b7192;
    border-radius: 8px;
    background: var(--tarjeta);
    color: var(--tinta);
    font: inherit;
}
.etiqueta-falsa, .etiqueta { display: block; font-weight: 600; margin: 0 0 6px; }

.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 18px;
    border: 2px solid var(--acento);
    border-radius: 8px;
    background: var(--acento);
    color: var(--acento-tinta);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.boton-sec { background: transparent; color: var(--acento); }
html:not([data-oscuro]) .boton-sec { color: #2d3190; border-color: #2d3190; }

/* ---- Pestañas (misma pinta para <div> y <button>) ---------------------- */
.pestanas { display: flex; gap: 4px; border-bottom: 2px solid var(--borde); margin-bottom: 12px; flex-wrap: wrap; }
.pestana {
    padding: 10px 16px;
    border: 0;
    border-bottom: 4px solid transparent;
    margin-bottom: -2px;
    background: transparent;
    color: var(--tinta);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.pestana.activa, .pestana[aria-selected="true"] { border-bottom-color: var(--acento); color: var(--acento); }
html:not([data-oscuro]) .pestana.activa, html:not([data-oscuro]) .pestana[aria-selected="true"] { color: #2d3190; border-bottom-color: #2d3190; }
.panel[hidden] { display: none; }
.panel { margin: 0 0 4px; }
.panel p { margin: 0 0 6px; }

/* ---- Acordeón ------------------------------------------------------------ */
.acordeon { border-bottom: 1px solid var(--borde); }
.acordeon-cab {
    display: block;
    width: 100%;
    padding: 12px 4px;
    border: 0;
    background: transparent;
    color: var(--tinta);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.acordeon-cab::after { content: "+"; float: right; font-weight: 700; }
.acordeon-cab.abierta::after, .acordeon-cab[aria-expanded="true"]::after { content: "−"; }
.acordeon-cuerpo { padding: 0 4px 12px; color: var(--suave); }
.acordeon-cuerpo[hidden] { display: none; }
h3.acordeon-titulo { margin: 0; font-size: 1rem; }

/* ---- Interruptores ------------------------------------------------------------ */
.fila-ajuste { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.fila-ajuste:last-child { border-bottom: 0; }
/* Versión con barreras (B3): on = verde, off = gris. Nada más. */
.interruptor { position: relative; width: 48px; height: 26px; border-radius: 13px; background: #cfd2dc; cursor: pointer; flex: none; }
.interruptor.on { background: #3fae6a; }
.perilla { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; transition: left 0.15s; }
.interruptor.on .perilla { left: 25px; }
/* Versión corregida: botón con texto de estado visible. */
.sw {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: var(--tinta);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.sw-label { flex: 1; font-weight: 600; }
.sw-track { position: relative; width: 48px; height: 26px; border-radius: 13px; background: var(--tarjeta); border: 2px solid var(--tinta); flex: none; }
.sw-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--tinta); transition: left 0.15s; }
.sw[aria-checked="true"] .sw-track { background: var(--ok); border-color: var(--ok); }
.sw[aria-checked="true"] .sw-knob { left: 24px; background: var(--tarjeta); }
.sw-estado { min-width: 6.5em; font-weight: 700; }

/* ---- Deslizador (B4, versión con barreras) ------------------------------------- */
.ajuste-vertical { margin: 0; }
.deslizador { position: relative; width: min(100%, 320px); height: 10px; margin: 18px 12px 18px 0; border-radius: 5px; background: #d5d8e4; }
.desliz-relleno { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; border-radius: 5px; background: #3b3fa8; }
.desliz-perilla { position: absolute; top: -8px; left: 50%; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: #ffffff; border: 3px solid #3b3fa8; cursor: grab; touch-action: none; }
.vol-fila { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
input[type="range"] { width: min(100%, 320px); min-height: 44px; accent-color: var(--acento); }

/* ---- Tooltip -------------------------------------------------------------------- */
.con-tip { position: relative; display: inline-block; }
.ayuda-icono { display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 50%; background: #e1e3ff; color: #2d3190; text-align: center; font-size: 0.8rem; font-weight: 700; cursor: help; }
button.ayuda-boton { width: 32px; height: 32px; border: 2px solid var(--acento); border-radius: 50%; background: var(--tarjeta); color: var(--tinta); font: inherit; font-weight: 700; cursor: help; }
.tip { position: absolute; left: 0; bottom: calc(100% + 14px); z-index: 3; width: 240px; padding: 8px 12px; border-radius: 8px; background: #1c1f2e; color: #ffffff; font-size: 0.9rem; font-weight: 400; }
.tip[hidden] { display: none; }
.tip-pegado { bottom: 100%; margin-bottom: 0; }

/* ---- Ciudad (combobox) -------------------------------------------------------------- */
.combo { position: relative; }
.sugerencias, .lista-sug {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    z-index: 3;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--tarjeta);
    border: 1px solid var(--borde);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.sugerencias[hidden], .lista-sug[hidden] { display: none; }
.sugerencia, .opcion-sug { padding: 10px 12px; cursor: pointer; }
.sugerencia:hover, .opcion-sug:hover { background: var(--acento-suave); }
.opcion-sug[aria-selected="true"] { background: var(--acento); color: var(--acento-tinta); }

/* ---- Orden de accesos directos --------------------------------------------------------- */
.lista-orden { list-style: none; margin: 0 0 10px; padding: 0; }
.item-orden { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 0 8px; border: 1px solid var(--borde); border-radius: 8px; background: var(--tarjeta); }
.item-orden[draggable="true"] { cursor: grab; }
.item-orden.arrastrando { opacity: 0.5; }
.item-orden .nombre { flex: 1; }
.agarre { color: var(--suave); letter-spacing: -2px; }
.item-acciones { display: flex; gap: 8px; }
.item-acciones button { min-height: 44px; min-width: 76px; padding: 6px 10px; border: 2px solid var(--acento); border-radius: 8px; background: transparent; color: var(--tinta); font: inherit; font-weight: 600; cursor: pointer; }
.item-acciones button[aria-disabled="true"] { opacity: 0.6; }
.barra-acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

/* ---- Foto de perfil ------------------------------------------------------------------------ */
.dlg-foto { border: 2px solid var(--acento); border-radius: 12px; background: var(--tarjeta); color: var(--tinta); padding: 16px 18px; margin-top: 12px; }
.dlg-foto[hidden] { display: none; }
dialog.dlg-foto { width: min(420px, calc(100% - 24px)); margin: auto; }
dialog.dlg-foto::backdrop { background: rgba(0, 0, 0, 0.5); }
.dlg-foto h3 { margin: 0 0 10px; font-size: 1.1rem; }
.foto-fila { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.foto-fila img { border-radius: 50%; flex: none; }
.dlg-acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.msg-trampa { margin: 10px 0 0; padding: 8px 12px; border-left: 5px solid #f2b134; background: #fff7e0; color: #4a3500; font-weight: 600; }

/* ---- Avisos y barra inferior ------------------------------------------------------------------ */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 6; background: #1c1f2e; color: #fff; padding: 10px 18px; border-radius: 8px; }
.toast[hidden] { display: none; }
.barra-pie {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--tarjeta);
    border-top: 3px solid var(--acento);
    min-height: 72px;
}
.barra-pie p { margin: 0; }

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 480px) {
    .seccion-app { padding: 14px 12px 16px; }
    .item-acciones button { min-width: 64px; }
    .item-orden { flex-wrap: wrap; }
}

/* B11 (2.5.8, versión con barreras): íconos de 16 × 16 px y pegados, sin separación. */
.barra-iconos { display: inline-flex; margin: 4px 0 0; }
.ic { width: 16px; height: 16px; padding: 0; margin: 0; border: 1px solid #8b90b5; background: #e8eafc; color: #1c1f2e; font-size: 10px; line-height: 14px; cursor: pointer; }
