/* Custom CSS Design System - Secure Cloud Share */
/* Estilo premium con Glassmorphism, Neon Accents y animaciones */

:root {
    --bg-color: #08090d;
    --card-bg: rgba(17, 20, 32, 0.65);
    --card-border: rgba(255, 255, 255, 0.07);
    --card-border-focus: rgba(99, 102, 241, 0.4);
    
    --primary-color: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.3);
    
    --accent-color: #06b6d4; /* Cyan */
    --accent-glow: rgba(6, 182, 212, 0.3);
    
    --success-color: #10b981; /* Emerald */
    --warning-color: #f59e0b; /* Amber */
    --danger-color: #ef4444; /* Rose */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme-specific tokens */
    --select-option-bg: #0b0c11;
    --sidebar-bg: rgba(10, 12, 22, 0.85);
    --sidebar-bg-mobile: rgba(8, 10, 18, 0.95);
    --input-bg: rgba(0, 0, 0, 0.25);
    --input-hover-bg: rgba(255, 255, 255, 0.01);
    --input-focus-bg: rgba(0, 0, 0, 0.4);
    --input-hover-border: rgba(255, 255, 255, 0.15);

    /* Superficies semánticas (theme-aware): barra superior, toasts y "wells"/insets */
    --header-bg: rgba(8, 9, 13, 0.5);
    --toast-bg: rgba(20, 24, 38, 0.95);
    --surface-inset: rgba(0, 0, 0, 0.2);
    --surface-inset-soft: rgba(0, 0, 0, 0.15);
    --surface-inset-strong: rgba(0, 0, 0, 0.3);
}

/* ================================================================
   TEMA CLARO — Identidad "papel editorial cálido"
   No es un dark invertido: paleta cálida (crema + tinta), profundidad
   por SOMBRAS suaves (no por bordes), glassmorphism recalibrado y un
   acento teal profundo. Contraste objetivo WCAG AA.
   ================================================================ */
body.theme-bright {
    --bg-color: #f5efe3;                        /* crema papel */
    --card-bg: rgba(255, 253, 249, 0.82);       /* blanco cálido translúcido */
    --card-border: rgba(90, 72, 50, 0.12);      /* borde cálido sutil */
    --card-border-focus: rgba(14, 116, 144, 0.45);
    --card-shadow: 0 1px 2px rgba(74, 58, 38, 0.05), 0 12px 30px -10px rgba(74, 58, 38, 0.16);
    --card-shadow-hover: 0 2px 6px rgba(74, 58, 38, 0.07), 0 20px 44px -12px rgba(74, 58, 38, 0.22);

    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.18);

    --accent-color: #0e7490;                    /* teal profundo (contraste AA sobre crema) */
    --accent-glow: rgba(14, 116, 144, 0.16);

    --success-color: #047857;
    --warning-color: #b45309;
    --danger-color: #dc2626;

    --text-main: #2c2620;                       /* tinta cálida editorial */
    --text-muted: #6b6155;
    --text-dim: #978b78;

    --select-option-bg: #fffdf9;
    --sidebar-bg: rgba(243, 236, 224, 0.86);
    --sidebar-bg-mobile: rgba(243, 236, 224, 0.97);
    --input-bg: rgba(74, 58, 38, 0.04);
    --input-hover-bg: rgba(74, 58, 38, 0.02);
    --input-focus-bg: #fffdf9;
    --input-hover-border: rgba(90, 72, 50, 0.22);

    /* Superficies semánticas en cálido (no negro sobre crema) */
    --header-bg: rgba(250, 246, 238, 0.72);
    --toast-bg: rgba(255, 253, 249, 0.97);
    --surface-inset: rgba(74, 58, 38, 0.05);
    --surface-inset-soft: rgba(74, 58, 38, 0.035);
    --surface-inset-strong: rgba(74, 58, 38, 0.07);
}

/* Fondo de papel en capas (cálido y sutil) */
body.theme-bright {
    background-image:
        radial-gradient(1100px 560px at 12% -12%, rgba(255, 255, 255, 0.75), transparent 60%),
        radial-gradient(900px 520px at 105% 0%, rgba(236, 222, 197, 0.55), transparent 55%);
    background-attachment: fixed;
}

/* Glows de fondo: cálidos y muy tenues (no el cian del dark) */
body.theme-bright .glow-1,
body.theme-bright .glow-2 {
    opacity: 0.05;
}
body.theme-bright .glow-1 { background: radial-gradient(circle, #d8a657 0%, transparent 70%); }
body.theme-bright .glow-2 { background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%); }

/* Profundidad por SOMBRA en las superficies principales (clave del look claro) */
body.theme-bright .card,
body.theme-bright .settings-panel {
    box-shadow: var(--card-shadow);
}
body.theme-bright .app-sidebar {
    box-shadow: 1px 0 0 rgba(90, 72, 50, 0.06), 14px 0 36px -22px rgba(74, 58, 38, 0.22);
}

/* Navegación activa: pastilla cálida con acento lateral */
body.theme-bright .nav-item.active {
    background: rgba(14, 116, 144, 0.10);
    color: var(--accent-color);
    box-shadow: inset 3px 0 0 0 var(--accent-color);
}
body.theme-bright .nav-item:hover {
    background: rgba(74, 58, 38, 0.05);
}

/* Botón primario: sombra cálida suave en vez de glow neón */
body.theme-bright .btn-primary {
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
}
body.theme-bright .btn-primary:hover {
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.30);
}

