/* Artifizio Calendario Legal - Estilos personalizados v0.6.0 */

/* Safe area para dispositivos con notch */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Navegación inferior.
 *
 * El estado activo era sólo un cambio de color, así que en un vistazo rápido
 * no se distinguía dónde estabas. Ahora el botón activo levanta una píldora
 * de acento detrás del icono y una barra dorada arriba: la señal se lee de
 * reojo, que es como se lee una barra de pestañas. */
.nav-btn {
    position: relative;
    color: var(--ink-3);
    border-radius: var(--r-sm);
    transition: color var(--dur) var(--ease-out);
}
.nav-btn::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    width: 0;
    height: 2.5px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
    transform: translateX(-50%);
    transition: width var(--dur) var(--ease-out);
}
.nav-btn.active {
    color: var(--brand-ink);
}
.nav-btn.active::before {
    width: 32px;
}
.nav-btn.active svg {
    stroke-width: 2.4;
}
.nav-btn:active {
    background: var(--surface-2);
}

/* Cards.
 *
 * Antes: blanco plano, radio 1rem, una sombra negra al 8 % que sobre un fondo
 * cálido se lee gris sucio. Ahora hay borde de pelo, sombra teñida de marca y
 * una elevación real al pasar el puntero — la tarjeta se siente un objeto y no
 * un rectángulo pintado. */
.card {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 1rem;
    transition: transform var(--dur-fast) var(--ease-out),
                box-shadow var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .card[data-nav]:hover,
    .card.card-interactive:hover {
        box-shadow: var(--sh-2);
        border-color: var(--line-strong);
        transform: translateY(-1px);
    }
}
.card:active {
    transform: scale(0.985);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 1.75rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--line-strong) 0%, var(--line) 100%);
}
.timeline-item:last-child::before {
    display: none;
}
.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 3px solid var(--line-strong);
    background: var(--surface);
    z-index: 1;
    transition: transform var(--dur) var(--ease-out),
                box-shadow var(--dur) var(--ease-out);
}
.timeline-dot.completado {
    background: var(--ok);
    border-color: var(--ok);
}
.timeline-dot.en-curso {
    background: var(--accent);
    border-color: var(--accent);
    animation: pulse-dot 2.4s var(--ease-in-out) infinite;
}
.timeline-dot.vencido {
    background: var(--danger);
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-soft);
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198, 161, 91, .50); }
    50%      { box-shadow: 0 0 0 9px rgba(198, 161, 91, 0); }
}

/* El hito en curso late para atraer la vista; quien pidió menos movimiento
 * necesita igual saber cuál es, así que el pulso se sustituye por un halo
 * fijo en vez de desaparecer. */
@media (prefers-reduced-motion: reduce) {
    .timeline-dot.en-curso {
        animation: none;
        box-shadow: 0 0 0 4px var(--warn-soft);
    }
}

/* Wizard steps */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.step-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: var(--line-strong);
    transition: background-color var(--dur) var(--ease-out),
                width var(--dur) var(--ease-out);
}
/* El paso actual se alarga en vez de crecer: una píldora lee «estás aquí»
 * mejor que un punto un poco más grande que sus vecinos. */
.step-dot.active {
    background: var(--brand);
    width: 1.5rem;
}
.step-dot.done {
    background: var(--accent-2);
}

/* Calendar grid.
 *
 * `minmax(0, 1fr)` (en vez de `1fr` = `minmax(auto, 1fr)`) permite
 * que las columnas se encojan por debajo del min-content de su
 * contenido. Sin esto, el nombre del `editado_por` del despacho
 * (ej. "Sebastian Rodriguez") expande las celdas y empuja el
 * grid más ancho que el viewport del teléfono, cortando el
 * header y los labels del header de día. */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    min-width: 0;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out),
                color var(--dur) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    min-height: 40px;
    min-width: 0;
    overflow: hidden;
    padding: 2px;
    text-align: center;
    line-height: 1.1;
}
.cal-day > * {
    max-width: 100%;
}
.cal-day:active {
    transform: scale(0.9);
}
.cal-day.despacho {
    background: #d1fae5;
    color: #065f46;
}
.cal-day.no-despacho {
    background: #fee2e2;
    color: #991b1b;
}
.cal-day.sin-registrar {
    background: #f3f4f6;
    color: #6b7280;
}
.cal-day.fin-semana {
    background: #e5e7eb;
    color: #9ca3af;
}
.cal-day.vacacion {
    background: #fef3c7;
    color: #92400e;
}
/* Feriado nacional: el motor no lo cuenta y no se puede marcar a mano. */
.cal-day.feriado {
    background: #ede9fe;
    color: #5b21b6;
}
.cal-day.sugerido {
    border: 2px dashed #60a5fa;
    background: #eff6ff;
    color: #1e40af;
}

/* Despacho tabs */
.despacho-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    border-radius: 0.75rem;
    padding: 4px;
}
.despacho-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out),
                color var(--dur) var(--ease-out),
                box-shadow var(--dur) var(--ease-out);
}
.despacho-tab.active {
    background: white;
    color: var(--brand);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.despacho-tab[data-modo="bot"].active {
    color: #1e40af;
}
.despacho-bot-header {
    border-left: 3px solid #3b82f6;
}
.despacho-bot-card {
    border-left: 3px solid #93c5fd;
}

/* Disclaimer popup */
.despacho-disclaimer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: background 0.3s;
    pointer-events: none;
}
.despacho-disclaimer-overlay.active {
    background: rgba(0,0,0,0.5);
    pointer-events: auto;
}
.despacho-disclaimer-modal {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    transform: scale(0.94);
    opacity: 0;
    transition: transform var(--dur-slow) var(--ease-out),
                opacity var(--dur-slow) var(--ease-out);
}
.despacho-disclaimer-overlay.active .despacho-disclaimer-modal {
    transform: scale(1);
    opacity: 1;
}
.despacho-disclaimer-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.cal-day.header {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
    cursor: default;
}

/* Form / Button base styles MOVED to src/tailwind.css under
 * @layer components so Tailwind utilities (w-NN, sm:w-auto, etc.)
 * win over them by virtue of the cascade layer order. Mantener
 * sólo .form-label y .selector-card acá porque no tienen
 * propiedades que Tailwind utilities pueda querer overridear. */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand-2);
    margin-bottom: 0.375rem;
}

/* Selector cards */
.selector-card {
    border: 1.5px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    padding: 0.75rem 1rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform var(--dur-fast) var(--ease-out),
                border-color var(--dur) var(--ease-out),
                background-color var(--dur) var(--ease-out),
                box-shadow var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .selector-card:hover { border-color: var(--brand-3); box-shadow: var(--sh-1); }
}
.selector-card:active {
    transform: scale(0.98);
}
.selector-card.selected {
    border-color: var(--brand);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-soft), var(--sh-1);
}

/* Process category collapsible (wizard step 2). Native <details>/<summary>
 * provides toggle + a11y for free; we just hide the default marker and
 * rotate the chevron when [open]. */
