/* =============================================================================
   Cuestionario Metalfin — estilos base (móvil primero)
   Paleta sobria con acento teal. Sin dependencias ni build.
   ========================================================================== */

:root {
    --bg-1: #eef3f7;
    --bg-2: #e1e9f0;
    --surface: #ffffff;
    --text: #16202b;
    --muted: #647184;
    --line: #dde5ee;

    --accent: #0e7490;
    --accent-strong: #0b566a;
    --accent-soft: #e7f3f6;

    --danger: #b3261e;
    --danger-soft: #fdecea;
    --ok: #15803d;
    --ok-soft: #e7f7ee;

    --radius: 18px;
    --radius-sm: 11px;
    --shadow: 0 18px 40px -20px rgba(13, 38, 56, 0.45);
    --shadow-sm: 0 3px 10px -4px rgba(13, 38, 56, 0.25);
    --header: linear-gradient(135deg, #0e2a3a 0%, #114b61 100%);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }

/* NO fijar height:100% en html/body: forzaría la altura al viewport y el contenido
   largo (listas del admin) desbordaría su caja, pisando el pie de página. Con
   min-height:100dvh el body crece con el contenido y el footer queda siempre debajo
   (sticky-footer correcto), centrando vertical solo cuando el contenido cabe. */
html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(14, 116, 144, 0.10), transparent 60%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2));
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* ── Cabecera ─────────────────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: var(--header);
    color: #fff;
    box-shadow: 0 6px 24px -16px rgba(0, 0, 0, 0.7);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.01em;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 800;
    font-size: 0.9rem;
    flex: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

