/* ===================================================
   InnovacionFM — Dashboard styles
   Extends udd-tokens.css (imported below).
   Prefixes: .dash-* (investigador) and .adm-* (admin).
   =================================================== */

@import 'udd-tokens.css';

/* Tipografía de marca en body para páginas que cargan solo dashboard.css
   (login/base.html no incluyen style.css). Idempotente donde style.css ya lo setea. */
body {
    font-family: var(--font-body);
    color: var(--text-primary);
}
h1, h2, h3 {
    font-family: var(--font-heading);
}

/* ===== Foco visible de teclado (critique 2026-07 — P1-4) ===== */
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ---- Layout shell ---- */
.dash-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    min-height: calc(100vh - 56px);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(0, 154, 122, 0.05) 0%, transparent 55%),
        var(--bg);
}

/* Focal max-width por rol (Etapa 9 — T2) */
.dash-shell--investigador {
    max-width: 720px;
}

.dash-shell--admin {
    max-width: 1200px;
}

/* ---- Branding header (Etapa 9 — T2) ---- */
.header-logo {
    height: 28px;
    transition: opacity 0.2s;
    filter: none;
}

.header-logo:hover {
    opacity: 0.85;
}

.header-top-bar {
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    letter-spacing: 0.02em;
}

/* ---- App nav bar ---- */
.dash-app-nav {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    gap: 1rem;
}

.dash-app-nav .header-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    text-decoration: none;
}

.dash-app-nav nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-app-nav nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}

.dash-app-nav nav a:hover {
    color: #fff;
}

.dash-app-nav nav button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s, color 0.15s;
}

.dash-app-nav nav button:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* ---- Progress bar ---- */
.dash-progress {
    margin: 1.25rem 0;
}

.dash-progress__label {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.dash-progress__track {
    height: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.dash-progress__fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

/* ---- Item cards ---- */
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-card:hover {
    box-shadow: var(--shadow-lg);
}

.dash-card__icon {
    font-size: 1.4rem;
    min-width: 2rem;
    text-align: center;
}

.dash-card__body {
    flex: 1;
    min-width: 0;
}

.dash-card__pos {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.dash-card__name {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-card__badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    font-weight: 500;
    white-space: nowrap;
}

.dash-card__badge--nuevo {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.dash-card__badge--en_conversacion {
    background: rgba(0, 154, 122, 0.12);
    color: var(--accent-ink-soft);
    border: 1px solid rgba(0, 154, 122, 0.25);
}

.dash-card__badge--listo {
    background: rgba(0, 154, 122, 0.2);
    color: var(--accent-ink);
    border: 1px solid rgba(0, 154, 122, 0.35);
}

.dash-card__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ---- Nudge pill ---- */
.dash-nudge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: #fff;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(32, 38, 63, 0.12);
    transition: all 0.18s ease-out;
    margin-bottom: 1rem;
}

.dash-nudge:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(32, 38, 63, 0.16);
}

/* ---- Buttons ---- */
/* Taxonomía de botones (~11 clases conviven; NO hay rewrite global):
   - Primario (acción principal, glossy teal):  .btn-primary / .adm-btn
   - Secundario (acción alterna, superficie):   .btn-secondary  ·  .btn a secas = base neutra
   - Pill de descarga/exportar:                 .dash-btn
   - Chip terciario (link con forma de botón):  .btn-link
   - Submit de auth (login/registro):           .register-submit-btn
   - Chat:                                       #send-btn (enviar), .suggestion-btn (chips), .value-btn
   - Navegación in-app:                          .role-switch-btn, .new-project-btn
   `.btn` pelada es la base neutra que usan los paneles admin (one-pager/overlaps):
   le damos el mismo lenguaje que .btn-secondary para que no quede sin estilo. */
.btn {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    transition: background 0.15s, color 0.15s;
}

/* .adm-btn (users.html) comparte el lenguaje glossy del primary (T7) */
.btn-primary,
.adm-btn {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: #fff;
    border: none;
    box-shadow: 0 1px 2px rgba(32, 38, 63, 0.12);
    transition: all 0.18s ease-out;
}

.btn-primary:hover,
.adm-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(32, 38, 63, 0.16);
}

.btn-primary:active,
.adm-btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-ink);
    box-shadow: var(--shadow-sm);
}

/* ---- Item detail page ---- */
.dash-detail-header {
    margin-bottom: 1.25rem;
}