.process-category-summary {
    list-style: none;
}
.process-category-summary::-webkit-details-marker {
    display: none;
}
.process-category-chevron {
    transition: transform 0.2s ease;
}
.process-category[open] > .process-category-summary .process-category-chevron {
    transform: rotate(180deg);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ordinario {
    background: #dbeafe;
    color: #1e40af;
}
.badge-breve {
    background: #fce7f3;
    color: #9d174d;
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--line);
    border-top-color: var(--accent-2);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Esqueletos de carga ─────────────────────────────────────────────────
 * Sustituyen a la pantalla que sólo decía «Cargando». Un esqueleto con la
 * forma del contenido evita el salto de layout al repoblar y hace la espera
 * más corta de lo que es, porque la pantalla ya se parece al resultado. */
.skeleton {
    background: linear-gradient(90deg,
        var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
    background-size: 400% 100%;
    animation: skeleton-sweep 1.4s var(--ease-in-out) infinite;
    border-radius: var(--r-sm);
}
@keyframes skeleton-sweep {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
.skeleton-line { height: .75rem; margin-bottom: .5rem; }
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-card {
    height: 5.5rem;
    border-radius: var(--r-lg);
    margin-bottom: .75rem;
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; background: var(--surface-3); }
}

/* Search input */
.search-input-wrapper {
    position: relative;
}
.search-input-wrapper svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}
.search-input-wrapper input {
    padding-left: 2.5rem;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch.active {
    background: #10b981;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.active::after {
    transform: translateX(1.25rem);
}

/* Empty state */
/* Estado vacío. Es una invitación a actuar, no un aviso de que no hay nada,
 * así que el icono va dentro de un disco de acento en vez de flotar gris. */
.empty-state {
    text-align: center;
    padding: 3rem 1.25rem;
    color: var(--ink-2);
}
.empty-state svg {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 1.1rem;
    padding: .5rem;
    box-sizing: content-box;
    color: var(--accent-ink);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 9999px;
    opacity: 1;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo h2 {
    color: var(--brand);
    font-size: 1.5rem;
    font-weight: 700;
}
.auth-logo p {
    color: var(--brand-3);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
.auth-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.auth-link {
    color: var(--brand);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

/* User menu dropdown */
.user-menu {
    position: relative;
}
.user-menu-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--brand);
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.3);
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: 2.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    overflow: hidden;
    z-index: 60;
    display: none;
}
.user-dropdown.open {
    display: block;
}
.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: var(--brand-2);
    cursor: pointer;
    border: none;
    background: none;
}
.user-dropdown-item.danger {
    color: #dc2626;
}
.user-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
}
/* Notifications bell */
.notif-menu {
    position: relative;
}
.notif-bell-btn {
    position: relative;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    background: none;
    border: none;
    transition: background 0.2s;
}
.notif-bell-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
/* Contact button (header) */
.contact-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: background 0.2s;
}
.contact-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.notif-dropdown {
    position: absolute;
    right: 0;
    top: 2.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 320px;
    max-width: 90vw;
    overflow: hidden;
    z-index: 60;
    display: none;
}
.notif-dropdown.open {
    display: block;
}
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}
.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}
.notif-item:hover {
    background: #f9fafb;
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item-unread {
    background: var(--surface-2);
}
.notif-item-unread:hover {
    background: #faf0e4;
}
.notif-icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-top: 0.125rem;
}
.notif-icon-proximo {
    background: #fef3c7;
}
.notif-icon-vencido {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 700;
}
.notif-item-body {
    flex: 1;
    min-width: 0;
}
.notif-item-msg {
    font-size: 0.8125rem;
    color: #1f2937;
    line-height: 1.3;
}
.notif-item-meta {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0.125rem;
}
.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

.admin-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    background: var(--accent-soft);
    color: var(--brand);
    text-transform: uppercase;
}
.badge-divorcio {
    background: #fce7f3;
    color: #9d174d;
}
.badge-separacion {
    background: #f3e8ff;
    color: #6b21a8;
}
.section-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}
/* Badge types */
.badge-amparo {
    background: #fef3c7;
    color: #92400e;
}
.badge-contencioso {
    background: #e0e7ff;
    color: #3730a3;
}
.badge-penal {
    background: #fce7f3;
    color: #9d174d;
}
.badge-especial {
    background: #ecfdf5;
    color: #065f46;
}

/* Tribunal collapsible groups */
.tribunal-group-header {
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}
.tribunal-group-header:hover {
    background: #f9fafb;
}
.tribunal-group-header .chevron {
    transition: transform 0.2s;
}

/* Ficha card */
.ficha-card {
    border-left: 4px solid var(--brand);
}

/* Calendario de hitos */
.cal-hito-day {
    position: relative;
    flex-direction: column;
    gap: 1px;
    background: #f9fafb;
}
.cal-hito-day:hover {
    background: #e5e7eb;
}
.cal-today {
    border: 2px solid var(--brand);
    font-weight: 700;
}
.cal-hito-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}
.cal-hito-count {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.5rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1;
}

/* Popup overlay */
.cal-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 80;
}
.cal-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 90;
}
.cal-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}
.cal-popup-close {
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
}
.cal-popup-close:hover {
    color: #374151;
}
.cal-popup-body {
    padding: 0.75rem 1.25rem 1.25rem;
}
.cal-popup-hito {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.cal-popup-hito:last-child {
    border-bottom: none;
}

/* Badge recurso / civil */
.badge-recurso {
    background: #f0fdf4;
    color: #166534;
}
.badge-civil {
    background: #dbeafe;
    color: #1e40af;
}

/* Badges laboral + NNA + beta */
.badge-laboral {
    background: #fef3c7;
    color: #92400e;
}
.badge-nna {
    background: #e0e7ff;
    color: #3730a3;
}

/* Calendario hitos - colored cells */
.cal-hito-day.con-hitos {
    background: #dbeafe;
    color: #1e40af;
}
.cal-hito-day.hito-proximo {
    background: #fef3c7;
    color: #92400e;
}
.cal-hito-day.hito-vencido {
    background: #fee2e2;
    color: #991b1b;
}
.cal-hito-day.sin-hitos {
    background: #f3f4f6;
    color: #6b7280;
}
.cal-hito-day.cal-has-revision {
    background: #ede9fe;
    color: #6d28d9;
}

/* Requisito cards */
.requisito-card {
    transition: box-shadow var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}
.requisito-card:hover {
    background: var(--surface-2);
}

/* Accordion for action groups */
.tribunal-group-header[data-group] {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tribunal-group-header[data-group]:hover {
    background: var(--surface-2);
}
.tribunal-group-header[data-group] .chevron.rotate-180 {
    transform: rotate(180deg);
}
/* Spam/verification alert banner */
.spam-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}
.spam-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.spam-alert-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    color: #2563eb;
    margin-top: 0.125rem;
}
.spam-alert-text {
    flex: 1;
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
}
.spam-alert-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #60a5fa;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.spam-alert-close:hover {
    color: #2563eb;
}

/* Google Calendar */
.gcal-sync-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.gcal-sync-btn:hover { background: #1558b0; }
.gcal-sync-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.gcal-connect-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fff;
    color: #1a73e8;
    border: 1.5px solid #1a73e8;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: background-color var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out);
}
.gcal-connect-btn:hover { background: #e8f0fe; }
.gcal-connect-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.gcal-connected {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #16a34a;
    font-weight: 500;
}

/* ========== Expedientes Judiciales ========== */

/* Tabs */
.exp-tab {
    transition: color var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out),
                background-color var(--dur) var(--ease-out);
    user-select: none;
}
.exp-tab:active {
    transform: scale(0.95);
}
.exp-tab.active {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--surface-2);
}

/* Texto legal formateado */
.prose-legal {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    color: #1f2937;
}
.prose-legal p {
    margin-bottom: 1em;
    text-align: justify;
}
.prose-legal hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.5em 0;
}

/* Preview thumbnails */
.exp-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}
.exp-preview-thumb {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
}
.exp-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.exp-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
}
.exp-preview-remove:hover {
    background: #dc2626;
}

/* Drop zone */
.exp-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ink-3);
    transition: border-color var(--dur) var(--ease-out),
                background-color var(--dur) var(--ease-out),
                color var(--dur) var(--ease-out);
    cursor: pointer;
}
.exp-drop-zone.dragover {
    border-color: var(--brand);
    background: var(--surface-2);
    color: var(--brand);
}

/* Progress bar */
.exp-progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.exp-progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 9999px;
    transition: width 0.3s ease;
}
.exp-progress-fill.animating {
    background: linear-gradient(90deg, var(--brand) 0%, var(--accent-2) 50%, var(--brand) 100%);
    background-size: 200% 100%;
    animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estado badges */
.badge-exp {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
}
.badge-en-cola {
    background: #fef3c7;
    color: #92400e;
}
.badge-procesando {
    background: #dbeafe;
    color: #1e40af;
}
.badge-analizando {
    background: #f3e8ff;
    color: #6b21a8;
}
.badge-completado {
    background: #d1fae5;
    color: #065f46;
}
.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* PDF icon in exp list */
.exp-pdf-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #fee2e2;
    color: #dc2626;
    font-size: 0.625rem;
    font-weight: 700;
}

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ════════════════════════════════════════════════════════════════════
 * Dark mode (toggled via `<html class="dark">`, see assets/js/theme-init.js).
 * Overrides for the legacy hand-rolled component classes above. The
 * @layer base block in src/tailwind.css handles the Tailwind utilities
 * (.bg-white, .text-gray-800, etc.) that JS-generated HTML emits.
 * ════════════════════════════════════════════════════════════════════ */