/* Dropzone: papel con leve hundido */
body.theme-bright .upload-dropzone {
    background: rgba(255, 253, 249, 0.6);
    box-shadow: inset 0 1px 2px rgba(74, 58, 38, 0.04);
}

/* Toasts y modal: sombra cálida (no negra dura) */
body.theme-bright .toast {
    box-shadow: 0 10px 30px -8px rgba(74, 58, 38, 0.28);
}
body.theme-bright .modal-overlay {
    background: rgba(40, 32, 22, 0.55);
}
body.theme-bright .modal-card {
    background: rgba(255, 253, 249, 0.98) !important;
    border: 1px solid rgba(90, 72, 50, 0.12) !important;
    box-shadow: 0 30px 60px -20px rgba(74, 58, 38, 0.40) !important;
}

/* Marco del QR: blanco cálido con borde sutil */
body.theme-bright .qr-container {
    background: #fffdf9;
    box-shadow: inset 0 0 0 1px rgba(90, 72, 50, 0.10);
}

/* Scrollbar cálido (no gris frío) en tema claro */
body.theme-bright ::-webkit-scrollbar-thumb { background: rgba(74, 58, 38, 0.18); }
body.theme-bright ::-webkit-scrollbar-thumb:hover { background: rgba(74, 58, 38, 0.34); }

/* Legibilidad de detalles sobre crema */
body.theme-bright .sidebar-user-block #logged-user-info .user-status-indicator {
    border-color: #f5efe3 !important;
}
body.theme-bright .modal-close-btn,
body.theme-bright .btn-close-modal {
    color: var(--text-dim) !important;
}

/* ================================================================
   PULIDO UI/UX TRANSVERSAL (ambos temas)
   Reglas aplicadas: foco visible (WCAG 2.4.7), respeto a reduce-motion,
   feedback de pulsación consistente y áreas táctiles cómodas (Fitts).
   ================================================================ */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.nav-item:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(1px);
}

@media (max-width: 768px) {
    .nav-item { min-height: 44px; }
    .btn-primary,
    .btn-secondary { min-height: 44px; }
}

/* ================================================================
   REGISTRO DE ACTIVIDAD (admin)
   ================================================================ */
.activity-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.activity-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.activity-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.activity-field .select-wrapper { min-width: 150px; }
.activity-total {
    margin-left: auto;
    align-self: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.activity-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
}
.activity-page-info {
    font-size: 0.88rem;
    color: var(--text-muted);
    min-width: 140px;
    text-align: center;
}
.activity-pagination .btn-secondary { padding: 8px 18px; }
.activity-pagination .btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.event-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.event-badge.event-upload { background: rgba(79, 70, 229, 0.12); color: var(--primary-color); }
.event-badge.event-download { background: rgba(16, 185, 129, 0.14); color: var(--success-color); }

/* ================================================================
   NOTAS KEEP — paleta pastel con tinta oscura fija (legible en ambos temas)
   ================================================================ */
