/* ============================================================================
 * ARCHIVO:        assets/css/base.css
 * DESCRIPCIÓN:    Variables, reset, tipografía, botones, modales, toasts, popovers.
 * VERSIÓN:        1.9.0  (Fase 8.2)
 * CREADO:         2026-05-23
 * ACTUALIZADO:    2026-05-31 (estilos del botón de modo lectura/edición)
 * PROYECTO:       Mi Archivador
 * ============================================================================ */

:root {
    /* —— Paleta cuaderno claro —— */
    --fondo:           #fafaf7;
    --fondo-suave:     #f3f3ee;
    --fondo-hover:     #ebebe4;
    --tarjeta:         #ffffff;
    --tarjeta-borde:   #e8e5dd;
    --tarjeta-borde-fuerte: #d6d2c6;

    --tinta:           #1f1d18;       /* texto principal */
    --tinta-suave:     #5a564c;       /* texto secundario */
    --tinta-tenue:     #8a8678;       /* texto terciario */
    --tinta-fantasma:  #b8b3a4;       /* texto deshabilitado */

    --acento:          #4f46e5;       /* índigo suave */
    --acento-hover:    #4338ca;
    --acento-suave:    #eef2ff;
    --acento-borde:    #c7d2fe;

    --exito:           #059669;
    --aviso:           #d97706;
    --peligro:         #dc2626;
    --peligro-suave:   #fef2f2;
    --peligro-borde:   #fecaca;

    --selec:           rgba(79, 70, 229, 0.10);
    --selec-borde:     rgba(79, 70, 229, 0.35);

    /* —— Sombras —— */
    --sombra-xs:   0 1px 2px rgba(60, 50, 30, 0.04);
    --sombra-sm:   0 2px 6px rgba(60, 50, 30, 0.06), 0 1px 2px rgba(60, 50, 30, 0.04);
    --sombra-md:   0 6px 18px rgba(60, 50, 30, 0.08), 0 2px 4px rgba(60, 50, 30, 0.05);
    --sombra-lg:   0 16px 40px rgba(60, 50, 30, 0.14), 0 4px 12px rgba(60, 50, 30, 0.08);
    --sombra-xl:   0 32px 70px rgba(60, 50, 30, 0.20);

    /* —— Tipografía —— */
    --fuente-display: 'Fraunces', 'Georgia', 'Times New Roman', serif;
    --fuente-ui:      'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --fuente-mono:    ui-monospace, 'SF Mono', 'Cascadia Mono', 'Consolas', monospace;

    /* —— Espaciado —— */
    --r-xs:   4px;
    --r-sm:   6px;
    --r-md:   10px;
    --r-lg:   14px;
    --r-xl:   20px;
    --r-2xl:  28px;

    /* —— Layout —— */
    --barra-h:        56px;
    --arbol-w:        288px;
    --arbol-w-min:    220px;
    --arbol-w-max:    480px;

    /* —— Transiciones —— */
    --t-rapida: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-media:  200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-lenta:  320ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ RESET ============ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: var(--fondo);
    color: var(--tinta);
}

body {
    font-family: var(--fuente-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;     /* la app gestiona su propio scroll */
}

button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

a {
    color: var(--acento);
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--fuente-display);
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--tinta);
}

::selection {
    background: var(--selec);
}

/* Scrollbars sutiles */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--tarjeta-borde-fuerte);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--tinta-fantasma);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Atributo "hidden" se respeta siempre */
[hidden] {
    display: none !important;
}

/* ============ BOTONES ============ */
.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--r-md);
    font-weight: 500;
    transition: background var(--t-rapida), color var(--t-rapida), box-shadow var(--t-rapida), transform var(--t-rapida);
    white-space: nowrap;
    user-select: none;
}
.boton:active { transform: translateY(1px); }

.boton-principal {
    background: var(--tinta);
    color: var(--fondo);
    box-shadow: var(--sombra-sm);
}
.boton-principal:hover {
    background: #2d2a23;
    box-shadow: var(--sombra-md);
}