/* .nav-btn, .card, .timeline-*, .step-dot y .empty-state ya NO necesitan
 * override oscuro: se definen contra los tokens de src/tailwind.css y
 * `html.dark` los redefine de una vez. Los overrides con hex a mano que
 * vivían aquí se retiraron el 27-08-2026 — sobrevivían al cambio de tema
 * y pisaban el token, dejando tarjetas de dos colores distintos según de
 * qué archivo viniera la regla. */

html.dark .cal-day.despacho {
    background: #14301f;
    color: #86efac;
}
html.dark .cal-day.no-despacho {
    background: #3a1818;
    color: #fca5a5;
}
html.dark .cal-day.feriado {
    background: #241a3d;
    color: #c4b5fd;
}
html.dark .cal-day.sin-registrar {
    background: var(--surface-2);
    color: var(--ink-3);
}
html.dark .cal-day.fin-semana {
    background: var(--surface-3);
    color: var(--ink-4);
}
html.dark .cal-day.vacacion {
    background: #3a2f15;
    color: #fcd34d;
}
html.dark .cal-day.sugerido {
    border-color: #1d4ed8;
    background: #14263b;
    color: #93c5fd;
}
html.dark .cal-day.header {
    color: var(--ink-3);
}

html.dark .despacho-tabs {
    background: var(--surface-2);
}
html.dark .despacho-tab {
    color: var(--ink-3);
}
html.dark .despacho-tab.active {
    background: var(--surface);
    color: var(--brand);
}
html.dark .despacho-tab[data-modo="bot"].active {
    color: #93c5fd;
}
html.dark .despacho-bot-card {
    border-left-color: #3b82f6;
}

html.dark .despacho-disclaimer-modal {
    background: var(--surface);
    color: var(--ink);
}

html.dark .form-label {
    color: var(--brand);
}

html.dark .selector-card {
    border-color: var(--line);
    background: var(--surface);
}
html.dark .selector-card.selected {
    border-color: var(--accent-soft);
    background: var(--accent-soft);
}

html.dark .badge-ordinario {
    background: #14263b;
    color: #93c5fd;
}
html.dark .badge-breve,
html.dark .badge-divorcio,
html.dark .badge-penal {
    background: #3a1818;
    color: #fca5a5;
}
html.dark .badge-separacion {
    background: #2a1c40;
    color: #c4b5fd;
}
html.dark .badge-amparo,
html.dark .badge-laboral {
    background: #3a2f15;
    color: #fcd34d;
}
html.dark .badge-contencioso,
html.dark .badge-nna {
    background: #1f1f3a;
    color: #a5b4fc;
}
html.dark .badge-especial,
html.dark .badge-recurso {
    background: #14301f;
    color: #86efac;
}
html.dark .badge-civil {
    background: #14263b;
    color: #93c5fd;
}
html.dark .admin-badge {
    background: var(--brand-2);
    color: var(--brand);
}
html.dark .section-header {
    color: var(--ink-4);
}

html.dark .spinner {
    border-color: var(--line);
    border-top-color: var(--accent-soft);
}

html.dark .toggle-switch {
    background: var(--surface-3);
}
html.dark .toggle-switch.active {
    background: #10b981;
}
html.dark .toggle-switch::after {
    background: #e5e7eb;
}

html.dark .empty-state {
    color: var(--ink-3);
}

html.dark .auth-logo h2 {
    color: var(--brand);
}
html.dark .auth-logo p {
    color: var(--ink-2);
}
html.dark .auth-card {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
html.dark .auth-link {
    color: var(--brand);
}

/* 🔴 En noche, `--brand` y `--brand-2` son los DOS oro (#E8C24E y #f2d273):
 * poner uno sobre el otro daba un contraste de 1,16:1 — las iniciales
 * desaparecían dentro del círculo. Se vio en un iPhone con la build 7.
 * `--on-brand` existe justamente para esto: es el color legible SOBRE la
 * marca, y en noche vale Noche (#141634) → 11,93:1. */
html.dark .user-menu-btn {
    background: var(--brand-2);
    color: var(--on-brand);
    border-color: rgba(244, 201, 169, 0.25);
}
html.dark .user-dropdown {
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
html.dark .user-dropdown-item {
    color: var(--ink);
}
html.dark .user-dropdown-item:hover {
    background: var(--surface-3);
}
html.dark .user-dropdown-item.danger {
    color: #f87171;
}
html.dark .user-dropdown-divider {
    background: var(--surface-3);
}

html.dark .notif-dropdown {
    background: var(--surface);
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
html.dark .notif-dropdown-header {
    border-bottom-color: var(--line);
}
html.dark .notif-item {
    border-bottom-color: var(--line);
}
html.dark .notif-item:hover {
    background: var(--surface-3);
}
html.dark .notif-item-unread {
    background: var(--accent-soft);
}
html.dark .notif-item-unread:hover {
    background: var(--surface-3);
}
html.dark .notif-icon-proximo {
    background: #3a2f15;
    color: #fcd34d;
}
html.dark .notif-icon-vencido {
    background: #3a1818;
    color: #fca5a5;
}
html.dark .notif-item-msg {
    color: var(--ink);
}
html.dark .notif-item-meta,
html.dark .notif-empty {
    color: var(--ink-3);
}

html.dark .tribunal-group-header:hover {
    background: var(--surface-2);
}
html.dark .tribunal-group-header[data-group] {
    border-color: var(--line);
}
html.dark .tribunal-group-header[data-group]:hover {
    background: var(--accent-soft);
}

html.dark .ficha-card {
    border-left-color: var(--accent-soft);
}

html.dark .cal-hito-day {
    background: var(--surface-2);
}
html.dark .cal-hito-day:hover {
    background: var(--surface-3);
}
html.dark .cal-today {
    border-color: var(--accent-soft);
}
html.dark .cal-hito-day.con-hitos {
    background: #14263b;
    color: #93c5fd;
}
html.dark .cal-hito-day.hito-proximo {
    background: #3a2f15;
    color: #fcd34d;
}
html.dark .cal-hito-day.hito-vencido {
    background: #3a1818;
    color: #fca5a5;
}
html.dark .cal-hito-day.sin-hitos {
    background: var(--surface-2);
    color: var(--ink-3);
}
html.dark .cal-hito-day.cal-has-revision {
    background: #2a1c40;
    color: #c4b5fd;
}
html.dark .cal-hito-count {
    color: var(--ink-3);
}

html.dark .cal-popup {
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(0,0,0,0.7);
}
html.dark .cal-popup-header {
    border-bottom-color: var(--line);
}
html.dark .cal-popup-close {
    color: var(--ink-3);
}
html.dark .cal-popup-close:hover {
    color: var(--ink);
}
html.dark .cal-popup-hito {
    border-bottom-color: var(--line);
}

html.dark .requisito-card:hover {
    background: var(--accent-soft);
}

html.dark .spam-alert {
    background: #14263b;
    border-color: #1e3a5f;
}
html.dark .spam-alert-text {
    color: #93c5fd;
}
html.dark .spam-alert-icon {
    color: #60a5fa;
}
html.dark .spam-alert-close {
    color: #60a5fa;
}
html.dark .spam-alert-close:hover {
    color: #93c5fd;
}

html.dark .gcal-connect-btn {
    background: var(--surface);
    color: #60a5fa;
    border-color: #1e3a5f;
}
html.dark .gcal-connect-btn:hover {
    background: #14263b;
}

html.dark .exp-tab.active {
    border-color: var(--accent-soft);
    color: var(--brand);
    background: var(--accent-soft);
}
html.dark .prose-legal {
    color: var(--ink-2);
}
html.dark .prose-legal hr {
    border-top-color: var(--line);
}

html.dark .exp-preview-thumb {
    border-color: var(--line);
    background: var(--surface-2);
}
html.dark .exp-drop-zone {
    border-color: var(--line);
    color: var(--ink-3);
}
html.dark .exp-drop-zone.dragover {
    border-color: var(--accent-soft);
    background: var(--accent-soft);
    color: var(--brand);
}

html.dark .exp-progress-bar {
    background: var(--surface-3);
}
html.dark .exp-progress-fill {
    background: var(--accent-soft);
}
html.dark .exp-progress-fill.animating {
    background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent-2) 50%, var(--accent-soft) 100%);
    background-size: 200% 100%;
}

html.dark .badge-en-cola {
    background: #3a2f15;
    color: #fcd34d;
}
html.dark .badge-procesando {
    background: #14263b;
    color: #93c5fd;
}
html.dark .badge-analizando {
    background: #2a1c40;
    color: #c4b5fd;
}
html.dark .badge-completado {
    background: #14301f;
    color: #86efac;
}
html.dark .badge-error {
    background: #3a1818;
    color: #fca5a5;
}
html.dark .exp-pdf-icon {
    background: #3a1818;
    color: #f87171;
}

html.dark .timeline-dot.completado {
    background: #10b981;
    border-color: #10b981;
}
html.dark .timeline-dot.en-curso {
    background: #f59e0b;
    border-color: #f59e0b;
}
html.dark .timeline-dot.vencido {
    background: #ef4444;
    border-color: #ef4444;
}

/* Header keeps its primary-900 brand background in dark mode (it's
 * already a near-black maroon at var(--brand)), but make sure the
 * back-button hover stays visible. */
html.dark header.bg-primary-900 {
    background-color: #2a0a10;
}
html.dark .hover\:bg-primary-800:hover {
    background-color: var(--brand-2) !important;
}

/* Native form controls: text inputs / selects / textareas should adapt
 * even when they don't carry .form-input. Tailwind's reset already adds
 * `color: inherit` so most pick up the body color, but the OS-painted
 * background of <select>/<input> doesn't. Tell the UA which scheme to
 * use so OS-rendered widgets (date pickers, scrollbars) follow. */
html.dark {
    color-scheme: dark;
}
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.form-input),
html.dark select:not(.form-input),
html.dark textarea:not(.form-input) {
    background-color: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}