/* Paleta oscura estilo Google Keep -> texto e iconos SIEMPRE blancos (ambos temas) */
.note-card { color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.10); position: relative; }
.note-card-title { color: #ffffff; }
.note-card-content { color: rgba(255, 255, 255, 0.88); }
.note-card-content strong, .note-card-content b { color: #ffffff; }
.note-card-date { color: rgba(255, 255, 255, 0.60); font-weight: 600; }
.note-card .btn-note-action { color: rgba(255, 255, 255, 0.65); }
.note-card .btn-note-action:hover { color: #ffffff; background: rgba(255, 255, 255, 0.16); }
.note-card .btn-note-delete:hover { color: #ffd5d5; background: rgba(255, 255, 255, 0.16); }
.note-card .note-card-footer { border-top: 1px solid rgba(255, 255, 255, 0.16); }

/* Topbar (badge importante + pin) */
.note-card-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 16px; margin-bottom: 2px; }
.note-card .btn-pin-note { position: static; top: auto; right: auto; margin-left: auto; color: rgba(255, 255, 255, 0.6); }
.note-card .btn-pin-note:hover, .note-card .btn-pin-note.active { color: #fdd663; }
.note-important-badge { display: inline-flex; align-items: center; color: #fdd663; }

/* Nota importante: barra de acento ámbar a la izquierda */
.note-card.note-important { box-shadow: inset 4px 0 0 0 #fdd663; }

/* Listas (checklist) */
.note-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.note-list-item { display: flex; align-items: flex-start; gap: 8px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.92); cursor: pointer; line-height: 1.35; }
.note-list-item input[type="checkbox"] { margin-top: 2px; width: 15px; height: 15px; accent-color: #8ab4f8; cursor: pointer; flex-shrink: 0; }
.note-list-item.done span { text-decoration: line-through; opacity: 0.55; }
.note-list-progress { font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); margin-top: 10px; font-weight: 600; }

/* Paleta de colores del editor */
.color-picker-palette { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.color-picker-palette .color-dot { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); transition: transform 0.15s ease; }
.color-picker-palette .color-dot:hover { transform: scale(1.15); }
.color-picker-palette .color-dot.active { outline: 2px solid var(--accent-color); outline-offset: 2px; }

/* Toolbar del editor (tipo / importancia / paleta) */
.note-creator-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.note-creator-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.note-type-toggle { display: inline-flex; background: var(--surface-inset); border: 1px solid var(--card-border); border-radius: 10px; padding: 2px; gap: 2px; }
.note-type-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--text-muted); font-family: inherit; font-size: 0.8rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: var(--transition-fast); }
.note-type-btn svg { width: 14px; height: 14px; }
.note-type-btn.active { background: var(--card-bg); color: var(--accent-color); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10); }
.note-important-toggle { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-inset); border: 1px solid var(--card-border); color: var(--text-muted); font-family: inherit; font-size: 0.8rem; font-weight: 600; padding: 7px 12px; border-radius: 10px; cursor: pointer; transition: var(--transition-fast); }
.note-important-toggle svg { width: 14px; height: 14px; }
.note-important-toggle:hover { color: var(--text-main); }
.note-important-toggle.active { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: #b45309; }
.note-important-toggle.active svg { fill: #f59e0b; stroke: #f59e0b; }

/* Barra de progreso indeterminada (descarga grande sin Content-Length usable) */
.progress-bar.indeterminate {
    background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    background-size: 40% 100%;
    background-repeat: no-repeat;
    animation: indeterminateSlide 1.1s ease-in-out infinite;
}
@keyframes indeterminateSlide {
    0% { background-position: -40% 0; }
    100% { background-position: 140% 0; }
}

/* ================================================================
   RESPONSIVE MÓVIL — receptor de descargas y ajustes finos
   Principios: mobile-first stacking, sin truncado del nombre, áreas
   táctiles ≥44px, ancho completo de acciones en pantallas pequeñas.
   ================================================================ */
@media (max-width: 640px) {
    /* File rows del receptor: apilar (nombre/tamaño arriba, botón abajo a ancho completo) */
    .download-file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .download-file-item .file-info {
        width: 100%;
        align-items: flex-start;
    }
    .download-file-item .file-name {
        white-space: normal;       /* permitir 2 líneas en vez de truncar */
        word-break: break-word;
    }
    .download-file-item .btn-download {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    /* Acciones del resultado/receptor cómodas al tacto */
    .recipient-view .btn-primary,
    .recipient-view .btn-secondary { min-height: 44px; }
}

/* Custom Scrollbar for premium dark integration */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-inset);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Background Glowing Elements */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.glow-1, .glow-2 {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    pointer-events: none;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    animation: pulseGlow 15s infinite alternate;
}

.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    animation: pulseGlow 20s infinite alternate-reverse;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.12; }
    50% { transform: scale(1.1) translate(3%, 5%); opacity: 0.18; }
    100% { transform: scale(0.9) translate(-2%, -3%); opacity: 0.12; }
}

/* App Container Layout - Sidebar Grid System */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    gap: 0;
}

/* Sidebar Fijo a la Izquierda */
.app-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: var(--transition-normal);
}

/* Brand Logo en Sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-color);
    filter: drop-shadow(0 0 8px var(--accent-glow));
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--text-main), #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-env {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    display: inline-block;
    margin-top: 2px;
}

/* Bloque de Usuario en Sidebar */
.sidebar-user-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
}

.sidebar-user-block .btn-secondary {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.btn-logout-pill {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition-fast);
}

.btn-logout-pill:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: var(--danger-color);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.btn-logout-pill .btn-icon {
    width: 13px;
    height: 13px;
}

/* Navegación del Sidebar */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Footer del sidebar: versión + autoría */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-footer-version {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.sidebar-footer-credit {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.nav-category {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-left: 8px;
    margin-bottom: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

.nav-item.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.18);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.nav-item.active .nav-icon {
    color: var(--primary-color);
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4));
}

.nav-icon {
    width: 18px;
    height: 18px;
    color: inherit;
    transition: var(--transition-fast);
}

/* Panel de Contenido Principal (Derecha) */
.app-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Cabecera Superior del Contenido */
.main-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 40px;
    border-bottom: 1px solid var(--card-border);
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 90;
}

#view-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: none; /* Oculto en escritorio */
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.btn-toggle-sidebar:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Área de contenido del panel */
.main-content {
    padding: 40px;
    flex-grow: 1;
    max-width: 900px;
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Tarjeta Principal Modificada */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

/* Drag and Drop Zone */
.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: var(--transition-normal);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--accent-color);
    background: rgba(6, 182, 212, 0.03);
    box-shadow: inset 0 0 20px rgba(6, 182, 212, 0.02);
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-color);
    filter: drop-shadow(0 0 10px var(--accent-glow));
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.upload-dropzone:hover .upload-icon {
    transform: translateY(-5px);
}

.dropzone-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.dropzone-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dropzone-limit {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* File List styling */
.file-list-container {
    margin-top: 20px;
    background: var(--surface-inset-soft);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 16px;
}

.file-list-container h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
    transition: var(--transition-fast);
}

.file-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-remove-file:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.remove-icon {
    width: 16px;
    height: 16px;
}

/* Clipboard Textarea */
.textarea-wrapper {
    position: relative;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    overflow: hidden;
    transition: var(--transition-normal);
}

.textarea-wrapper:focus-within {
    border-color: var(--card-border-focus);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

#text-content {
    width: 100%;
    height: 180px;
    background: none;
    border: none;
    outline: none;
    padding: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    line-height: 1.6;
}