.lang-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.lang-btn {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    padding: 0.32rem 0.62rem;
    border-radius: 999px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.lang-btn.is-active {
    background: #fff;
    color: var(--accent-strong);
}

/* ── Botones ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s, opacity 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: var(--shadow-sm);
    padding: 0.9rem 1rem;
    font-size: 1rem;
}

.btn-primary:hover { box-shadow: 0 10px 22px -10px rgba(14, 116, 144, 0.7); }

.btn-block { width: 100%; }

.btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

/* ── Zona central y tarjetas ──────────────────────────────────────────────── */
.app {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    min-height: 0;
}

/* Centrado vertical SEGURO: centra si cabe; si el contenido es alto, se
   desplaza desde arriba (sin recortes). */
.screen { margin: auto; width: 100%; max-width: 460px; }
.expert-app { max-width: 720px; }

.card {
    width: 100%;
    max-width: 460px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 24px;
    animation: fade-in-up 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.card-title {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.muted { color: var(--muted); line-height: 1.55; margin: 0; }

[data-screen="listo"] { text-align: center; }

/* ── Formularios ──────────────────────────────────────────────────────────── */
.form { margin-top: 1.4rem; display: grid; gap: 1rem; }

.field { display: grid; gap: 0.4rem; }

.field label { font-weight: 650; font-size: 0.9rem; }

.field input {
    width: 100%;
    padding: 0.85rem 0.9rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.16s, box-shadow 0.16s;
}

.field input::placeholder { color: #9aa7b6; }

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-error {
    margin: 0;
    color: var(--danger);
    background: var(--danger-soft);
    border-left: 3px solid var(--danger);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

.hint { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* ── Chips (nombres existentes) ───────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid transparent;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 650;
    cursor: pointer;
    transition: border-color 0.16s, background 0.16s;
}

.chip:hover { background: #fff; border-color: var(--accent); }

/* ── Insignia de éxito ────────────────────────────────────────────────────── */
.badge-ok {
    width: 58px;
    height: 58px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    background: var(--ok-soft);
    color: var(--ok);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    font-weight: 700;
    animation: pop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1.2) both;
}

/* ── Pie ──────────────────────────────────────────────────────────────────── */
.appfoot {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    opacity: 0.85;
}

/* ── Animaciones ──────────────────────────────────────────────────────────── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes pop {
    from { opacity: 0; transform: scale(0.6); }
    to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ── Pantallas grandes ────────────────────────────────────────────────────── */
@media (min-width: 640px) {
    .card { padding: 38px 34px; }
    .brand { font-size: 1.1rem; }
}

/* ── Modo oscuro (básico; el pulido fino llega en el hito de estética) ────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-1: #0d1620;
        --bg-2: #0a1118;
        --surface: #16212c;
        --text: #e8eef4;
        --muted: #9fb0c0;
        --line: #2a3a49;
        --accent-soft: #0e2c34;
        --danger-soft: #2a1513;
        --ok-soft: #102a1c;
        --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
    }
    .field input { background: #0f1a24; }
}

/* =============================================================================
   Experto (H4): elegir áreas + panel
   ========================================================================== */
.load-msg { text-align: center; padding: 24px 0; }

.btn-secondary { background: var(--accent-soft); color: var(--accent-strong); }
.btn-secondary:hover { filter: brightness(0.97); }

/* ── Elegir áreas ─────────────────────────────────────────────────────────── */
.areas-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0; }
@media (min-width: 560px) { .areas-grid { grid-template-columns: 1fr 1fr; } }

.area-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 16px 18px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    font: inherit;
    color: var(--text);
    transition: border-color 0.16s, transform 0.1s, box-shadow 0.16s, background 0.16s;
}
.area-card:hover { box-shadow: var(--shadow); }
.area-card:active { transform: translateY(1px); }
.area-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }

.area-code {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 800;
    font-size: 0.9rem;
}
.area-card.is-selected .area-code { background: var(--surface); }
.area-title { font-weight: 650; line-height: 1.3; }

.area-check {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s, transform 0.15s;
}
.area-card.is-selected .area-check { opacity: 1; transform: scale(1); }

.areas-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.areas-count { margin-right: auto; }

/* ── Panel (dashboard) ────────────────────────────────────────────────────── */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dash-head .card-title { margin-bottom: 0.2rem; }

.dash-list { display: grid; gap: 14px; }

.dash-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 18px;
    border-left: 4px solid var(--accent);
    animation: fade-in-up 0.3s ease both;
}
.dash-card.is-done { border-left-color: var(--ok); }

.dash-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.dash-code {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 800;
    font-size: 0.85rem;
}
.dash-title { margin: 0; font-size: 1.15rem; font-weight: 700; flex: 1; min-width: 0; }

.state-badge { flex: none; border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.74rem; font-weight: 700; }
.state-prog { background: var(--accent-soft); color: var(--accent-strong); }
.state-done { background: var(--ok-soft); color: var(--ok); }

.dash-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.progress-text { flex: none; font-size: 0.82rem; color: var(--muted); font-weight: 600; }

.dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-actions .btn { flex: 1; min-width: 130px; }

.other-areas { margin-top: 16px; text-align: center; font-size: 0.88rem; }

/* Barra de progreso nativa (<progress>) estilizada */
.bar {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 10px;
    border: 0;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
.bar::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.bar::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-strong)); border-radius: 999px; }
.bar::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* =============================================================================
   Tarjetero (H5): responder por texto
   ========================================================================== */
.tarjetero { display: grid; gap: 16px; }