.dash-detail-header h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.record-detail {
    background: rgba(0, 154, 122, 0.06);
    border: 1px solid rgba(0, 154, 122, 0.2);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.dash-descripcion-section {
    margin-top: 1.25rem;
}

.dash-descripcion-section h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dash-evidence-list {
    margin-top: 1.25rem;
}

.dash-evidence-list h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dash-evidence-list ul {
    padding-left: 1.25rem;
}

.dash-evidence-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

/* ---- Historial de cambios (Etapa 8) — capa visual liviana ---- */
.history-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.history-entry {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.65rem 0.85rem;
}

.history-chip {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    background: rgba(0, 154, 122, 0.12);
    color: var(--accent-ink-soft);
    border: 1px solid rgba(0, 154, 122, 0.25);
}

.history-when {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.history-snapshot {
    margin-top: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.history-diff {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.history-diff summary {
    cursor: pointer;
    color: var(--accent-ink);
    font-size: 0.78rem;
}

.history-diff-body {
    margin-top: 0.35rem;
    line-height: 1.5;
}

.history-empty {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ---- Empty states ---- */
.dash-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ---- Admin table ---- */
.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.adm-table th {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--border-strong);
    text-align: left;
    white-space: nowrap;
    background: linear-gradient(180deg, rgba(32, 38, 63, 0.03), transparent);
}

.adm-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.adm-table tr:hover td {
    background: rgba(0, 154, 122, 0.04);
}

/* Links de nombre de proyecto en accent (el "Ver" es .btn-secondary y conserva su estilo) */
.adm-table a[href^="/admin/projects"] {
    color: var(--accent-ink);
    text-decoration: none;
}

.adm-table a[href^="/admin/projects"]:hover {
    text-decoration: underline;
}

/* Wrapper de scroll horizontal para la tabla admin en tablet (T7) */
.adm-table-wrap {
    overflow-x: auto;
}

/* ---- Pills de estado (Etapa 9 — T6) ---- */
/* Texto del estado siempre presente (significado); el color es realce. */
.adm-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: capitalize;
}

.adm-status--nuevo {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.adm-status--en_conversacion {
    background: rgba(0, 154, 122, 0.08);
    border: 1px solid rgba(0, 154, 122, 0.2);
    color: var(--accent-ink-soft);
}

.adm-status--listo {
    background: rgba(0, 154, 122, 0.18);
    border: 1px solid rgba(0, 154, 122, 0.35);
    color: var(--accent-ink);
}

.adm-status--archivado {
    background: var(--bg);
    color: var(--text-primary);
    border: 1px dashed var(--border-strong);
}

/* ---- Admin metrics ---- */
/* Contenedor real del swap HTMX (markup usa .adm-metrics, no .adm-metrics-grid) */
.adm-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

/* legacy: markup usa .adm-metrics (contenedor) y .adm-metric(-value/-label) (hijos) */
.adm-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.adm-metric {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.adm-metric-value {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.adm-metric-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* legacy (markup usa .adm-metric-value/-label con guion) */
.adm-metric__value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.adm-metric__label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ---- Admin filters ---- */
.adm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.adm-filters select,
.adm-filters input[type="text"],
.adm-filters input[type="search"] {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.adm-filters select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235A6278' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.adm-filters select:focus,
.adm-filters input[type="text"]:focus,
.adm-filters input[type="search"]:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* ---- Admin template editor ---- */
.adm-editor-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.adm-editor-row:hover {
    background: var(--bg);
}

.adm-editor-row__handle {
    cursor: grab;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0.1rem 0.25rem;
    user-select: none;
}

.adm-editor-row__handle:active {
    cursor: grabbing;
}

.adm-editor-row__pos {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 1.5rem;
    text-align: right;
}

.adm-editor-row__name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.adm-editor-row__actions {
    display: flex;
    gap: 0.4rem;
}

/* ---- Progress bar (inline in table) ---- */
.adm-progress-track {
    height: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    min-width: 80px;
}

.adm-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-pill);
}

/* ---- Forms ---- */
.dash-form-group {
    margin-bottom: 1rem;
}

.dash-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.dash-form-group textarea,
.dash-form-group input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface);
    resize: vertical;
    box-sizing: border-box;
}

.dash-form-group textarea:focus,
.dash-form-group input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* .form-group dentro de la app (users.html — no carga style.css) (T7) */
.adm-user-create .form-group {
    margin-bottom: 1rem;
}

.adm-user-create .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.adm-user-create .form-group input,
.adm-user-create .form-group select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.adm-user-create .form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235A6278' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.adm-user-create .form-group input:focus,
.adm-user-create .form-group select:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .header-top-bar,
    .dash-app-nav {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dash-app-nav nav {
        gap: 6px;
    }

    .adm-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .adm-table th:nth-child(n+4),
    .adm-table td:nth-child(n+4) {
        display: none;
    }

    .dash-card__actions {
        flex-direction: column;
    }
}

/* ── Export (Etapa 4 — T13): botones de descarga Excel/PDF ── */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dash-export,
.adm-export {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.dash-btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(32, 38, 63, 0.12);
    transition: all 0.18s ease-out;
}

.dash-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(32, 38, 63, 0.16);
}

/* Historial de descripciones — diff inline word-level (Etapa 8) */
ins {
    text-decoration: none;
    background: var(--ok-bg, var(--success-bg));
    color: var(--ok-fg, var(--success));
}

del {
    text-decoration: line-through;
    background: var(--err-bg, var(--danger-bg));
    color: var(--err-fg, var(--danger));
}

/* ── Login / cambio de contraseña (base.html) — Etapa 9 fix ──────────────────
   base.html linkea dashboard.css (no style.css) para que el header sea barra
   superior y NO herede el body{display:flex;height:100vh} del app original.
   Acá viven los estilos de la card glossy de esas páginas. */
.registration-section {
    display: flex;
    justify-content: center;
    padding: 48px 16px;
    min-height: calc(100vh - 56px);
    background: radial-gradient(ellipse at 50% 0%, rgba(0, 154, 122, 0.05) 0%, transparent 55%), var(--bg);
}

/* box-sizing: las páginas de login/registro cargan SOLO dashboard.css (sin el reset
   global de style.css), así que sin esto el width:100%+padding+border se desborda en mobile. */
.registration-card,
.register-form input,
.register-submit-btn { box-sizing: border-box; }

.registration-card {
    width: 100%;
    max-width: 420px;
    align-self: flex-start;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-strong);
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
}

.registration-heading {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.registration-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.register-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.register-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.register-form label {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.register-form input {
    width: 100%;
    min-height: 44px; /* target táctil */
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    font-family: var(--font-body);
    font-size: 16px; /* >=16px evita el auto-zoom de iOS al enfocar el input */
    color: var(--text-primary);
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.register-form input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.register-submit-btn {
    margin-top: 8px;
    padding: 13px 28px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    box-shadow: 0 1px 2px rgba(32, 38, 63, 0.12);
    transition: background 0.25s ease, transform 0.25s ease;
}

.register-submit-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent));
    transform: translateY(-1px);
}

.form-error {
    padding: 10px 14px;
    border-radius: var(--radius);
    background: rgba(224, 82, 82, 0.06);
    border: 1px solid rgba(224, 82, 82, 0.2);
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

/* ── Primera ventana estilo MetAI (login + auto-registro) ────────────────────
   Portado de MetAI (globals.css / innovacionfm.css) adaptado a los tokens
   canónicos de udd-tokens.css. La card ancha es 2 columnas desde 1024px
   (form a la izquierda, columna informativa a la derecha) y colapsa a una
   sola columna en mobile. Touch targets ≥44px en tabs, toggles y selects. */
.registration-card--wide {
    max-width: 1100px;
}

.registration-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

@media (min-width: 1024px) {
    .registration-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 56px;
        align-items: start;
    }
}

/* El atributo [hidden] pierde efecto si el form declara display:flex/grid
   (register-form es flex) → se fuerza acá para que los tabs oculten de verdad. */
.registration-card [hidden] {
    display: none !important;
}

.auth-section-block {
    margin-bottom: 18px;
}

.control-label {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Tabs de modo de acceso y de perfil: 2 botones lado a lado. */
.role-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.role-switch-btn {
    width: 100%;
    min-height: 44px; /* target táctil */
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.role-switch-btn:hover {
    border-color: rgba(0, 154, 122, 0.24);
    color: var(--primary);
}

.role-switch-btn.active {
    background: rgba(0, 154, 122, 0.08);
    border-color: rgba(0, 154, 122, 0.28);
    color: var(--accent-ink);
}

.role-switch-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--text-secondary);
}

/* Campo de contraseña con botón Mostrar/Ocultar superpuesto a la derecha. */
.password-field {
    position: relative;
}

.password-field input {
    padding-right: 96px; /* deja lugar al botón Mostrar/Ocultar */
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    min-height: 44px; /* target táctil */
    min-width: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--accent-ink);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.18s ease;
}