.textarea-counter {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Settings Panel */
.settings-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.settings-panel h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 580px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Inputs & Select styling */
.select-wrapper, .input-password-wrapper {
    position: relative;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    transition: var(--transition-fast);
}

.select-wrapper:hover, .input-password-wrapper:hover {
    border-color: var(--input-hover-border);
    background: var(--input-hover-bg);
}

.select-wrapper:focus-within, .input-password-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
    background: var(--input-focus-bg);
}

select, input[type="password"], input[type="text"] {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    padding: 11px 14px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
}

/* Autofill Overrides for premium dark integration */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-main) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--select-option-bg) inset !important;
    transition: background-color 5000s ease-in-out 0s;
    border-radius: 9px;
}

select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
}

select option {
    background-color: var(--select-option-bg) !important;
    color: var(--text-main) !important;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

.input-password-wrapper {
    display: flex;
    align-items: center;
}

.btn-toggle-pass {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    margin-right: 6px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: var(--transition-fast);
}

.btn-toggle-pass:hover {
    color: var(--text-main);
}

.icon-eye {
    width: 18px;
    height: 18px;
}

/* Toggles Grid */
.toggles-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.toggle-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    border-radius: 14px;
    gap: 16px;
}

.toggle-control.highlight {
    background: rgba(99, 102, 241, 0.02);
    border-color: rgba(99, 102, 241, 0.08);
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.toggle-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Switch Custom Style */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
    border-color: rgba(99, 102, 241, 0.3);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Progress bar */
.progress-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
}

#progress-status {
    color: var(--text-muted);
    font-weight: 500;
}

#progress-percent {
    color: var(--accent-color);
    font-weight: 600;
}

.progress-bar-wrapper {
    height: 6px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 99px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.1s ease;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
    transition: var(--transition-normal);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.btn-text:hover {
    color: var(--danger-color);
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-full-width {
    width: 100%;
}

/* Results view */
.result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.success-icon-wrapper {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--success-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.success-icon {
    width: 24px;
    height: 24px;
}

.result-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.result-header p {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 400px;
}

.result-box {
    background: var(--surface-inset);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.link-input-wrapper {
    display: flex;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

.link-input-wrapper input {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 12px 16px;
}

.btn-copy {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0 18px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-fast);
}

.btn-copy:hover {
    background: var(--primary-hover);
}

.copy-icon {
    width: 15px;
    height: 15px;
}

.result-actions {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 20px;
    align-items: center;
}

@media (max-width: 500px) {
    .result-actions {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}

.qr-container {
    background: #ffffff;
    padding: 8px;
    border-radius: 12px;
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-container img {
    max-width: 100%;
    max-height: 100%;
}

/* Campo de título de la subida */
.upload-title-group {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.upload-title-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}
.upload-title-group .req-mark {
    color: var(--danger-color, #ef4444);
}
.upload-title-group input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.08));
    background: var(--surface-inset);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.upload-title-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.upload-title-group .upload-title-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
}

.security-meta-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-item {
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 6px;
}

.meta-item strong {
    color: var(--text-muted);
}

.meta-item span {
    color: var(--text-main);
    font-weight: 500;
}

.card-footer {
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
}

/* Recipient View (Destinatario) */
.recipient-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.recipient-icon {
    width: 56px;
    height: 56px;
    color: var(--accent-color);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

#recipient-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.badge-secure {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 99px;
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.recipient-sub-block {
    background: var(--surface-inset-soft);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.block-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Password Auth Block */
.auth-message {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-form-row {
    display: flex;
    gap: 10px;
}

.auth-form-row input {
    flex-grow: 1;
    border: 1px solid var(--card-border);
    background: var(--surface-inset);
    border-radius: 10px;
}

.auth-form-row input:focus {
    border-color: var(--card-border-focus);
}

.error-text {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: -4px;
}

/* Text Viewer (Decrypted Text display) */
.text-content-viewer-wrapper {
    background: var(--surface-inset-strong);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    max-height: 250px;
    overflow-y: auto;
}

#decoded-text-view {
    color: var(--text-main);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

/* Download file list */
.download-file-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px 16px;
}

.btn-download {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.15);
    transition: var(--transition-fast);
}

.btn-download:hover {
    background: #0891b2;
    transform: translateY(-1px);
}

.btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.download-icon {
    width: 14px;
    height: 14px;
}

.recipient-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.burn-alert-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(239, 68, 68, 0.07);
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    color: #fca5a5;
    line-height: 1.4;
    text-align: left;
}

.burn-icon-svg {
    width: 20px;
    height: 20px;
    color: var(--danger-color);
    flex-shrink: 0;
}

.expiration-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* History view (Tabla) */
.history-card {
    padding: 22px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.no-history-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    padding: 16px 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.history-table th, .history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-table th {
    background: var(--surface-inset);
    color: var(--text-muted);
    font-weight: 600;
}

.history-table tbody tr {
    transition: var(--transition-fast);
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.015);
}

.history-table td {
    color: var(--text-main);
}

.history-type-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-text-type {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}

.badge-file-type {
    background: rgba(6, 182, 212, 0.1);
    color: #67e8f9;
}

.history-link {
    color: var(--accent-color);
    text-decoration: none;
    max-width: 150px;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-link:hover {
    text-decoration: underline;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-history-action {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-history-action:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-history-delete:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.history-icon {
    width: 14px;
    height: 14px;
}

/* Footer general */
.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 10px 0;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--toast-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--primary-color);
    border-radius: 10px;
    padding: 12px 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 250px;
    max-width: 380px;
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast.danger {
    border-left-color: var(--danger-color);
}

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.danger .toast-icon { color: var(--danger-color); }

@keyframes slideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- ESTILOS ADICIONALES (LOGIN Y PORTAPAPELES PÚBLICO) --- */

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

#auth-header-block {
    display: flex;
    align-items: center;
}

.user-name-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent-color);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
}

/* Locked Features Block (Dashed layout) */
.locked-feature-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px dashed rgba(255, 255, 255, 0.08);
    background: var(--surface-inset-soft);
    border-radius: 18px;
    padding: 40px 24px;
    margin: 10px 0;
    animation: fadeIn 0.4s ease;
}

.locked-icon {
    width: 44px;
    height: 44px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.locked-feature-block h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.locked-feature-block p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 380px;
    line-height: 1.4;
}

/* Public Clipboard */
.tab-info-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
}

#public-text-content {
    width: 100%;
    height: 220px;
    background: none;
    border: none;
    outline: none;
    padding: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    line-height: 1.6;
}