/* Toast container backgrounds (toast is built ad-hoc by helpers.js
 * with bg-white / bg-red-50 etc — those are caught by @layer base
 * overrides above; nothing extra needed here). */


/* ════════════════════════════════════════════════════════════════════════════
 * MINI DASHBOARD — «Mi Despacho» y superficies nuevas (2026-08-27)
 *
 * El tab tenía cuatro píldoras arriba (Clientes · Honorarios · Gastos ·
 * Resumen) que se comían el ancho en un teléfono, obligaban a truncar los
 * rótulos y escondían el dato importante detrás de un toque. Se sustituyen
 * por un panel: el número que importa arriba, y debajo las tres puertas.
 *
 * Todo el color sale de los tokens de src/tailwind.css. No hay un solo hex
 * en esta sección — es la regla nueva del proyecto.
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Panel de cabecera ─────────────────────────────────────────────────────
 * Degradado de marca con un halo dorado arriba a la derecha. El halo es un
 * radial-gradient y no una imagen: pesa cero y escala a cualquier ancho. */
.hero-panel {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-xl);
    padding: 1.25rem 1.25rem 1.15rem;
    color: var(--on-brand);
    background-color: var(--brand);
    background-image:
        radial-gradient(120% 100% at 88% -25%, rgba(232, 194, 78, .34) 0%, rgba(198, 161, 91, 0) 58%),
        linear-gradient(155deg, var(--brand-2) 0%, var(--brand) 55%, #0d0f26 100%);
    box-shadow: var(--sh-3);
}
html.dark .hero-panel {
    background-image:
        radial-gradient(120% 100% at 88% -25%, rgba(232, 194, 78, .22) 0%, rgba(232, 194, 78, 0) 58%),
        linear-gradient(155deg, #262a5c 0%, #171a3a 60%, #0e1029 100%);
    color: var(--ink);
    border: 1px solid var(--line);
}

/* Filo superior dorado: es lo que hace que el panel se lea como una pieza
 * de la marca y no como un rectángulo oscuro cualquiera. */
.hero-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%, var(--accent) 22%, var(--accent) 78%, transparent 100%);
    opacity: .85;
}

.hero-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: .55rem;
}
.hero-metric {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.028em;
    font-variant-numeric: tabular-nums;
}
.hero-sub {
    font-size: .8125rem;
    opacity: .78;
    margin-top: .15rem;
    font-variant-numeric: tabular-nums;
}
.hero-divider {
    height: 1px;
    background: rgba(253, 248, 243, .16);
    margin: .95rem 0 .8rem;
}
html.dark .hero-divider { background: var(--line); }

.hero-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}
/* Tres columnas para la tarjeta de cifras del corpus. En pantalla estrecha
   caen a dos y la tercera ocupa la fila entera: con tres columnas de 320 px
   el «4.827.894» parte en dos líneas y deja de leerse de un vistazo. */
.hero-grid--tres {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 400px) {
    .hero-grid--tres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-grid--tres > :last-child { grid-column: 1 / -1; }
}
/* La tarjeta de cifras es la segunda del panel: se separa de novedades y se
   distingue con un tono más apagado, porque novedades es lo que cambia cada
   semana y esto es el telón de fondo. */
/* El botón «Analizar con IA» de las cuatro fichas. Discreto pero presente:
   es una acción que cuesta dinero y consume cuota, no un enlace más. */