.boton-acento {
    background: var(--acento);
    color: white;
}
.boton-acento:hover {
    background: var(--acento-hover);
}

.boton-suave {
    background: var(--fondo-suave);
    color: var(--tinta);
}
.boton-suave:hover {
    background: var(--fondo-hover);
}

.boton-peligro {
    background: var(--peligro);
    color: white;
}
.boton-peligro:hover {
    background: #b91c1c;
}

.boton-grande {
    padding: 12px 22px;
    font-size: 15px;
    border-radius: var(--r-lg);
}

.boton-pequeno {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--r-sm);
}

.boton-icono {
    font-size: 16px;
    font-weight: 700;
    margin-right: -2px;
    line-height: 1;
}

.boton[disabled],
.boton[aria-busy="true"] {
    opacity: 0.6;
    cursor: not-allowed;
}

.boton-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Iconos cuadrados */
.icono-boton {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    color: var(--tinta-suave);
    transition: background var(--t-rapida), color var(--t-rapida);
}
.icono-boton:hover {
    background: var(--fondo-hover);
    color: var(--tinta);
}

.icono-boton-pequeno {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-sm);
    color: var(--tinta-suave);
    transition: background var(--t-rapida), color var(--t-rapida);
}
.icono-boton-pequeno:hover {
    background: var(--fondo-hover);
    color: var(--tinta);
}

/* Grupo de iconos tipo toggle */
.icono-boton-grupo {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tinta-suave);
    transition: background var(--t-rapida), color var(--t-rapida);
    border-radius: 0;
}
.icono-boton-grupo.activo {
    background: var(--tinta);
    color: var(--fondo);
}
.icono-boton-grupo:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.icono-boton-grupo:last-child  { border-radius: 0 var(--r-md) var(--r-md) 0; }
.icono-boton-grupo:not(.activo):hover {
    background: var(--fondo-hover);
}

/* Enlace tipo botón */
.enlace-boton {
    color: var(--acento);
    background: none;
    padding: 0;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color var(--t-rapida);
}
.enlace-boton:hover { color: var(--acento-hover); }

/* ============ CAMPOS ============ */
.campo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.campo-etiqueta {
    font-size: 13px;
    font-weight: 500;
    color: var(--tinta-suave);
}
.campo-etiqueta small {
    font-weight: 400;
    color: var(--tinta-tenue);
}
.campo input,
.campo textarea,
.campo select {
    background: white;
    border: 1px solid var(--tarjeta-borde);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color var(--t-rapida), box-shadow var(--t-rapida);
    width: 100%;
}
.campo input:focus,
.campo textarea:focus,
.campo select:focus {
    outline: none;
    border-color: var(--acento);
    box-shadow: 0 0 0 3px var(--acento-suave);
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalAparecer var(--t-media);
}
.modal-fondo {
    position: absolute;
    inset: 0;
    background: rgba(20, 18, 12, 0.30);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-tarjeta {
    position: relative;
    background: var(--tarjeta);
    border-radius: var(--r-xl);
    box-shadow: var(--sombra-xl);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalEntrar var(--t-media);
}
.modal-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 12px;
}
.modal-titulo {
    font-size: 20px;
    font-weight: 600;
}
.modal-cuerpo {
    padding: 0 24px 8px;
    overflow-y: auto;
    flex: 1;
}
.modal-pie {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--tarjeta-borde);
    margin-top: 12px;
}