/* Modal Overlay & Modal Window */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 5, 8, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: modalFadeIn 0.3s ease;
}

.modal-card {
    background: rgba(17, 20, 32, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6) !important;
}

.btn-close-modal:hover {
    color: var(--text-main) !important;
    background: rgba(255, 255, 255, 0.05);
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 580px) {
    .header-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }
}

/* --- ESTILOS DE MULTI-CLIPS --- */
.clips-form-wrapper {
    background: var(--surface-inset-soft);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 14px;
}

.clip-card-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 8px;
    transition: var(--transition-fast);
}

.clip-card-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.clip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clip-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.clip-card-body {
    font-size: 0.85rem;
    color: var(--text-muted);
    word-break: break-all;
    max-height: 80px;
    overflow-y: auto;
    font-family: monospace;
    background: var(--surface-inset);
    padding: 8px;
    border-radius: 6px;
}

/* --- ESTILOS DE GOOGLE KEEP NOTES --- */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.note-card {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: fadeIn 0.3s ease;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.note-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    margin-right: 28px;
    word-break: break-word;
}

.note-card-content {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 8px;
    flex-grow: 1;
    word-break: break-word;
    line-height: 1.5;
}

.note-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.note-card-date {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.note-card-actions {
    display: flex;
    gap: 6px;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

.btn-note-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-note-action:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.btn-note-delete:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.btn-pin-note {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.btn-pin-note:hover, .btn-pin-note.active {
    color: var(--warning-color);
}

/* Color Dot Palette inside Keep Note Card */
.color-picker-palette .color-dot {
    transition: transform 0.1s ease;
}
.color-picker-palette .color-dot:hover {
    transform: scale(1.2);
}
.color-picker-palette .color-dot.active {
    border-color: #ffffff !important;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* --- ESTILOS DE MARKDOWN --- */
.markdown-preview-area ul, .note-card-content ul {
    margin-left: 20px;
    margin-bottom: 8px;
    list-style-type: disc !important;
}

.markdown-preview-area li, .note-card-content li {
    margin-bottom: 4px;
}

.markdown-preview-area pre, .note-card-content pre {
    background: var(--surface-inset-strong);
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-preview-area code, .note-card-content code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

/* --- RESPONSIVIDAD PARA EL MENÚ LATERAL Y REJILLA --- */
@media (max-width: 950px) {
    .app-container {
        grid-template-columns: 1fr !important;
    }
    
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
        background: var(--sidebar-bg-mobile);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .btn-toggle-sidebar {
        display: block !important;
    }
    
    .main-header {
        padding: 16px 20px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .card {
        padding: 24px;
    }
}

/* --- SISTEMA DE TIPOGRAFÍA Y ESPACIADO GLOBAL --- */

/* Títulos de tarjetas principales */
.card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text-main);
    margin: 0;
}

/* Subtítulos de tarjetas principales */
.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.45;
    margin: 0;
}

/* Grupo contenedor de encabezados para tarjetas */
.card-header-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px; /* Espacio limpio antes del formulario o tabla */
}

/* Títulos internos de segundo nivel dentro de tarjetas */
.card h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.025em;
    margin: 0 0 12px 0;
}

/* Encabezados de modales */
.modal-overlay h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--text-main);
    margin: 0;
}

.modal-overlay p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 4px 0 0 0;
}

#create-user-form input, #system-settings-form input {
    background: none;
    border: none;
    width: 100%;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    padding: 11px 14px;
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    padding: 0;
}

.btn-theme-toggle:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Adjust icons based on active class on body */
body.theme-bright .btn-theme-toggle {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-muted);
}

body.theme-bright .btn-theme-toggle:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Toggle transformations */
body.theme-bright .sun-icon {
    transform: scale(0) rotate(-90deg) !important;
    opacity: 0 !important;
}

body.theme-bright .moon-icon {
    transform: scale(1) rotate(0deg) !important;
    opacity: 1 !important;
}