.tarj-head { display: flex; align-items: center; gap: 10px; }
.tarj-back {
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.tarj-back:hover { background: var(--accent-soft); border-color: var(--accent); }
.tarj-section { flex: 1; min-width: 0; font-weight: 700; }
.tarj-counter { flex: none; color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.tarj-progress { display: flex; align-items: center; gap: 10px; }

.tarj-card {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 24px 22px;
    animation: fade-in-up 0.3s ease both;
}
.tarj-sub {
    display: inline-block;
    margin-bottom: 12px;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tarj-question {
    margin: 0 0 16px;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.answer-wrap { position: relative; }
.tarj-answer {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 1.05rem;
    line-height: 1.5;
    resize: vertical;
}
.tarj-answer:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.saved-ind {
    position: absolute;
    right: 10px;
    bottom: 12px;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--ok-soft);
    color: var(--ok);
    font-size: 0.76rem;
    font-weight: 700;
    pointer-events: none;
}

.tarj-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tarj-nav .btn-primary { grid-column: 1 / -1; }

.btn-line { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn-line:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

.complete-card {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 34px 24px;
    text-align: center;
    animation: fade-in-up 0.3s ease both;
}
.complete-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.complete-actions .btn { flex: 1; min-width: 150px; }

/* =============================================================================
   Audio (H6): grabar / reproducir
   ========================================================================== */
.audio-block { margin-top: 18px; }
.audio-label { margin-bottom: 8px; font-size: 0.82rem; color: var(--muted); font-weight: 600; }

.audio-rec {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1.2rem;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.audio-rec:hover { border-color: var(--accent); background: var(--accent-soft); }
.rec-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #e23b3b; }

.audio-recording { display: flex; align-items: center; gap: 14px; }
.audio-stop {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.8rem 1.2rem;
    border: 0;
    border-radius: 12px;
    background: var(--danger);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.rec-pulse { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1s infinite; }
.audio-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; }

.audio-note { margin: 0; color: var(--muted); font-size: 0.88rem; }

.audio-has { display: flex; flex-direction: column; gap: 10px; }
.audio-player { width: 100%; height: 40px; }
.audio-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

/* ── Toasts (compartido por experto y admin; por encima de cabeceras/capas) ── */
.toast-host {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
}
.toast {
    background: #16202b;
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 90%;
    text-align: center;
    animation: fade-in-up 0.25s ease both;
}
.toast-err { background: var(--danger); }
.toast-out { opacity: 0; transition: opacity 0.3s; }

/* ── Modal de confirmación (sustituye a confirm() nativo) ──────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(13, 38, 56, 0.55);
    backdrop-filter: blur(2px);
    animation: modal-fade 0.18s ease both;
}
.modal-overlay.modal-out { opacity: 0; transition: opacity 0.18s ease; }
.modal-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 20px 18px;
    animation: pop 0.18s ease both;
}
.modal-msg {
    margin: 0 0 18px;
    font-size: 1rem;
    line-height: 1.45;
    color: var(--text);
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.modal-actions .btn { min-width: 110px; }

/* .btn-danger también disponible fuera del admin (modal del experto) */
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(0.98); }

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =============================================================================
   H8 — Identidad visual Mitiga (https://mitiga.es): Inter + azul #2563eb.
   Capa de refinamiento (la cascada hace que estos valores ganen). Sin lógica.
   ========================================================================== */

/* ── Tipografía Inter (auto-alojada, sin dependencia externa ni CSP extra) ── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url(../fonts/inter-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212,
        U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url(../fonts/inter-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── Tokens de marca Mitiga ─────────────────────────────────────────────────── */
:root {
    --bg-1: #f9fafb;            /* gray-50 */
    --bg-2: #eef4ff;            /* azul muy suave (from-blue-50) */
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --text: #111827;           /* gray-900 */
    --muted: #4b5563;          /* gray-600 */
    --line: #e5e7eb;           /* gray-200 */

    --accent: #2563eb;         /* blue-600 */
    --accent-strong: #1d4ed8;  /* blue-700 (hover) */
    --accent-2: #3b82f6;       /* blue-500 */
    --accent-soft: #eff6ff;    /* blue-50 */
    --accent-line: #dbeafe;    /* blue-100 (bordes de tarjeta) */
    --ring: rgba(37, 99, 235, 0.35);

    --danger: #dc2626;         /* red-600 */
    --danger-soft: #fef2f2;    /* red-50 */
    --danger-line: #fecaca;    /* red-200 */
    --ok: #16a34a;             /* green-600 */
    --ok-soft: #f0fdf4;        /* green-50 */

    --radius: 16px;            /* rounded-2xl */
    --radius-sm: 10px;         /* rounded-lg */
    --shadow-sm: 0 1px 2px rgba(30, 58, 138, 0.06), 0 4px 12px -6px rgba(30, 58, 138, 0.14);
    --shadow-md: 0 10px 24px -12px rgba(30, 58, 138, 0.22);
    --shadow: 0 24px 50px -28px rgba(30, 58, 138, 0.35);  /* shadow-blue-900/10 */
    --header: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    letter-spacing: -0.005em;
    background:
        radial-gradient(1100px 520px at 100% -8%, rgba(37, 99, 235, 0.10), transparent 60%),
        linear-gradient(170deg, var(--bg-1), var(--bg-2));
}

/* Jerarquía tipográfica al estilo Mitiga: títulos extrabold y tracking-tight. */
.card-title, .cover-title, .tarj-question, .dash-title, .complete-card h1, .tab-view h2 {
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.025em;
}

/* ── Accesibilidad: foco visible por teclado ───────────────────────────────── */
a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.btn:focus-visible, .lang-btn:focus-visible, .tab:focus-visible, .tab-pill:focus-visible,
.area-card:focus-visible, .chip:focus-visible, .audio-rec:focus-visible, .tarj-back:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent);
}

/* ── Cabecera ──────────────────────────────────────────────────────────────── */
.topbar { box-shadow: 0 8px 24px -18px rgba(30, 58, 138, 0.8); }
.brand-mark { background: #fff; color: var(--accent); }

/* ── Botones (Mitiga: CTA azul sólido; secundario suave/borde) ─────────────── */
.btn-primary { background: var(--accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--accent-soft); color: var(--accent-strong); }
.btn-secondary:hover { background: var(--accent-line); filter: none; }
.btn-line {
    background: var(--surface);
    border: 1.5px solid var(--line);
    color: var(--accent-strong);
    font-weight: 700;
}
.btn-line:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }

/* ── Tarjetas (Mitiga: rounded-2xl, borde azul tenue, sombra azulada) ──────── */
.card, .dash-card, .tarj-card, .complete-card, .admin-card, .area-card {
    border: 1px solid var(--accent-line);
}
.dash-card:hover { box-shadow: var(--shadow-md); }

/* ── Portada / bienvenida ──────────────────────────────────────────────────── */
.screen-cover { max-width: 460px; display: grid; gap: 22px; }
.cover { text-align: center; }
.cover-mark {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-size: 2.1rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}
.cover-title { margin: 0; font-size: 2rem; line-height: 1.1; }
.cover-tagline { margin: 10px auto 0; max-width: 30ch; color: var(--muted); font-size: 1.02rem; line-height: 1.5; }
.cover-card { animation-delay: 0.05s; }

/* ── Subsección como "eyebrow" (mayúsculas, tracking ancho, azul) ──────────── */
.tarj-sub {
    background: none;
    padding: 0;
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
}

/* ── Barras de progreso (azul Mitiga) ──────────────────────────────────────── */
.bar { height: 12px; background: var(--line); }
.bar::-webkit-progress-value { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.bar::-moz-progress-bar { background: var(--accent); }

/* ── Tarjetero: transición fluida + altura estable (sin saltos) ────────────── */
.tarj-card { min-height: 220px; animation: card-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.tarj-nav .btn { padding: 0.9rem 1rem; }
@keyframes card-in {
    from { opacity: 0; transform: translateY(10px) scale(0.992); }
    to { opacity: 1; transform: none; }
}

/* ── Audio: botón de grabar protagonista + estados claros ──────────────────── */
.audio-rec {
    width: 100%;
    justify-content: center;
    gap: 12px;
    padding: 0.95rem 1.1rem;
    font-size: 1.02rem;
    box-shadow: var(--shadow-sm);
}
.audio-rec .rec-dot { width: 14px; height: 14px; background: var(--danger); box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.15); }
.audio-recording {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--danger-soft);
    border: 1.5px solid var(--danger-line);
    border-radius: 14px;
}
.audio-stop { box-shadow: 0 12px 26px -14px rgba(220, 38, 38, 0.65); }
.audio-time { color: var(--danger); font-size: 1.3rem; }

/* ── Modo oscuro afinado (azul Mitiga sobre fondo profundo) ────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-1: #0b1220;
        --bg-2: #0a0f1a;
        --surface: #131c2b;
        --surface-2: #182234;
        --text: #e8eef6;
        --muted: #9fb0c4;
        --line: #273449;
        --accent: #3b82f6;
        --accent-strong: #2563eb;
        --accent-soft: #11203a;
        --accent-line: #1e314f;
        --danger-soft: #2a1414;
        --danger-line: #5b2626;
        --ok-soft: #0e2a1b;
        --ring: rgba(59, 130, 246, 0.5);
        --shadow: 0 24px 50px -28px rgba(0, 0, 0, 0.75);
        --shadow-md: 0 10px 24px -12px rgba(0, 0, 0, 0.6);
    }
    body { background: radial-gradient(1100px 520px at 100% -8%, rgba(37, 99, 235, 0.14), transparent 60%), linear-gradient(170deg, var(--bg-1), var(--bg-2)); }
    .field input, .tarj-answer, .audio-rec { background: var(--surface-2); }
    .brand-mark { background: rgba(255, 255, 255, 0.16); color: #fff; }
}