@keyframes modalAparecer {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalEntrar {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============ MENÚ CONTEXTUAL ============ */
.menu-contextual {
    position: fixed;
    z-index: 300;
    background: var(--tarjeta);
    border: 1px solid var(--tarjeta-borde);
    border-radius: var(--r-md);
    box-shadow: var(--sombra-lg);
    padding: 4px;
    min-width: 200px;
    animation: menuAparecer 100ms ease-out;
}
@keyframes menuAparecer {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background var(--t-rapida);
    color: var(--tinta);
}
.menu-item:hover {
    background: var(--fondo-hover);
}
.menu-item.peligro {
    color: var(--peligro);
}
.menu-item.peligro:hover {
    background: var(--peligro-suave);
}
.menu-item-icono {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}
.menu-separador {
    height: 1px;
    background: var(--tarjeta-borde);
    margin: 4px 2px;
}

/* ============ POPOVER COLOR ============ */
.popover-color {
    position: fixed;
    z-index: 300;
    background: var(--tarjeta);
    border: 1px solid var(--tarjeta-borde);
    border-radius: var(--r-lg);
    box-shadow: var(--sombra-lg);
    padding: 14px;
    width: 280px;
    animation: menuAparecer 120ms ease-out;
}
.popover-color-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--fondo-suave);
    padding: 3px;
    border-radius: var(--r-md);
}
.popover-color-tab {
    flex: 1;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--tinta-suave);
    transition: background var(--t-rapida), color var(--t-rapida);
}
.popover-color-tab.activo {
    background: var(--tarjeta);
    color: var(--tinta);
    box-shadow: var(--sombra-xs);
}
.popover-color-paleta {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.popover-color-muestra {
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--t-rapida), border-color var(--t-rapida);
    position: relative;
}
.popover-color-muestra:hover {
    transform: scale(1.10);
}
.popover-color-muestra.seleccionado {
    border-color: var(--tinta);
}
.popover-color-muestra.seleccionado::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 2px solid white;
}
.popover-color-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--tarjeta-borde);
}
.popover-color-libre {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--tinta-suave);
    cursor: pointer;
}
.popover-color-libre input[type="color"] {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--tarjeta-borde);
    border-radius: var(--r-sm);
    cursor: pointer;
    background: white;
}