.password-toggle:hover {
    color: var(--accent-strong);
}

/* Nota de ayuda contextual (el texto cambia según modo+perfil vía JS). */
.panel-note {
    /* Nota de apoyo: borde completo + fondo tinte (sin side-stripe;
       critique 2026-07 — el border-left de 4px era el anti-patrón side-tab). */
    padding: 14px 16px;
    border: 1px solid rgba(0, 154, 122, 0.25);
    background: var(--surface-soft);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

/* Columna informativa: cards de apoyo en 1 columna (viven en media card,
   no a lo ancho de la página como en MetAI). */
.registration-support-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.registration-support-card,
.reference-examples-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 15px 16px;
    box-sizing: border-box;
}

.registration-support-label {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
}

.registration-support-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.reference-examples-card {
    margin-top: 16px;
}

.reference-example-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 16px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.registration-info-col .panel-note {
    margin-top: 16px;
}

/* El select de afiliación espeja el input del register-form (16px anti-zoom
   iOS) con la misma flecha SVG del select de .adm-user-create. */
.register-form select {
    width: 100%;
    min-height: 44px; /* target táctil */
    padding: 10px 36px 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    font-family: var(--font-body);
    font-size: 16px; /* >=16px evita el auto-zoom de iOS al enfocar */
    color: var(--text-primary);
    background: var(--surface);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235A6278' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.register-form select:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* Botón "Historial" (project_detail) — chip teal sutil, no botón default gris */
.btn-link {
    background: rgba(0, 154, 122, 0.07);
    border: 1px solid rgba(0, 154, 122, 0.22);
    color: var(--accent-ink);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-link:hover {
    background: rgba(0, 154, 122, 0.13);
    border-color: var(--accent);
}

/* ===== Solapamientos entre proyectos (Etapa 12 — feature 8) ===== */
/* .dash-card es flex-row (icono+contenido+acciones); el panel apila vertical. */
.adm-overlap {
    display: block;
    align-items: initial;
}
.adm-overlap-intro {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 1rem;
    max-width: 640px;
}
.adm-overlap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.adm-overlap-head h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--primary);
}
.adm-overlap-aviso {
    background: rgba(224, 168, 0, 0.08);
    border: 1px solid rgba(224, 168, 0, 0.3);
    color: var(--warning);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}