/* Badges for User Roles */
.badge-role {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-admin {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-team {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-client {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

body.theme-bright .badge-admin {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

body.theme-bright .badge-team {
    background: rgba(8, 145, 178, 0.1);
    color: #0891b2;
    border: 1px solid rgba(8, 145, 178, 0.2);
}

body.theme-bright .badge-client {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

/* Edit User Modal inputs */
#edit-user-form input {
    background: none;
    border: none;
    width: 100%;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    padding: 11px 14px;
}

/* ==========================================================================
   BÓVEDA DE TARJETAS (zero-knowledge)
   ========================================================================== */
.vault-panel { animation: fadeIn 0.3s ease; }

/* Estados centrados: configurar / bloqueada */
#vault-setup, #vault-locked { max-width: 460px; margin: 0 auto; }
.vault-hero { text-align: center; padding: 10px 0 6px; }
.vault-hero-icon { width: 46px; height: 46px; color: var(--accent-color); margin-bottom: 10px; }
.vault-hero h2 { font-size: 1.25rem; margin: 0 0 8px; color: var(--text-main); }
.vault-hero p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; margin: 0 auto 14px; max-width: 42ch; }
.vault-warning {
    font-size: 0.82rem; line-height: 1.5; color: var(--text-main);
    background: rgba(245, 158, 11, 0.10); border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px; padding: 12px 14px; text-align: left; margin: 4px auto 0; max-width: 44ch;
}
.vault-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; margin: 18px auto 0; }
.vault-form label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.vault-form .input-password-wrapper input { width: 100%; background: none; border: none; color: var(--text-main); font-family: inherit; font-size: 0.9rem; outline: none; padding: 11px 14px; }
.vault-form .btn-primary { margin-top: 6px; justify-content: center; }
.vault-strength { font-size: 0.76rem; font-weight: 600; min-height: 1em; color: var(--text-dim); }
.vault-strength.s0, .vault-strength.s1 { color: #ef4444; }
.vault-strength.s2, .vault-strength.s3 { color: #f59e0b; }
.vault-strength.s4, .vault-strength.s5 { color: #10b981; }

/* Barra de acciones (desbloqueada) */
.vault-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.vault-toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.vault-toolbar .btn-primary, .vault-toolbar .btn-secondary { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; font-size: 0.85rem; }

/* Rejilla de tarjetas */
.vault-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }

/* La tarjeta mantiene un look "tarjeta bancaria" oscuro en ambos temas (elemento premium). */
.vault-card {
    position: relative; border-radius: 16px; padding: 18px 18px 14px;
    background: linear-gradient(135deg, #0e2b3a 0%, #123a52 45%, #0b1b2b 100%);
    border: 1px solid rgba(6, 182, 212, 0.28);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: #f1f5f9; overflow: hidden;
}
.vault-card::after {
    content: ""; position: absolute; top: -40%; right: -30%; width: 60%; height: 120%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.22) 0%, transparent 70%); pointer-events: none;
}
.vault-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.vault-card-alias { font-weight: 700; font-size: 0.98rem; color: #fff; }
.vault-card-brand { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #7dd3fc; }
.vault-card-number {
    font-family: 'Courier New', ui-monospace, monospace; font-size: 1.18rem; font-weight: 700;
    letter-spacing: 0.12em; color: #fff; margin-bottom: 16px; word-break: break-all;
}
.vault-card-grid { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.vault-card-label { display: block; font-size: 0.62rem; letter-spacing: 0.09em; text-transform: uppercase; color: #7f9bb0; margin-bottom: 2px; }
.vault-card-val { display: block; font-size: 0.86rem; font-weight: 600; color: #eaf2f8; }
.vault-cvv { font-family: 'Courier New', monospace; letter-spacing: 0.08em; }
.vault-card-bank { font-size: 0.78rem; color: #b9cfe0; margin-top: 6px; }
.vault-card-notes { font-size: 0.78rem; color: #9fb6c8; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.vault-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.10); }
.vault-mini-btn {
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); color: #e2eaf0;
    font-family: inherit; font-size: 0.74rem; font-weight: 600; padding: 6px 10px; border-radius: 8px;
    cursor: pointer; transition: var(--transition-fast);
}
.vault-mini-btn:hover { background: rgba(6, 182, 212, 0.25); border-color: rgba(6, 182, 212, 0.5); }
.vault-mini-btn.danger:hover { background: rgba(239, 68, 68, 0.28); border-color: rgba(239, 68, 68, 0.55); }

/* Modales de la bóveda */
.vault-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); z-index: 1000; align-items: center; justify-content: center; padding: 18px; }
.vault-modal-box {
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px;
    padding: 22px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); backdrop-filter: blur(18px);
}
.vault-modal-box h3 { margin: 0 0 14px; font-size: 1.1rem; color: var(--text-main); }
.vault-share-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; margin: 0 0 14px; }
.vault-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.vault-field label { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); }
.vault-field input, .vault-field select, .vault-field textarea {
    width: 100%; background: var(--surface-inset); border: 1px solid var(--card-border); border-radius: 10px;
    color: var(--text-main); font-family: inherit; font-size: 0.9rem; padding: 10px 12px; outline: none;
    transition: var(--transition-fast); box-sizing: border-box; resize: vertical;
}
.vault-field input:focus, .vault-field select:focus, .vault-field textarea:focus { border-color: var(--card-border-focus); }
.vault-row { display: flex; gap: 12px; }
.vault-row .vault-field { flex: 1; }
.vault-check { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--text-main); margin: 6px 0 14px; cursor: pointer; }
.vault-check input { width: 16px; height: 16px; accent-color: var(--accent-color); }
.vault-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
#card-share-link { font-family: 'Courier New', monospace; font-size: 0.8rem; }

/* Tarjeta recibida (vista del destinatario): en modo tarjeta, el cuadro de texto pierde
   su alto fijo/overflow/fondo para que la tarjeta se vea completa y sin scroll. */
.text-content-viewer-wrapper.card-mode { max-height: none; overflow: visible; background: none; border: none; padding: 0; }
/* Fuerza ancho definido en el bloque para que la tarjeta (width:100%) no colapse ni desborde. */
.recipient-sub-block.card-mode { width: 100%; box-sizing: border-box; }

/* Bloque (no flex) para que la tarjeta con width:100%+max-width tenga ancho definido y se centre. */
.received-card-wrap { display: block; padding: 4px 0; text-align: center; }

/* Tarjeta de crédito realista */
.credit-card {
    /* El bloque contenedor tiene ancho definido (.recipient-sub-block.card-mode), así que
       width:100% se resuelve al ancho del panel: 340px en escritorio, y en móvil se ajusta
       al panel sin desbordar. */
    width: 100%; max-width: 340px; margin: 0 auto; aspect-ratio: 1.586 / 1; text-align: left;
    box-sizing: border-box; padding: 20px; border-radius: 16px; color: #fff; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #1c4a6e 0%, #0e7490 48%, #0a2a44 100%);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.credit-card::after {
    content: ""; position: absolute; top: -60%; right: -25%; width: 75%; height: 220%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 60%); transform: rotate(20deg); pointer-events: none;
}
.cc-row { display: flex; justify-content: space-between; align-items: center; }
.cc-bank { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; opacity: 0.95; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-brand { font-size: 0.95rem; font-weight: 800; font-style: italic; letter-spacing: 0.04em; }
.cc-chip { width: 40px; height: 30px; border-radius: 6px; background: linear-gradient(135deg, #f2d98b, #b8912f); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); position: relative; }
.cc-chip::before { content: ""; position: absolute; inset: 6px 8px; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 3px; }
.cc-number { font-family: 'Courier New', ui-monospace, monospace; font-size: 1.2rem; font-weight: 700; letter-spacing: 0.08em; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.cc-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.cc-field-label { display: block; font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; margin-bottom: 2px; }
.cc-field-val { font-size: 0.82rem; font-weight: 600; }
.cc-cvv { font-family: 'Courier New', monospace; letter-spacing: 0.06em; }
.cc-notes { font-size: 0.8rem; color: var(--text-muted); max-width: 360px; margin: 12px auto 0; text-align: center; white-space: pre-wrap; word-break: break-word; }
.received-card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

@media (max-width: 420px) {
    .cc-number { font-size: 1.02rem; letter-spacing: 0.04em; }
}

/* Gestión de Assets: el detalle se acota a 2 líneas y NUNCA empuja los iconos de acción */
.asset-details {
    max-width: 360px;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    cursor: help; /* pista de que hay tooltip con el detalle completo */
}
/* La última columna (acciones) se queda con su ancho natural y en una sola línea */
#assets-list-body td:last-child { width: 1%; white-space: nowrap; }
#assets-list-body td:last-child > div { flex-wrap: nowrap; }

/* Métricas de subida: velocidad · transcurrido · restante */
.progress-metrics {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
    margin-top: 10px; font-size: 0.78rem; color: var(--text-muted);
}
.progress-metrics .metric { display: inline-flex; align-items: center; gap: 6px; }
.progress-metrics .metric svg { width: 13px; height: 13px; opacity: 0.75; flex-shrink: 0; }
.progress-metrics strong {
    color: var(--text-main); font-weight: 600;
    font-variant-numeric: tabular-nums; /* evita que los números "bailen" al actualizarse */
}

@media (max-width: 480px) {
    .progress-metrics { gap: 4px 12px; font-size: 0.74rem; }
}

/* Aviso de "Sin conexión" (PWA) */
.offline-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
    display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 16px; font-size: 0.82rem; font-weight: 600;
    background: #7c4a03; color: #fff8ec; border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.offline-bar strong { color: #fff; }
.offline-identity { opacity: 0.85; font-weight: 500; }

/* ==========================================================================
   NOTAS KEEP: tarjetas uniformes + editor en popup
   ========================================================================== */

.notes-toolbar { display: flex; margin-bottom: 16px; }
.notes-toolbar .btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; font-size: 0.85rem; }

/* Todas las tarjetas miden IGUAL (mismo alto y ancho): el exceso de contenido se recorta. */
.notes-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.note-card { height: var(--note-card-h, 330px); min-height: 0; overflow: hidden; }
.note-card-body { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.note-card-footer { flex-shrink: 0; }

/* Vista previa de como máximo 10 líneas, con puntos suspensivos. */
.note-card-content {
    display: -webkit-box;
    -webkit-line-clamp: 10;
    line-clamp: 10;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 0;
}
.note-card-content > *:first-child { margin-top: 0; }
.note-list-more { font-size: 0.75rem; color: rgba(255, 255, 255, 0.7); font-weight: 600; margin-top: 2px; }

@media (max-width: 640px) {
    .note-card { --note-card-h: 300px; }
}

/* --- Popup del editor de notas --- */
body.modal-open { overflow: hidden; }

.note-modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); z-index: 1000; align-items: center; justify-content: center; padding: 16px; }
.note-modal-box {
    /* Aprovecha el ancho REAL de la ventana con tope de 900px (el padding del overlay
       garantiza el margen lateral en pantallas pequeñas). */
    width: min(900px, 100%);
    max-height: 92vh;
    box-sizing: border-box;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45); backdrop-filter: blur(18px);
}
.note-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--card-border); flex-shrink: 0; }
.note-modal-head h3 { margin: 0; font-size: 1.05rem; color: var(--text-main); }
.note-modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; transition: var(--transition-fast); }
.note-modal-close:hover { color: var(--text-main); background: var(--surface-inset); }

.note-modal .keep-note-creator { display: flex; flex-direction: column; gap: 12px; padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.note-modal #note-title,
.note-modal #note-content {
    width: 100%; box-sizing: border-box; background: var(--surface-inset);
    border: 1px solid var(--card-border); border-radius: 10px; color: var(--text-main);
    font-family: inherit; outline: none; transition: var(--transition-fast);
}
.note-modal #note-title { padding: 11px 14px; font-size: 1rem; font-weight: 600; }
.note-modal #note-content { padding: 12px 14px; font-size: 0.95rem; line-height: 1.6; resize: vertical; min-height: 240px; }
.note-modal #note-title:focus, .note-modal #note-content:focus { border-color: var(--card-border-focus); }
.note-modal .note-creator-actions { display: flex; flex-direction: column; gap: 14px; }
.note-modal .note-creator-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.note-modal .note-creator-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.note-modal .note-creator-buttons .btn-primary,
.note-modal .note-creator-buttons .btn-secondary { padding: 9px 18px; font-size: 0.85rem; }

/* En pantallas bajas el área de texto cede altura para que quepan los botones. */
@media (max-height: 720px) {
    .note-modal #note-content { min-height: 150px; }
}

/* --- Barra de formato Markdown --- */
.md-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    padding: 6px; border: 1px solid var(--card-border); border-radius: 10px;
    background: var(--surface-inset-soft);
}
.md-toolbar button {
    background: none; border: 1px solid transparent; color: var(--text-muted);
    font-family: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1;
    padding: 6px 9px; border-radius: 7px; cursor: pointer; transition: var(--transition-fast);
}
.md-toolbar button:hover { background: var(--surface-inset-strong); color: var(--text-main); border-color: var(--card-border); }
.md-toolbar .md-sep { width: 1px; height: 18px; background: var(--card-border); margin: 0 3px; }
.md-toolbar .md-spacer { flex: 1 1 auto; }
.md-toolbar .md-preview-toggle { border-color: var(--card-border); }
.md-toolbar .md-preview-toggle.active { background: var(--accent-color); color: #fff; border-color: transparent; }

/* Vista previa dentro del editor */
.note-preview {
    min-height: 240px; max-height: 50vh; overflow-y: auto;
    padding: 12px 14px; border: 1px solid var(--card-border); border-radius: 10px;
    background: var(--surface-inset); color: var(--text-main);
}

/* --- Modo lectura: ocupa la ventana --- */
.note-reader-box { width: min(1100px, 100%); height: min(90vh, 100%); max-height: 90vh; }
.note-reader-actions { display: flex; align-items: center; gap: 8px; }
.note-reader-actions .btn-secondary { padding: 7px 14px; font-size: 0.8rem; }
.note-reader-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: 22px 26px; color: var(--text-main); font-size: 1rem; line-height: 1.75;
}
.reader-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.reader-list li.done { opacity: 0.6; text-decoration: line-through; }
.reader-progress { margin-top: 16px; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }

/* --- Tipografía compartida del Markdown renderizado --- */
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.1em 0 0.5em; line-height: 1.3; color: var(--text-main); }
.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.08rem; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child, .markdown-body p:first-child { margin-top: 0; }
.markdown-body p { margin: 0 0 0.85em; }
.markdown-body ul, .markdown-body ol { margin: 0 0 0.9em; padding-left: 1.5em; }
.markdown-body li { margin-bottom: 0.35em; }
.markdown-body blockquote {
    margin: 0 0 0.9em; padding: 2px 14px; border-left: 3px solid var(--accent-color);
    background: var(--surface-inset-soft); border-radius: 0 8px 8px 0; color: var(--text-muted);
}
.markdown-body blockquote p { margin: 0.5em 0; }
.markdown-body code {
    background: var(--surface-inset-strong); padding: 2px 6px; border-radius: 5px;
    font-family: 'Courier New', ui-monospace, monospace; font-size: 0.9em;
}
.markdown-body pre {
    background: var(--surface-inset-strong); padding: 14px 16px; border-radius: 10px;
    overflow-x: auto; margin: 0 0 0.9em; border: 1px solid var(--card-border);
}
.markdown-body pre code { background: none; padding: 0; font-size: 0.88em; line-height: 1.55; }
.markdown-body a { color: var(--accent-color); text-decoration: underline; }
.markdown-body hr { border: none; border-top: 1px solid var(--card-border); margin: 1.4em 0; }
.markdown-body del { opacity: 0.7; }

@media (max-width: 640px) {
    .note-reader-body { padding: 16px 16px; font-size: 0.95rem; }
    .note-reader-actions .btn-secondary { padding: 6px 10px; font-size: 0.75rem; }
    .md-toolbar button { padding: 6px 7px; font-size: 0.72rem; }
}

@media (max-width: 640px) {
    .vault-cards-grid { grid-template-columns: 1fr; }
    .vault-toolbar { flex-direction: column; align-items: stretch; }
    .vault-toolbar-right { justify-content: space-between; }
    .vault-card-number { font-size: 1.02rem; }
}