/* ============ TOASTS ============ */
.toasts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: var(--tinta);
    color: var(--fondo);
    padding: 12px 18px;
    border-radius: var(--r-md);
    box-shadow: var(--sombra-lg);
    font-size: 13px;
    min-width: 220px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastEntrar 200ms ease-out;
}
.toast.error {
    background: var(--peligro);
    color: white;
}
.toast.exito {
    background: var(--exito);
    color: white;
}
@keyframes toastEntrar {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.toast.saliendo {
    animation: toastSalir 200ms ease-in forwards;
}
@keyframes toastSalir {
    to { transform: translateX(100%); opacity: 0; }
}

/* ============ UTILIDADES ============ */
.solo-lector { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============================================================================
 * DRAG & DROP (Fase 4)
 * ============================================================================ */

.arrastrando-origen {
    opacity: 0.45;
}

/* Drop dentro: resaltar borde y fondo */
.drop-dentro {
    background: var(--acento-suave) !important;
    box-shadow: inset 0 0 0 2px var(--acento) !important;
    border-radius: var(--r-sm);
}

/* Drop antes / después en árbol y lista (eje vertical): línea horizontal */
.arbol-fila.drop-antes,
.lista-item.drop-antes {
    background: transparent !important;
    box-shadow: 0 -2px 0 var(--acento) !important;
}
.arbol-fila.drop-despues,
.lista-item.drop-despues {
    background: transparent !important;
    box-shadow: 0 2px 0 var(--acento) !important;
}

/* Drop antes / después en tarjetas (eje horizontal): línea vertical */
.tarjeta.drop-antes {
    background: var(--tarjeta) !important;
    box-shadow: -3px 0 0 var(--acento), var(--sombra-sm) !important;
}
.tarjeta.drop-despues {
    background: var(--tarjeta) !important;
    box-shadow: 3px 0 0 var(--acento), var(--sombra-sm) !important;
}
.tarjeta.drop-dentro {
    box-shadow: 0 0 0 2px var(--acento), var(--sombra-md) !important;
    background: var(--acento-suave) !important;
}

/* Cursor durante el drag */
.arbol-fila[draggable="true"] {
    cursor: grab;
}
.arbol-fila[draggable="true"]:active {
    cursor: grabbing;
}
.tarjeta[draggable="true"],
.lista-item[draggable="true"] {
    cursor: grab;
}
.tarjeta[draggable="true"]:active,
.lista-item[draggable="true"]:active {
    cursor: grabbing;
}

/* ============================================================================
 * BUSCADOR GLOBAL (Fase 5)
 * ============================================================================ */
.buscador-global {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--fondo-suave);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    padding: 4px 8px 4px 10px;
    transition: border-color var(--t-rapida), background var(--t-rapida);
    width: 240px;
    height: 36px;
}
.buscador-global:focus-within {
    background: white;
    border-color: var(--acento);
    box-shadow: 0 0 0 3px var(--acento-suave);
}
.buscador-icono {
    color: var(--tinta-tenue);
    flex-shrink: 0;
}
#buscadorInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 13px;
    color: var(--tinta);
    min-width: 0;
}
#buscadorInput::placeholder { color: var(--tinta-tenue); }
.buscador-atajo {
    background: var(--tarjeta-borde);
    color: var(--tinta-tenue);
    font-family: var(--fuente-ui);
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.buscador-global:focus-within .buscador-atajo { display: none; }
.buscador-limpiar {
    color: var(--tinta-tenue);
    width: 22px; height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background var(--t-rapida);
}
.buscador-limpiar:hover {
    background: var(--fondo-hover);
    color: var(--tinta);
}

@media (max-width: 768px) {
    .buscador-global { width: 160px; }
    .buscador-atajo { display: none; }
}

/* ---------- PANEL DE RESULTADOS ---------- */
.buscador-resultados {
    position: fixed;
    background: var(--tarjeta);
    border: 1px solid var(--tarjeta-borde);
    border-radius: var(--r-lg);
    box-shadow: var(--sombra-xl);
    z-index: 300;
    max-height: 70vh;
    overflow-y: auto;
    animation: menuAparecer 120ms ease-out;
}
.buscador-grupo {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tinta-tenue);
    padding: 12px 14px 6px;
    background: var(--fondo-suave);
    border-bottom: 1px solid var(--tarjeta-borde);
    position: sticky;
    top: 0;
    z-index: 1;
}
.buscador-grupo:first-child {
    border-top: none;
}
.buscador-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--tarjeta-borde);
    transition: background var(--t-rapida);
}
.buscador-item:last-child { border-bottom: none; }
.buscador-item:hover,
.buscador-item.activo {
    background: var(--acento-suave);
}
.buscador-item-icono {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fondo-suave);
    border-radius: var(--r-sm);
    font-size: 15px;
    flex-shrink: 0;
}
.buscador-item.activo .buscador-item-icono {
    background: var(--tarjeta);
}
.buscador-item-cuerpo {
    flex: 1;
    min-width: 0;
}
.buscador-item-titulo {
    font-size: 14px;
    font-weight: 500;
    color: var(--tinta);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.buscador-item-ruta {
    font-size: 11px;
    color: var(--tinta-tenue);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.buscador-item-fragmento {
    font-size: 12px;
    color: var(--tinta-suave);
    margin-top: 4px;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.buscador-item mark,
.buscador-item-fragmento mark {
    background: rgba(245, 158, 11, 0.25);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.buscador-mensaje {
    padding: 24px;
    text-align: center;
    color: var(--tinta-tenue);
    font-size: 13px;
}
.buscador-mensaje.error {
    color: var(--peligro);
}
.buscador-pie {
    padding: 8px 14px;
    text-align: right;
    font-size: 11px;
    color: var(--tinta-tenue);
    background: var(--fondo-suave);
    border-top: 1px solid var(--tarjeta-borde);
}

/* ============================================================================
 * MODO OSCURO (Fase 8) — se activa con [data-tema="oscuro"] en <html>
 * ============================================================================ */
html[data-tema="oscuro"] {
    --fondo:           #15171c;
    --fondo-suave:     #1c1f26;
    --fondo-hover:     #252932;
    --tarjeta:         #1f232b;
    --tarjeta-borde:   #2e333d;
    --tarjeta-borde-fuerte: #404754;

    --tinta:           #e5e7eb;
    --tinta-suave:     #9ca3af;
    --tinta-tenue:     #6b7280;
    --tinta-fantasma:  #4b5563;

    --acento:          #818cf8;
    --acento-hover:    #a5b4fc;
    --acento-suave:    rgba(129, 140, 248, 0.15);
    --acento-borde:    rgba(129, 140, 248, 0.35);

    --exito:           #34d399;
    --aviso:           #fbbf24;
    --peligro:         #f87171;
    --peligro-suave:   rgba(248, 113, 113, 0.12);
    --peligro-borde:   rgba(248, 113, 113, 0.4);

    --selec:           rgba(129, 140, 248, 0.20);
    --selec-borde:     rgba(129, 140, 248, 0.45);

    --sombra-xs:   0 1px 2px rgba(0, 0, 0, 0.3);
    --sombra-sm:   0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --sombra-md:   0 6px 18px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
    --sombra-lg:   0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    --sombra-xl:   0 32px 70px rgba(0, 0, 0, 0.7);
}

/* Ajustes específicos del tema oscuro */
html[data-tema="oscuro"] .boton-principal {
    background: var(--acento);
    color: var(--fondo);
}
html[data-tema="oscuro"] .boton-principal:hover {
    background: var(--acento-hover);
}
html[data-tema="oscuro"] .campo input,
html[data-tema="oscuro"] .campo textarea,
html[data-tema="oscuro"] .campo select {
    background: var(--fondo);
    color: var(--tinta);
}
html[data-tema="oscuro"] #buscadorInput {
    color: var(--tinta);
}
html[data-tema="oscuro"] .buscador-global:focus-within {
    background: var(--tarjeta);
}
html[data-tema="oscuro"] .bloque-contenido pre,
html[data-tema="oscuro"] .bloque-contenido code {
    background: var(--fondo);
    color: var(--tinta);
    border-color: var(--tarjeta-borde);
}
html[data-tema="oscuro"] .auth-fondo-mancha.mancha-1 {
    background: radial-gradient(circle, rgba(129,140,248,0.25) 0%, transparent 70%);
}
html[data-tema="oscuro"] .auth-fondo-mancha.mancha-2 {
    background: radial-gradient(circle, rgba(251,191,36,0.10) 0%, transparent 70%);
}
html[data-tema="oscuro"] .bloque-dibujo-svg,
html[data-tema="oscuro"] .bloque-dibujo-wrap {
    background: white;     /* el dibujo se queda blanco siempre */
}
html[data-tema="oscuro"] .bloque-imagen-img {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
html[data-tema="oscuro"] mark,
html[data-tema="oscuro"] .buscador-item mark {
    background: rgba(251, 191, 36, 0.35);
    color: var(--tinta);
}

/* Botón toggle de tema */
.tema-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tema-toggle .icono-luna { display: none; }
.tema-toggle .icono-sol  { display: block; }
html[data-tema="oscuro"] .tema-toggle .icono-luna { display: block; }
html[data-tema="oscuro"] .tema-toggle .icono-sol  { display: none; }

/* ============================================================================
 * BOTÓN MODO LECTURA / EDICIÓN  (añadido 2026-05-31, v2.0.5)
 * Vive en la barra superior, a la derecha del buscador. Muestra el icono de
 * "leer" cuando estamos en lectura y el de "editar" (lápiz) cuando se está
 * editando. La clase .activo (puesta desde JS al editar) lo resalta.
 * ============================================================================ */
.modo-lectura-boton {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 0 10px;
}
.modo-lectura-boton .modo-lectura-texto {
    font-family: var(--fuente-ui);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
/* Por defecto (modo lectura): se ve el icono de "leer", se oculta el lápiz */
.modo-lectura-boton .icono-editar { display: none; }
.modo-lectura-boton .icono-leer   { display: block; }
/* Modo edición (clase .activo): se muestra el lápiz y se resalta */
.modo-lectura-boton.activo .icono-leer   { display: none; }
.modo-lectura-boton.activo .icono-editar { display: block; }
.modo-lectura-boton.activo {
    color: var(--acento);
    background: var(--acento-suave);
}
html[data-tema="oscuro"] .modo-lectura-boton.activo {
    background: rgba(124, 109, 245, 0.16);
}