.adm-overlap-prev-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.5rem;
}
.adm-overlap-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.adm-overlap-summary {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.adm-overlap-clusters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.adm-overlap-cluster {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-md);
}
.adm-overlap-cluster-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.adm-overlap-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: capitalize;
    background: var(--bg);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}
.adm-overlap-pill--alta {
    background: rgba(0, 154, 122, 0.18);
    border-color: rgba(0, 154, 122, 0.35);
    color: var(--accent-ink);
}
.adm-overlap-pill--media {
    background: rgba(0, 154, 122, 0.08);
    border-color: rgba(0, 154, 122, 0.2);
    color: var(--accent-ink-soft);
}
.adm-overlap-pill--baja,
.adm-overlap-pill--desconocida {
    background: var(--bg);
    border-color: var(--border-strong);
    color: var(--text-secondary);
}
.adm-overlap-chip {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    background: rgba(32, 38, 63, 0.06);
    color: var(--primary);
    border: 1px solid rgba(32, 38, 63, 0.12);
}
.adm-overlap-dim {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 0.3rem;
}
.adm-overlap-projects {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.adm-overlap-rationale,
.adm-overlap-action {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.adm-overlap-action {
    color: var(--accent-ink);
}
.adm-overlap-sindatos {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.adm-overlap-sindatos ul {
    margin: 0.3rem 0 0 1.1rem;
}

/* ===== Toast (critique 2026-07 — P1-5) ===== */
#toast-region {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 8px; z-index: 2000;
    pointer-events: none; max-width: min(480px, calc(100vw - 32px));
}
.toast {
    background: var(--primary); color: #fff; padding: 10px 16px;
    border-radius: var(--radius); font-size: 13px; line-height: 1.4;
    box-shadow: var(--shadow-md); opacity: 0; transform: translateY(6px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--error { background: var(--danger); }
.toast--success { background: var(--accent-ink); }

/* ===== One-pager ejecutivo (Etapa 7 — fix P0 critique 2026-07) =====
   Espeja el vocabulario de .adm-overlap-*. .dash-card es flex-row → block. */
.adm-one-pager { display: block; align-items: initial; }
.adm-one-pager-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.adm-one-pager-head h2 { font-family: var(--font-heading); font-size: 1.1rem; color: var(--primary); }
.adm-one-pager-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.adm-one-pager-aviso {           /* espeja .adm-overlap-aviso */
    background: rgba(224, 168, 0, 0.08); border: 1px solid rgba(224, 168, 0, 0.3);
    color: var(--warning); padding: 0.6rem 0.85rem; border-radius: var(--radius);
    font-size: 0.85rem; margin-bottom: 0.75rem;
}
.adm-one-pager-caja {            /* header de datos: card interna quieta */
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    background: var(--surface-muted); padding: 0.85rem 1rem; margin-bottom: 0.75rem;
    font-size: 0.9rem; line-height: 1.6; color: var(--text-primary);
}
.adm-one-pager-caja p { margin: 0 0 0.15rem; }
.adm-one-pager-franja {          /* franja de chips de estado por ítem */
    display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem;
}
.adm-one-pager-chip {            /* espeja .adm-overlap-pill */
    display: inline-block; padding: 0.2rem 0.6rem; border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 600; white-space: nowrap;
    background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-strong);
}
.adm-chip-listo {
    background: rgba(0, 154, 122, 0.18); border-color: rgba(0, 154, 122, 0.35);
    color: var(--accent-ink);
}
.adm-chip-en_conversacion {
    background: rgba(0, 154, 122, 0.08); border-color: rgba(0, 154, 122, 0.2);
    color: var(--accent-ink-soft);
}
/* .adm-chip-nuevo hereda el default de .adm-one-pager-chip (no requiere regla) */
.adm-one-pager-narrativa { font-size: 0.9rem; line-height: 1.55; color: var(--text-primary); }
.adm-one-pager-narrativa p { margin: 0 0 0.6rem; }
.adm-one-pager-meta {            /* espeja .adm-overlap-meta */
    font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.5rem;
}

/* ===== Estado ocupado de botones HTMX (critique 2026-07 — P0-2) ===== */
.btn-spinner {
    display: none; width: 12px; height: 12px; margin-left: 6px;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; vertical-align: -2px;
    animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.htmx-request .btn-spinner, .htmx-request.btn-spinner { display: inline-block; }
button.htmx-request, .btn.htmx-request { opacity: 0.75; cursor: progress; }

/* ===== Reduced motion (critique 2026-07 — P2-6) =====
   Bloque al final de dashboard.css y con !important para ganar aunque
   style.css cargue después en la base focal (inmunidad al orden de carga).
   Cubre fadeIn/typingDot (style.css), btn-spin, slide-overs de .ficha-panel
   y .modal-content, hovers translateY/scale, transition: width de las barras
   de progreso, y scroll-behavior: smooth de .chat-area. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== WP7 — clases utilitarias antes indefinidas (definidas/consolidadas) =====
   Referenciadas por partials/templates y hasta ahora sin regla propia.
   Hooks estructurales que se dejan SIN estilo a propósito (no son bugs visuales):
   .dash-descripcion-read/-edit, .dash-evidence-form, .dash-evidence-del,
   .adm-editor-add, .adm-user-list, .adm-user-create (tiene reglas hijas),
   .adm-project-detail, .adm-project-row, .registration-form-col,
   .registration-info-col, .auth-section-block (tiene regla),
   .record-status-icon (tiene regla). */

.dash-muted {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.dash-textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface);
    resize: vertical;
    box-sizing: border-box;
}
.dash-textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.dash-breadcrumb {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.dash-breadcrumb a {
    color: var(--accent-ink);
    text-decoration: none;
}
.dash-breadcrumb a:hover {
    text-decoration: underline;
}

.dash-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.dash-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.dash-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-strong);
}

.adm-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.75rem 0;
}

.adm-nav {
    font-size: 0.85rem;
    margin: 0.25rem 0 1.25rem;
}
.adm-nav a {
    color: var(--accent-ink);
    text-decoration: none;
}
.adm-nav a:hover {
    text-decoration: underline;
}

.adm-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: -0.25rem 0 1.25rem;
}

/* Hereda de .dash-card (flex-row) → apilar vertical (mismo fix que .adm-overlap). */
.adm-project-meta {
    display: block;
    align-items: initial;
    font-size: 0.9rem;
    line-height: 1.6;
}
.adm-project-meta p {
    margin: 0 0 0.15rem;
}