.btn-ia {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    width: 100%;
    justify-content: center;
    padding: .6rem .9rem;
    border: 1px solid var(--accent, #b8860b);
    border-radius: var(--r-lg, .625rem);
    background: transparent;
    color: var(--accent, #b8860b);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.btn-ia:hover, .btn-ia:focus-visible {
    background: var(--accent, #b8860b);
    color: #fff;
}

/* El cuerpo Markdown de una respuesta del modelo. Sin esto, los encabezados y
   las listas salen con los márgenes por defecto del navegador —enormes— y el
   texto se lee peor que en crudo. */
.md-cuerpo { font-size: .875rem; line-height: 1.55; color: var(--text, #374151); }
.md-cuerpo p { margin: 0 0 .7rem; text-wrap: pretty; }
.md-cuerpo p:last-child { margin-bottom: 0; }
.md-cuerpo .md-h {
    margin: 1.1rem 0 .45rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-fuerte, #1f2937);
}
.md-cuerpo > .md-h:first-child { margin-top: 0; }
.md-cuerpo h3.md-h { font-size: 1rem; }
.md-cuerpo h4.md-h { font-size: .9375rem; }
.md-cuerpo h5.md-h, .md-cuerpo h6.md-h { font-size: .875rem; }
.md-cuerpo ul, .md-cuerpo ol { margin: 0 0 .7rem; padding-left: 1.15rem; }
.md-cuerpo li { margin-bottom: .3rem; text-wrap: pretty; }
.md-cuerpo li:last-child { margin-bottom: 0; }
.md-cuerpo strong { font-weight: 650; color: var(--text-fuerte, #1f2937); }
.md-cuerpo .md-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .8125em;
    padding: .1em .35em;
    border-radius: .25rem;
    background: var(--gris-suave, #f3f4f6);
}

/* Los turnos del chat anclado. El del usuario va alineado a la derecha y
   estrecho; el del modelo ocupa el ancho, porque es lo que se lee. */
.ia-turno { text-wrap: pretty; }
.ia-turno--usuario {
    margin-left: auto;
    max-width: 85%;
    padding: .55rem .8rem;
    border-radius: var(--r-lg, .625rem);
    background: var(--accent-suave, #f5efe0);
    color: var(--text, #1f2937);
}
.ia-turno--cargando { opacity: .85; }

/* «Corpus actualizado el X»: cuándo entró algo por última vez, que es lo único
   que se mueve siempre que corre el semanal — traiga lo que traiga y del linaje
   que sea. Va discreto: es la respuesta a «¿esto está vivo?», no un titular. */
.hero-actualizado {
    margin-top: .6rem;
    padding-top: .5rem;
    border-top: 1px solid rgb(255 255 255 / .12);
    font-size: .6875rem;
    letter-spacing: .01em;
    opacity: .72;
}

/* El resumen de la decisión dentro del pop-up de novedades. Tres líneas y
   corta: la tarjeta es para decidir si abrir, no para leer la sentencia. */
.fila-decision__resumen {
    margin-top: .5rem;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--text-muted, #6b7280);
    text-wrap: pretty;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-panel--cifras {
    margin-top: .75rem;
    opacity: .96;
}
.hero-cell-label {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .68;
    margin-bottom: .1rem;
}
.hero-cell-value {
    font-size: 1.0625rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.012em;
}

/* ── Baldosas de navegación ────────────────────────────────────────────── */
.tile {
    display: flex;
    align-items: center;
    gap: .9rem;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    padding: .95rem 1rem;
    cursor: pointer;
    box-shadow: var(--sh-1);
    transition: transform var(--dur-fast) var(--ease-out),
                box-shadow var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .tile:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: var(--sh-2);
        border-color: var(--line-strong);
    }
    .tile:hover:not(:disabled) .tile-chevron { transform: translateX(3px); }
}
.tile:active:not(:disabled) { transform: scale(.985); }
.tile:disabled { cursor: default; opacity: .72; }

.tile-icon {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: var(--r-md);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent-ink);
}
.tile-icon svg { width: 1.375rem; height: 1.375rem; }

/* Variantes: cada puerta tiene su temperatura para distinguirse de un
 * vistazo, sin salir de la familia cálida de la marca. */
.tile-icon.is-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}
.tile-icon.is-muted {
    background: var(--surface-3);
    border-color: var(--line);
    color: var(--ink-3);
}

/* Los hijos son <span> porque la baldosa entera es un <button> y un <div>
 * dentro de un botón es HTML inválido. Al ser inline por defecto, el título
 * y la descripción se apilaban en la misma línea: hay que declararlos
 * bloque a mano. */
.tile-body { flex: 1; min-width: 0; display: block; }
.tile-title {
    display: block;
    font-size: .9375rem;
    font-weight: 650;
    color: var(--ink);
    letter-spacing: -.006em;
    line-height: 1.3;
}
.tile-desc {
    display: block;
    font-size: .8125rem;
    color: var(--ink-3);
    margin-top: .12rem;
    line-height: 1.35;
}
.tile-icon { align-self: flex-start; }
.tile-chevron {
    flex: none;
    color: var(--ink-4);
    transition: transform var(--dur) var(--ease-out);
}

/* ── Rótulo de sección ─────────────────────────────────────────────────── */
.section-label {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 1.5rem 0 .7rem;
}

/* ── Píldora de estado ─────────────────────────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .6875rem;
    font-weight: 650;
    padding: .18rem .5rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.chip-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.chip-ok     { background: var(--ok-soft);     color: var(--ok);         border-color: transparent; }
.chip-warn   { background: var(--warn-soft);   color: var(--warn);       border-color: transparent; }
.chip-danger { background: var(--danger-soft); color: var(--danger);     border-color: transparent; }
.chip-muted  { background: var(--surface-3);   color: var(--ink-3);      border-color: var(--line); }

/* ── Tarjeta de KPI ────────────────────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    padding: .85rem .95rem;
    box-shadow: var(--sh-1);
}
.stat-label {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-3);
    font-weight: 600;
}
.stat-value {
    font-size: 1.1875rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-top: .18rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.stat-value.is-ok     { color: var(--ok); }
.stat-value.is-danger { color: var(--danger); }
.stat-value.is-accent { color: var(--accent-ink); }
.stat-sub {
    font-size: .75rem;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

/* ── Entrada escalonada ────────────────────────────────────────────────────
 * Un panel que aparece de golpe se siente estático; escalonado se siente
 * armado. Sólo transform y opacity (compositor), y sólo al montar: no hay
 * nada que animar cuando el usuario ya está mirando la pantalla. */
.stagger > * {
    animation: rise-in var(--dur-slow) var(--ease-out) backwards;
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 45ms; }
.stagger > *:nth-child(3) { animation-delay: 90ms; }
.stagger > *:nth-child(4) { animation-delay: 135ms; }
.stagger > *:nth-child(5) { animation-delay: 180ms; }
.stagger > *:nth-child(6) { animation-delay: 225ms; }

@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .stagger > * { animation: none; }
}

/* ── Pantalla «en construcción» ────────────────────────────────────────── */
.soon-wrap {
    text-align: center;
    padding: 3.5rem 1.5rem;
}
.soon-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    display: grid;
    place-items: center;
    border-radius: 9999px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent-ink);
}
.soon-icon svg { width: 1.75rem; height: 1.75rem; }
.soon-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.018em;
    color: var(--ink);
}
.soon-text {
    font-size: .875rem;
    color: var(--ink-2);
    max-width: 26rem;
    margin: .5rem auto 0;
    line-height: 1.6;
}

/* ── Cromo de la app: cabecera y barra inferior ─────────────────────────────
 * Los dos eran superficies planas (`bg-primary-900`, `bg-white`). Ahora la
 * cabecera lleva el mismo degradado de marca que el panel del despacho, con
 * el filo dorado que los cose visualmente, y la barra inferior va traslúcida
 * con desenfoque donde el navegador lo soporte. */
.app-header {
    background-color: var(--brand);
    background-image: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 62%, #0e1029 100%);
    box-shadow: 0 1px 0 rgba(198, 161, 91, .55), var(--sh-2);
    padding-top: env(safe-area-inset-top, 0);
}
html.dark .app-header {
    background-image: linear-gradient(135deg, #1f2350 0%, #141634 62%, #0e1029 100%);
    box-shadow: 0 1px 0 rgba(232, 194, 78, .35), var(--sh-2);
}

.app-bottom-nav {
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -1px 12px rgba(20, 22, 52, .06);
}
@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
    .app-bottom-nav {
        background: color-mix(in srgb, var(--surface) 82%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(1.6);
        backdrop-filter: blur(14px) saturate(1.6);
    }
}
html.dark .app-bottom-nav {
    box-shadow: 0 -1px 12px rgba(0, 0, 0, .40);
}

/* Los contenidos del header van por encima del padding de área segura. */
.app-header > div { position: relative; }

/* ── Avisos flotantes ──────────────────────────────────────────────────────
 * Antes eran un rectángulo de color plano que entraba desde la derecha con
 * `transition: all`. Ahora llevan icono, superficie propia y un filo de
 * color que dice el tipo sin gritar; entran con la curva de salida. */
.toast {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: .75rem .9rem;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ink-3);
    box-shadow: var(--sh-3);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
    opacity: 0;
    transform: translateX(12px) scale(.97);
    transition: opacity var(--dur) var(--ease-out),
                transform var(--dur) var(--ease-out);
}
.toast.is-in {
    opacity: 1;
    transform: none;
}
.toast-icon { flex: none; width: 1.125rem; height: 1.125rem; margin-top: .05rem; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.toast-success { border-left-color: var(--ok); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error   { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info    { border-left-color: var(--accent-2); }
.toast-info .toast-icon { color: var(--accent-ink); }
/* Advertencia: algo se hizo A MEDIAS. Trece sitios del código la pedían y no
   existía, así que `toast(msg,'warning')` caía en el estilo de ÉXITO y el
   usuario veía una palomita verde encima de un aviso de que algo no se hizo
   (auditoría 28-08-2026). */
.toast-warning { border-left-color: var(--warn, #b45309); }
.toast-warning .toast-icon { color: var(--warn, #b45309); }

/* ── Logotipo de ERa ───────────────────────────────────────────────────────
 * Copiado de motor-tsj/public/styles.css para que las dos superficies del
 * producto no deriven. «ER» en marfil y la `a` en oro cursiva; sobre fondo
 * CLARO el marfil desaparece y el oro da 1,7:1, así que ahí «ER» se escribe
 * en Noche y la `a` en el bronce oscurecido del tema. La cabecera de esta
 * app es Noche en los dos temas, así que usa la variante de marca. */
.marca-logo {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}
.marca-logo__er { color: var(--marfil); }
.marca-logo__a  { color: var(--oro); font-style: italic; }
.marca-logo__producto {
    font-family: var(--sans, inherit);
    font-weight: 500;
    font-size: .82em;
    letter-spacing: .01em;
    opacity: .82;
}

/* Sobre superficie clara (no la cabecera): «ER» en tinta y la `a` en el
 * acento legible del tema. */
.marca-logo--claro .marca-logo__er { color: var(--ink); }
.marca-logo--claro .marca-logo__a  { color: var(--accent-2); }
html.dark .marca-logo--claro .marca-logo__a { color: var(--oro); }

/* El filete de bronce bajo la cabecera es el gesto que cose la marca entre
 * esta app y la PWA de ERa. */
.app-header { border-bottom: 2px solid var(--bronce); }

/* Las píldoras muestran ETIQUETAS CORTAS. Cuando un campo del corpus resulta
 * ser texto libre en vez de una taxonomía —pasó con `sub_materia`, que es una
 * frase entera— la píldora se sale de la tarjeta y rompe el ancho. El tope y
 * el truncado hacen que el peor dato posible se vea feo, no roto. */
.chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Pop-up de detalle del buscador ────────────────────────────────────────
 * Hoja inferior en móvil (que es donde vive la app) y tarjeta centrada a
 * partir de tablet. `overscroll-behavior: contain` para que al llegar al
 * final del pop-up el gesto NO arrastre la página de detrás — el fallo
 * clásico de las hojas modales en un teléfono. */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(20, 22, 52, .55);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: modal-fondo var(--dur) var(--ease-out);
}
.modal-hoja {
    width: 100%;
    max-width: 34rem;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--sh-3);
    animation: modal-subir var(--dur-slow) var(--ease-out);
}
.modal-cabeza {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem 1.1rem .8rem;
    border-bottom: 1px solid var(--line-2);
    flex: none;
}
/* El filo dorado cose el pop-up con la cabecera de la app. */
.modal-cabeza::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -1rem;
    width: 2.25rem;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
}
.modal-cuerpo {
    padding: 1rem 1.1rem 1.6rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@keyframes modal-fondo { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-subir {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .modal-overlay, .modal-hoja { animation: none; }
}

@media (min-width: 640px) {
    .modal-overlay { align-items: center; padding: 1.5rem; }
    .modal-hoja {
        border-radius: var(--r-xl);
        border-bottom: 1px solid var(--line);
        max-height: 82vh;
    }
    .modal-cabeza::before { display: none; }
}

/* ── Controles segmentados ─────────────────────────────────────────────────
 * Los del Calendario iban en gris pizarra (#f1f5f9 / #64748b), heredado de
 * antes de la marca: en una app Noche + oro, un azul frío desentona. Se
 * pasan a la familia, con la píldora activa en superficie elevada y el
 * rótulo en el color de marca. */
.despacho-tabs,
.inline-flex[role="tablist"] {
    background: var(--surface-3);
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
}
.despacho-tab { color: var(--ink-3); }
.despacho-tab.active,
[role="tablist"] > .bg-white {
    background: var(--surface) !important;
    color: var(--brand-ink) !important;
    box-shadow: var(--sh-1);
}
/* Filo dorado bajo la píldora activa: el mismo gesto que la barra inferior. */
.despacho-tab.active { position: relative; }
.despacho-tab.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 26px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    transform: translateX(-50%);
}

/* Dentro de una fila de filtros que se desplaza en horizontal, las píldoras NO
 * deben encogerse: con `flex-shrink` por defecto el navegador las comprime
 * para que quepan todas y, con el truncado que llevan, salen cortadas
 * («Tod…», «Códi…»). El contenedor ya hace scroll; que lo use. */
.overflow-x-auto > .chip { flex-shrink: 0; }

/* ── Aviso de fuentes públicas ─────────────────────────────────────────────
 * Resumen fijo arriba del tab de Búsqueda. Va con el acento de marca y no
 * con un color de alarma: no advierte de un peligro, informa del origen de
 * los datos y del carácter de la herramienta. */
.aviso-fuentes {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-md);
    padding: .7rem .85rem;
    margin-bottom: .9rem;
}
.aviso-fuentes__icono {
    flex: none;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: .12rem;
    color: var(--accent-ink);
}
.aviso-fuentes p {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--ink-2);
    margin: 0;
}
.aviso-fuentes strong { color: var(--ink); }
.aviso-fuentes__mas {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    margin-left: .2rem;
    font: inherit;
    color: var(--accent-ink);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.aviso-fuentes__enlace {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--accent-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.aviso-fuentes__destacado {
    background: var(--surface-3);
    border-left: 3px solid var(--brand);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    padding: .8rem .9rem;
    margin: 0 0 1rem;
    color: var(--ink);
}

/* Pie del modal de aceptación: los dos botones siempre visibles, sin que el
 * usuario tenga que desplazarse hasta el final del texto para encontrarlos. */
.modal-pie {
    display: flex;
    gap: .6rem;
    padding: .85rem 1.1rem calc(.85rem + env(safe-area-inset-bottom, 0));
    border-top: 1px solid var(--line-2);
    background: var(--surface);
    flex: none;
}
.modal-pie .btn-primary,
.modal-pie .btn-secondary { padding: .7rem 1rem; font-size: .9rem; }

/* ── Rejilla de materias ───────────────────────────────────────────────────
 * Dos columnas en teléfono, tres a partir de tablet. El NÚMERO manda: es lo
 * que dice dónde hay contenido, y por eso va grande y en cifras de ancho
 * fijo, con el rótulo debajo. Al revés —rótulo grande, número pequeño— hay
 * que leer las 27 para saber cuál tiene algo. */
.materias {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}
@media (min-width: 560px) {
    .materias { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.materia {
    display: block;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    padding: .6rem .7rem;
    cursor: pointer;
    box-shadow: var(--sh-1);
    transition: transform var(--dur-fast) var(--ease-out),
                border-color var(--dur) var(--ease-out),
                box-shadow var(--dur) var(--ease-out),
                background-color var(--dur) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .materia:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
}
.materia:active { transform: scale(.98); }
.materia.is-on {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft), var(--sh-1);
}
.materia__n {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--brand-ink);
}
.materia.is-on .materia__n { color: var(--accent-ink); }
.materia__t {
    display: block;
    font-size: .72rem;
    line-height: 1.25;
    color: var(--ink-3);
    margin-top: .15rem;
}
.materia.is-on .materia__t { color: var(--ink-2); }

.materias__mas {
    display: block;
    width: 100%;
    margin-top: .55rem;
    padding: .5rem;
    background: none;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-sm);
    font-size: .78rem;
    font-weight: 600;
    color: var(--accent-ink);
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out);
}
.materias__mas:hover { background: var(--surface-2); }

/* ── «Ver el desglose» del panel de novedades ─────────────────────────────── */
.hero-vermas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    width: 100%;
    margin-top: .9rem;
    padding: .55rem;
    background: rgba(247, 243, 233, .10);
    border: 1px solid rgba(247, 243, 233, .18);
    border-radius: var(--r-sm);
    color: var(--marfil);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out);
}
.hero-vermas:hover { background: rgba(247, 243, 233, .18); }
html.dark .hero-vermas { color: var(--ink); }

/* Volver, dentro de un pop-up con dos niveles. */
.det-volver {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: none;
    border: none;
    padding: .2rem 0;
    font-size: .8rem;
    font-weight: 600;
    color: var(--accent-ink);
    cursor: pointer;
}

/* ── Resumen de una norma del ordenamiento ────────────────────────────────
 * Lo redactamos nosotros a partir del artículo del objeto; no es texto
 * oficial. Por eso se distingue del resto: sangrado con un filete de bronce
 * a la izquierda, como una cita, para que no se confunda con el articulado. */
.norma-resumen {
    margin-top: .5rem;
    padding-left: .625rem;
    border-left: 2px solid var(--bronce);
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--ink-2);
    /* Tres líneas: en una lista de resultados el resumen orienta, no se lee
     * entero. Sin el tope, una norma con 400 caracteres empuja a las demás
     * fuera de la pantalla y la lista deja de poder barrerse. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.norma-resumen-card {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
    border-color: color-mix(in srgb, var(--bronce) 35%, transparent);
}
.norma-resumen-card__t {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-bottom: .4rem;
}
.norma-resumen-card__p {
    font-size: .875rem;
    line-height: 1.6;
    color: var(--ink);
}
.norma-resumen-card__pie {
    margin-top: .6rem;
    padding-top: .5rem;
    border-top: 1px solid var(--line);
    font-size: .6875rem;
    line-height: 1.45;
    color: var(--ink-3);
}

/* ── Ficha de cliente ─────────────────────────────────────────────────────
 * La pantalla venía del diseño anterior: enlaces de texto subrayados como
 * acciones, títulos con `truncate` compitiendo por el ancho con seis botones,
 * y cabeceras de sección en negrita suelta. Aquí se le da el mismo lenguaje
 * que ya tienen Casos, Calendario y Búsqueda. */

.ficha-cli__nombre {
    font-family: var(--serif, inherit);
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.2;
    /* HEREDADO, no `--on-brand`: el panel de cabecera invierte su color en
     * modo oscuro (`html.dark .hero-panel` pasa a `--ink`), así que fijar el
     * token aquí pintaba el nombre casi del color del fondo. */
    color: inherit;
    /* `break-words` partía nombres largos por la mitad de una palabra.
     * `pretty` reparte las líneas sin dejar una sola palabra colgando. */
    text-wrap: pretty;
    overflow-wrap: anywhere;
    margin-top: .15rem;
}
.ficha-cli__contacto {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    font-size: .75rem;
    color: currentColor;
    opacity: .72;
}
.ficha-cli__contacto a { color: inherit; text-decoration: none; }
.ficha-cli__contacto a:hover { text-decoration: underline; }

/* Cabecera de sección: rótulo + su acción, alineados y con la acción como
 * botón de verdad, no como un enlace de 11 px imposible de acertar. */
.sec-cab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}
.sec-cab__t {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: .01em;
}
.sec-cab__acc {
    font-size: .75rem;
    font-weight: 600;
    color: var(--accent-ink);
    padding: .3rem .55rem;
    margin: -.3rem -.2rem -.3rem 0;
    border-radius: var(--r-sm, 8px);
    background: transparent;
    transition: background-color .15s var(--ease-out);
}
.sec-cab__acc:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
html.dark .sec-cab__acc { color: var(--oro); }

/* Fila de una operación (propuesta). Apilada: título, monto y acciones en
 * tres alturas. Antes iban en una sola y el título perdía siempre. */
.op-fila {
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}
.op-fila:last-child { border-bottom: 0; padding-bottom: 0; }
.op-fila__cab {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .3rem;
}
.op-fila__t {
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink);
    text-wrap: pretty;
    overflow-wrap: anywhere;
}
.op-fila__meta {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .55rem;
}
.op-fila__monto {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--ink);
    /* Sin salto: «USD 20.000,00» partido en dos líneas deja de leerse
     * como una cifra. */
    white-space: nowrap;
}
.op-fila__fecha { font-size: .6875rem; color: var(--ink-4); }
.op-fila__acc { display: flex; flex-wrap: wrap; gap: .375rem; }

/* Botón de acción: píldora con área táctil real. Los enlaces subrayados de
 * 11 px no llegaban ni de lejos a los 44 px de objetivo táctil. */
.op-btn {
    font-size: .75rem;
    font-weight: 500;
    padding: .35rem .625rem;
    min-height: 32px;
    border-radius: 999px;
    color: var(--ink-2);
    background: color-mix(in srgb, var(--ink) 5%, transparent);
    border: 1px solid transparent;
    transition: background-color .15s var(--ease-out), color .15s var(--ease-out);
}
.op-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.op-btn:disabled { opacity: .45; cursor: not-allowed; }
.op-btn--si {
    color: #0f6b45;
    background: color-mix(in srgb, #0f6b45 12%, transparent);
    font-weight: 600;
}
.op-btn--si:hover:not(:disabled) { background: color-mix(in srgb, #0f6b45 20%, transparent); }
.op-btn--no { color: var(--granate); background: color-mix(in srgb, var(--granate) 10%, transparent); }
.op-btn--no:hover:not(:disabled) { background: color-mix(in srgb, var(--granate) 18%, transparent); }
html.dark .op-btn--si { color: #6ee7b7; }
html.dark .op-btn--no { color: #fca5a5; }

/* Fila navegable (un caso vinculado). */
.op-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .5rem;
    margin: 0 -.5rem;
    border-radius: var(--r-md, 10px);
    cursor: pointer;
    transition: background-color .15s var(--ease-out);
}
.op-nav:hover, .op-nav:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.op-nav + .op-nav { border-top: 1px solid var(--line); }
.op-nav__t {
    font-size: .875rem; font-weight: 600; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.op-nav__d {
    font-size: .75rem; color: var(--ink-4);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Campo de monto con el símbolo dentro, para que no se lea como parte de la
 * cifra ni ocupe una etiqueta aparte. */
.form-monto { position: relative; }
.form-monto__sig {
    position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
    color: var(--ink-4); font-weight: 600; pointer-events: none;
}
.form-monto__in { padding-left: 1.75rem; }

/* ── Búsqueda: caja única, grupos y filtros (07-10-2026) ────────────────────
 * Rediseño por el feedback «la pestaña de búsqueda es complicada de usar»: la
 * portada abre con la tarjeta de Búsqueda, no con cifras; los resultados llegan agrupados por
 * tipo; y los filtros que la API ya aceptaba (sala, año, ponente…) salen como
 * píldoras. Todo con los tokens de la paleta, así que el modo oscuro sale solo. */
.busc-caja { margin-bottom: .6rem; }
.busc-caja__input {
    font-size: 1.0625rem;
    padding-top: .9rem;
    padding-bottom: .9rem;
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}
/* La tarjeta de Búsqueda (segunda vuelta, 07-10-2026): la caja va DENTRO de un
 * panel de marca, del mismo porte que Novedades y Cifras, para que se lea como
 * la primera de tres tarjetas y no como un campo suelto encima de ellas. */
.busc-tarjeta .busc-caja { margin-bottom: .55rem; }
.busc-tarjeta .busc-caja__input { box-shadow: var(--sh-2); }
.busc-tarjeta .hero-sub { text-wrap: pretty; }
#busc-corpus { margin-top: .75rem; }
#busc-corpus[hidden] { display: none; }

/* ── «Explorar»: carrusel de láminas (07-10-2026) ──────────────────────────
 * Cada lámina ES la tarjeta: ocupa el ancho entero y lleva su propio fondo, de
 * modo que deslizar cambia la tarjeta completa (la primera versión tenía
 * tarjetas dentro de la tarjeta y asomaba la siguiente; al operador no le
 * gustó). La cabecera —«Explorar», contador, flechas— y los puntos flotan
 * encima, y cambian de tinta con la lámina a la vista (`.explora--marca`).
 * Deslizar es `scroll-snap` del navegador; flechas y puntos sólo `scrollTo`. */
.explora {
    position: relative;
    margin-bottom: .75rem;
    border-radius: var(--r-xl);
    border: 1px solid var(--line);
    box-shadow: var(--sh-2);
    overflow: hidden;
    background: var(--surface);
    isolation: isolate;
}
.explora::before {   /* el mismo filo dorado que los paneles de marca */
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    z-index: 3;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 22%, var(--accent) 78%, transparent 100%);
    opacity: .85;
    pointer-events: none;
}

/* Lo que flota encima de las láminas. `pointer-events:none` en la capa y
 * `auto` en los botones: así el resto del área sigue siendo de la lámina (se
 * toca y se desliza a través de la cabecera). */
.explora__cabeza {
    position: absolute;
    inset: 0 0 auto 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0 1.25rem;
    pointer-events: none;
}
.explora__eyebrow {
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--accent-ink);
    transition: color var(--dur) var(--ease-out);
}
.explora__nav { display: flex; align-items: center; gap: .35rem; }
.explora__cuenta {
    font-size: .75rem;
    font-weight: 600;
    color: var(--ink-3);
    margin-right: .25rem;
    font-variant-numeric: tabular-nums;
    transition: color var(--dur) var(--ease-out);
}
.explora__flecha {
    pointer-events: auto;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out),
                border-color var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out);
}
.explora__flecha:hover:not(:disabled) { background: var(--surface-2); }
.explora__flecha:disabled { opacity: .35; cursor: default; }

.explora__pista {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    /* Que un deslizamiento lateral no se convierta en «atrás» del navegador. */
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.explora__pista::-webkit-scrollbar { display: none; }

.explora__lamina {
    position: relative;
    flex: 0 0 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
    min-height: 18rem;
    /* Arriba, el hueco de la cabecera; abajo, el de los puntos. */
    padding: 3.9rem 1.25rem 3rem;
    text-align: left;
    font: inherit;
    color: var(--ink);
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(85% 75% at 100% 0%, var(--accent-soft) 0%, transparent 72%),
        var(--surface);
    cursor: pointer;
    overflow: hidden;
}
/* La lámina de la IA, en el panel de marca (mismo degradado que `.hero-panel`). */
.explora__lamina--marca {
    color: var(--on-brand);
    background-color: var(--brand);
    background-image:
        radial-gradient(120% 100% at 88% -25%, rgba(232, 194, 78, .34) 0%, rgba(198, 161, 91, 0) 58%),
        linear-gradient(155deg, var(--brand-2) 0%, var(--brand) 55%, #0d0f26 100%);
}
html.dark .explora__lamina--marca {
    color: var(--ink);
    background-image:
        radial-gradient(120% 100% at 88% -25%, rgba(232, 194, 78, .22) 0%, rgba(232, 194, 78, 0) 58%),
        linear-gradient(155deg, #262a5c 0%, #171a3a 60%, #0e1029 100%);
}
.explora__lamina--marca .explora__t { color: inherit; }
.explora__lamina--marca .explora__d { color: inherit; opacity: .8; }
.explora__lamina--marca .explora__kicker,
.explora__lamina--marca .explora__cta { color: var(--oro); }
.explora__lamina--marca .explora__num { color: var(--oro); opacity: .22; }
.explora__lamina--marca .explora__icono { background: var(--oro); color: var(--noche); }

/* Con la lámina de marca a la vista, la cabecera y los puntos cambian de tinta. */
.explora--marca .explora__eyebrow { color: var(--oro); }
.explora--marca .explora__cuenta { color: rgba(247, 243, 233, .75); }
.explora--marca .explora__flecha {
    background: rgba(247, 243, 233, .08);
    border-color: rgba(247, 243, 233, .25);
    color: var(--marfil);
}
.explora--marca .explora__flecha:hover:not(:disabled) { background: rgba(247, 243, 233, .16); }
.explora--marca .explora__punto::before { background: rgba(247, 243, 233, .3); }
.explora--marca .explora__punto[aria-current]::before { background: var(--oro); }

/* El número de lámina, grande y en serif, como folio de revista: abajo a la
 * derecha, detrás del texto. */
.explora__num {
    position: absolute;
    right: 1rem;
    bottom: 1.6rem;
    font-family: var(--serif);
    font-size: 5.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.05em;
    color: var(--accent);
    opacity: .2;
    pointer-events: none;
    z-index: 0;
}
html.dark .explora__num { opacity: .1; }
.explora__icono, .explora__kicker, .explora__t, .explora__d, .explora__cta { position: relative; z-index: 1; }
.explora__icono {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    margin-bottom: .65rem;
    border-radius: .85rem;
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: var(--sh-1);
}
.explora__icono svg { width: 1.35rem; height: 1.35rem; }
.explora__kicker {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.explora__t {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.16;
    letter-spacing: -.01em;
    color: var(--ink);
    text-wrap: balance;
    max-width: 22rem;
}
.explora__d {
    margin-top: .25rem;
    font-size: .875rem;
    line-height: 1.45;
    color: var(--ink-2);
    text-wrap: pretty;
    max-width: 24rem;
}
.explora__cta {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-top: auto;
    padding-top: .9rem;
    font-size: .875rem;
    font-weight: 700;
    color: var(--accent-ink);
}
.explora__cta svg { transition: transform var(--dur) var(--ease-out); }
.explora__lamina:hover .explora__cta svg { transform: translateX(3px); }

.explora__puntos {
    position: absolute;
    inset: auto 0 .45rem 0;
    z-index: 2;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.explora__punto {
    /* El punto se ve de 7 px, pero se toca en 24: el `::before` es lo visible. */
    pointer-events: auto;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.explora__punto::before {
    content: '';
    width: .45rem;
    height: .45rem;
    border-radius: 9999px;
    background: var(--line);
    transition: width var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.explora__punto[aria-current]::before { width: 1.35rem; background: var(--accent); }
@media (prefers-reduced-motion: reduce) {
    .explora__punto::before, .explora__flecha, .explora__cta svg,
    .explora__eyebrow, .explora__cuenta { transition: none; }
}

.busc-nota {
    font-size: .75rem;
    line-height: 1.45;
    color: var(--ink-3);
    margin: .1rem .1rem .5rem;
    text-wrap: pretty;
}
.busc-nota strong { color: var(--ink-2); }

.busc-grupo { margin-top: 1.1rem; }
.busc-grupo__cabeza {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .55rem;
}
.busc-grupo__t {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0;
}
.busc-vertodos {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: var(--accent-ink);
    background: none;
    border: none;
    padding: .25rem 0 .25rem .5rem;
    cursor: pointer;
    flex: none;
}

/* Filtros: `<select>` nativo vestido de píldora. Envuelven en varias líneas en
 * vez de hacer scroll lateral: una fila que se desliza esconde justo los
 * filtros que el usuario no sabe que existen. */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .6rem;
}
.filtros:empty { display: none; }
.filtro { position: relative; display: inline-flex; max-width: 100%; }
.filtro select,
.filtro-toggle {
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 9999px;
    padding: .42rem 1.75rem .42rem .8rem;
    max-width: 13rem;
    min-height: 2.1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.filtro-toggle { padding-right: .8rem; }
/* El triángulo del desplegable, dibujado: con `appearance: none` el del
 * sistema desaparece y la píldora dejaría de parecer algo que se abre. */
.filtro::after {
    content: '';
    position: absolute;
    right: .75rem;
    top: 50%;
    width: .38rem;
    height: .38rem;
    border-right: 1.5px solid var(--ink-3);
    border-bottom: 1.5px solid var(--ink-3);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
/* `.filtros` delante: en oscuro, `html.dark select:not(.form-input)` pinta el
 * fondo de todo select y, con menos especificidad, el filtro activo salía igual
 * que los apagados. */
.filtros .filtro.is-on select,
.filtros .filtro-toggle.is-on {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.filtro.is-on::after { border-color: var(--accent-ink); }
.filtro select:focus-visible,
.filtro-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* En el teléfono, 16 px: por debajo, Safari de iOS amplía la página entera al
 * tocar el desplegable y no la devuelve a su sitio. */
@media (pointer: coarse) {
    .filtro select, .filtro-toggle {
        font-size: 16px;
        padding: .3rem 1.6rem .3rem .75rem;
        min-height: 2.25rem;
        max-width: calc(50vw - 1.5rem);
    }
    .filtro-toggle { padding-right: .75rem; }
}
.filtros__limpiar {
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: var(--accent-ink);
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: .4rem .3rem;
    cursor: pointer;
}
