        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        
        * {
            font-family: 'Inter', sans-serif;
            box-sizing: border-box;
        }

        :root {
            --theme-text: #f1f5f9;
            --theme-text-muted: rgba(255,255,255,0.65);
            --theme-widget-bg: rgba(255,255,255,0.08);
            --theme-widget-border: rgba(255,255,255,0.18);
            --theme-widget-border-hover: rgba(255,255,255,0.3);
            --theme-shadow: rgba(0,0,0,0.35);
            --theme-shadow-hover: rgba(0,0,0,0.5);
            --theme-corner-bg: rgba(15,23,42,0.88);
            --theme-corner-color: rgba(255,255,255,0.95);
            --theme-content-color: rgba(255,255,255,0.95);
            --theme-overlay: rgba(255,255,255,0.06);
            --theme-overlay-strong: rgba(255,255,255,0.12);
            --theme-resize-handle: rgba(255,255,255,0.35);
            --theme-resize-handle-hover: rgba(99,102,241,0.8);
            --theme-scrollbar-track: rgba(255,255,255,0.06);
            --theme-scrollbar-thumb: rgba(255,255,255,0.25);
            --theme-modal-card-bg: rgba(255,255,255,0.08);
            --theme-modal-card-border: rgba(255,255,255,0.18);
            --theme-modal-card-border-hover: rgba(99,102,241,0.6);
            --theme-modal-card-shadow: 0 4px 20px rgba(0,0,0,0.25);
        }
        
        body {
            background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
            min-height: 100vh;
            overflow-x: hidden;
        }
        
        .grid-canvas {
            position: relative;
            width: 100%;
            min-height: 100vh;
            padding: 20px;
        }

        /* FAB widget (draggable on canvas) */
        .fab-widget-btn {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: rgba(99, 102, 241, 0.85);
            backdrop-filter: blur(8px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            font-size: 20px;
            cursor: move;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
            transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
        }

        .fab-widget-btn:hover {
            background: rgba(99, 102, 241, 1);
            box-shadow: 0 10px 30px rgba(99, 102, 241, 0.65);
        }

        /* Compartir lista de tareas (dentro del módulo Tareas) */
        .tasks-share-wrap {
            position: relative;
        }
        .tasks-share-panel {
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 4px;
            background: rgba(15, 23, 42, 0.98);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            padding: 6px 0;
            min-width: 180px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
            z-index: 20;
        }
        .tasks-share-panel[hidden] {
            display: none !important;
        }
        .tasks-share-panel-item {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 8px 14px;
            border: none;
            background: none;
            color: #e2e8f0;
            font-size: 13px;
            text-align: left;
            cursor: pointer;
            transition: background 0.15s;
        }
        .tasks-share-panel-item:hover {
            background: rgba(255, 255, 255, 0.08);
        }
        .tasks-share-panel-item i {
            width: 18px;
            text-align: center;
        }
        .tasks-share-panel-item .fa-whatsapp {
            color: #25d366;
        }

        /* Fondo personalizable vía JS */
        .bg-option {
            flex-shrink: 0;
        }

        .bg-option.selected {
            outline: 2px solid white;
            outline-offset: 2px;
            transform: scale(1.15);
        }
        
        .widget {
            position: absolute;
            background: var(--theme-widget-bg);
            backdrop-filter: blur(10px);
            border: 1px solid var(--theme-widget-border);
            border-radius: 16px;
            overflow: hidden;
            transition: box-shadow 0.3s, transform 0.1s;
            user-select: none;
            container-type: size;
        }
        
        .widget:hover {
            box-shadow: 0 20px 40px var(--theme-shadow-hover);
            border-color: var(--theme-widget-border-hover);
        }
        
        .widget {
            cursor: grab;
        }
        .widget .notes-widget-wrap {
            cursor: text;
        }
        .widget .notes-widget-wrap .notes-fmt-btn,
        .widget .notes-widget-wrap .notes-toolbar-btn,
        .widget .notes-widget-wrap .notes-toolbar button {
            cursor: pointer;
        }

        .widget.dragging {
            opacity: 0.8;
            z-index: 1000 !important;
            cursor: grabbing;
            box-shadow: 0 25px 50px var(--theme-shadow-hover);
        }
        
        .widget.resizing {
            z-index: 1000 !important;
        }
        
        /* ── Corner control buttons ─────────────────────────────────────────── */
        .corner-btn {
            position: absolute;
            width: 26px;
            height: 26px;
            border-radius: 8px;
            border: none;
            background: var(--theme-corner-bg);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            color: var(--theme-corner-color);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            z-index: 11;
            opacity: 0;
            transition: opacity 0.15s ease, background 0.15s;
            pointer-events: none;
        }

        .widget:hover:not(.dragging):not(.resizing) .corner-btn {
            opacity: 1;
            pointer-events: auto;
        }

        .corner-tl { top: 0; left: 0;  border-radius: 0 0 8px 0; }
        .corner-tr { top: 0; right: 0; border-radius: 0 0 0 8px; }
        .corner-bl { bottom: 0; left: 0; border-radius: 0 8px 0 0; }

        .corner-btn:hover            { transform: scale(1.1) !important; }
        .corner-btn.delete-btn:hover  { background: rgba(239, 68, 68, 0.85); }
        .corner-btn.settings-btn:hover { background: rgba(99, 102, 241, 0.85); }
        .corner-btn.refresh-btn:hover  { background: rgba(34, 197, 94, 0.75); }
        .corner-btn.sol-reset-btn:hover { background: rgba(34, 197, 94, 0.75); }

        .widget-content {
            height: 100%;
            overflow: hidden;
            padding: 16px;
            position: relative;
            transform-origin: center center;
            color: var(--theme-content-color);
        }
        .widget-content:has(> .clock-widget) {
            display: flex;
            flex-direction: column;
            min-height: 0;
        }
        .widget-content:has(.notes-widget-wrap) {
            padding-top: 38px;
        }
        .notes-editor:empty::before {
            content: attr(data-placeholder);
            color: var(--theme-text-muted, #64748b);
        }
        
        .resize-handle {
            position: absolute;
            bottom: 0;
            right: 0;
            width: 20px;
            height: 20px;
            cursor: se-resize;
            background: linear-gradient(135deg, transparent 50%, var(--theme-resize-handle) 50%);
            border-radius: 0 0 16px 0;
            opacity: 0;
            transition: opacity 0.2s;
        }
        
        .widget:hover .resize-handle {
            opacity: 1;
        }
        
        .resize-handle:hover {
            background: linear-gradient(135deg, transparent 50%, var(--theme-resize-handle-hover) 50%);
        }
        
        
        .settings-panel {
            position: fixed;
            right: -400px;
            top: 0;
            width: 400px;
            height: 100vh;
            background: rgba(15, 23, 42, 0.98);
            backdrop-filter: blur(20px);
            border-left: 1px solid rgba(255,255,255,0.1);
            z-index: 99998;
            transition: right 0.3s ease;
            overflow-y: auto;
            padding: 24px;
        }
        
        .settings-panel.open {
            right: 0;
        }
        
        .settings-overlay {
            position: fixed;
            inset: 0;
            background: transparent;
            z-index: 99997;
            pointer-events: none;
        }

        .settings-overlay.open {
            pointer-events: auto;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 500;
            color: rgba(255,255,255,0.8);
        }
        
        .form-input, .form-select, .form-textarea {
            width: 100%;
            padding: 10px 12px;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 8px;
            color: white;
            font-size: 14px;
            outline: none;
            transition: all 0.2s;
        }

        /* Opciones de select: fondo oscuro para que el texto sea legible */
        select option,
        .form-select option,
        .lang-select option,
        .rte-select option {
            background-color: #1e293b;
            color: #f1f5f9;
        }
        
        .form-textarea {
            resize: vertical;
            min-height: 100px;
        }
        
        .form-input:focus, .form-select:focus, .form-textarea:focus {
            border-color: rgba(99, 102, 241, 0.8);
            background: rgba(255,255,255,0.08);
        }

        /* En fondos claros, usar esquema oscuro para formularios (más contraste) */
        body.light-bg .form-label {
            color: #1f2933;
        }

        body.light-bg .form-input,
        body.light-bg .form-select,
        body.light-bg .form-textarea {
            background: rgba(255,255,255,0.9);
            border-color: rgba(15,23,42,0.12);
            color: #111827;
        }

        body.light-bg .form-input::placeholder,
        body.light-bg .form-textarea::placeholder {
            color: #9ca3af;
        }

        body.light-bg .form-input:focus,
        body.light-bg .form-select:focus,
        body.light-bg .form-textarea:focus {
            border-color: rgba(79,70,229,0.85);
            background: rgba(255,255,255,1);
        }
        
        .color-picker {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        .color-option {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: transform 0.2s;
        }
        
        .color-option:hover {
            transform: scale(1.1);
        }
        
        .color-option.selected {
            border-color: white;
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.8);
        }
        
        @keyframes slideIn {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }

        @keyframes shake {
            0%,  100% { transform: translateX(0) rotate(0); }
            15%        { transform: translateX(-10px) rotate(-2deg); }
            30%        { transform: translateX(10px)  rotate(2deg); }
            45%        { transform: translateX(-7px)  rotate(-1.5deg); }
            60%        { transform: translateX(7px)   rotate(1.5deg); }
            75%        { transform: translateX(-4px)  rotate(-0.5deg); }
            90%        { transform: translateX(4px)   rotate(0.5deg); }
        }

        .widget {
            animation: slideIn 0.3s ease;
        }

        .widget.collision-shake {
            animation: shake 0.45s ease-in-out;
            border-color: rgba(239, 68, 68, 0.7) !important;
            box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4), 0 10px 30px rgba(239, 68, 68, 0.3) !important;
        }

        .widget.snapping {
            transition: left 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                        top  0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
        }
        
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        
        ::-webkit-scrollbar-track {
            background: var(--theme-scrollbar-track);
        }
        
        ::-webkit-scrollbar-thumb {
            background: var(--theme-scrollbar-thumb);
            border-radius: 4px;
        }
        
        .countdown-number {
            font-variant-numeric: tabular-nums;
            font-weight: 700;
        }
        
        .pomodoro-inner .pomodoro-time {
            font-size: clamp(1rem, 28cqh, 8rem);
            font-variant-numeric: tabular-nums;
        }
        .pomodoro-inner .pomodoro-buttons {
            gap: clamp(6px, 2cqh, 14px);
        }
        .pomodoro-inner .pomodoro-buttons button {
            font-size: clamp(0.65rem, 4cqh, 1.1rem);
            padding: clamp(6px, 3cqh, 14px) clamp(12px, 5cqw, 24px);
        }
        .pomodoro-inner .pomodoro-reset {
            font-size: clamp(0.65rem, 3.5cqh, 1rem);
            padding: clamp(6px, 2.5cqh, 12px) clamp(10px, 3.5cqw, 16px);
        }
        
        .countdown-widget-inner .countdown-number {
            font-size: clamp(1.25rem, 12cqh, 2.5rem);
        }
        .countdown-widget-inner .countdown-label {
            font-size: clamp(0.75rem, 4.5cqh, 1rem);
        }
        .countdown-widget-inner .countdown-event {
            font-size: clamp(0.8rem, 4cqh, 0.95rem);
            font-weight: 600;
            opacity: 0.9;
        }
        .countdown-widget-inner .countdown-date {
            font-size: clamp(0.8rem, 3.5cqh, 0.9375rem);
            opacity: 0.8;
            border-top: 1px solid rgba(255,255,255,0.12);
        }
        
        /* Compacto solo por debajo del máximo: ocultar evento y fecha; a 120px (máx) se ven nombre y fecha */
        @container (max-height: 100px) {
            .countdown-widget-inner {
                padding: 4px 8px;
                gap: 0;
            }
            .countdown-widget-inner .countdown-event,
            .countdown-widget-inner .countdown-date {
                display: none;
            }
            .countdown-widget-inner .countdown-number {
                font-size: clamp(1.1rem, 14cqh, 1.6rem);
            }
            .countdown-widget-inner .countdown-label {
                font-size: clamp(0.6rem, 5cqh, 0.8rem);
            }
            .countdown-widget-inner .countdown-cell {
                padding: 4px 6px;
            }
            .countdown-widget-inner .countdown-grid {
                gap: 6px;
                flex: 1;
            }
        }
        
        .stock-up { color: #10b981; }
        .stock-down { color: #ef4444; }
        
        #modal-inner {
            background: var(--modal-tint, rgb(15, 23, 42));
            transition: background 0.4s ease;
            color: var(--modal-text, #f1f5f9);
        }

        .modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(10px);
            z-index: 99999;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        .modal.active {
            display: flex;
        }
        
        .widget-type-card {
            background: var(--modal-card-bg, rgba(240, 240, 241, 0.8));
            border: 1px solid var(--modal-card-border, #e0e0e0);
            border-radius: 12px;
            color: var(--modal-card-text, #1e293b);
            padding: 20px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }

        .widget-type-card h3 {
            color: var(--modal-card-text, #1e293b);
        }

        .widget-type-card p {
            color: var(--modal-card-text, #1e293b);
            opacity: 0.9;
        }
        
        .widget-type-card:hover {
            filter: brightness(1.08);
            border-color: rgba(99,102,241,0.5);
            transform: translateY(-4px);
            box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        }

        /* Clima: prioridad por altura — lo visible siempre entero, sin cortes */
        .weather-widget {
            display: flex;
            flex-direction: column;
            min-height: 0;
        }
        .weather-widget .weather-current {
            flex: 1 1 0;
            min-height: 0;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            padding-bottom: 4px;
        }
        .weather-widget .weather-details,
        .weather-widget .weather-forecast {
            flex: 0 0 auto;
        }
        /* Ocultar por altura: solo clima actual */
        .weather-widget .weather-details,
        .weather-widget .weather-forecast {
            display: none !important;
        }
        @container (min-height: 141px) {
            .weather-widget .weather-details { display: grid !important; }
        }
        @container (min-height: 201px) {
            .weather-widget .weather-forecast { display: grid !important; }
        }
        /* Escala tipográfica según alto del contenedor (info lo más grande posible) */
        .weather-widget .weather-temp {
            font-size: clamp(1.125rem, 11cqh, 1.875rem);
        }
        .weather-widget .weather-icon {
            font-size: clamp(1.5rem, 14cqh, 2.25rem);
        }
        .weather-widget .weather-city {
            font-size: clamp(0.7rem, 4.5cqh, 0.875rem);
        }
        .weather-widget .weather-desc,
        .weather-widget .weather-feel {
            font-size: clamp(0.65rem, 3.5cqh, 0.75rem);
        }
        .weather-widget .weather-details,
        .weather-widget .weather-forecast {
            font-size: clamp(0.65rem, 3.5cqh, 0.75rem);
        }

        /* Reloj mundial: mínimo 180×60; filas que caben se reparten el alto, sin scroll */
        .clock-widget {
            display: flex;
            flex-direction: column;
            min-height: 0;
        }
        .clock-widget-list {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-height: 0;
            gap: 6px;
            box-sizing: border-box;
        }
        .clock-widget .clock-row {
            flex: 1 1 0;
            min-height: 0;
        }

        /* Por defecto solo se muestra la primera fila */
        .clock-widget .clock-row { display: none; }
        .clock-widget .clock-row:nth-child(1) { display: flex !important; }
        .clock-widget .clock-left {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        /* Modo compacto (altura ≤ ~95px): solo ciudad y horario, sin UTC ni scroll */
        @container (max-height: 95px) {
            .clock-widget { padding-bottom: 0; }
            .clock-widget .clock-row:nth-child(n+2) { display: none !important; }
            .clock-widget .clock-widget-list {
                overflow: visible !important;
                padding-bottom: 6px;
            }
            .clock-widget .clock-row:nth-child(1) {
                margin-bottom: 0;
                display: flex !important;
                align-items: center;
                padding-top: 4px;
                padding-bottom: 4px;
                gap: 8px;
            }
            .clock-widget .clock-row:nth-child(1) .clock-left {
                display: flex;
                flex-direction: row;
                align-items: center;
                min-width: 0;
            }
            .clock-widget .clock-row:nth-child(1) .clock-city {
                font-size: 0.875rem;
                min-width: 0;
            }
            .clock-widget .clock-row:nth-child(1) .clock-time {
                font-size: 0.9375rem;
                flex-shrink: 0;
            }
        }

        /* A partir de ~104px: 2 filas; cada fila reparte el alto */
        @container (min-height: 104px) {
            .clock-widget .clock-row:nth-child(2) { display: flex !important; }
        }
        @container (min-height: 148px) {
            .clock-widget .clock-row:nth-child(3) { display: flex !important; }
        }
        @container (min-height: 192px) {
            .clock-widget .clock-row:nth-child(4) { display: flex !important; }
        }
        @container (min-height: 236px) {
            .clock-widget .clock-row:nth-child(5) { display: flex !important; }
        }
        @container (min-height: 280px) {
            .clock-widget .clock-row:nth-child(6) { display: flex !important; }
        }
        @container (min-height: 324px) {
            .clock-widget .clock-row:nth-child(7) { display: flex !important; }
        }
        @container (min-height: 368px) {
            .clock-widget .clock-row:nth-child(8) { display: flex !important; }
        }
        @container (min-height: 412px) {
            .clock-widget .clock-row:nth-child(9) { display: flex !important; }
        }
        @container (min-height: 456px) {
            .clock-widget .clock-row:nth-child(10) { display: flex !important; }
        }

        /* Calculator styles */
        .calc-btn {
            background: rgba(255,255,255,0.1);
            border: none;
            color: white;
            font-size: 18px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .calc-btn:hover {
            background: rgba(255,255,255,0.2);
        }
        
        .calc-btn.operator {
            background: rgba(99, 102, 241, 0.3);
        }
        
        .calc-btn.operator:hover {
            background: rgba(99, 102, 241, 0.5);
        }
        
        .calc-btn.equals {
            background: rgba(16, 185, 129, 0.3);
            grid-column: span 2;
        }
        
        .calc-btn.equals:hover {
            background: rgba(16, 185, 129, 0.5);
        }

        .calc-btn-sci {
            font-size: 13px;
            padding: 6px 4px;
        }

        /* News widget */
        .news-item {
            border-left: 3px solid transparent;
            transition: all 0.2s;
        }
        
        .news-item:hover {
            border-left-color: rgba(99, 102, 241, 0.8);
            background: rgba(255,255,255,0.03);
        }

        /* Image widget */
        .image-widget-container {
            position: relative;
            overflow: hidden;
        }
        
        .image-widget-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s;
        }
        
        .image-widget-container:hover img {
            transform: scale(1.05);
        }

        /* Rich text editor */
        .rich-text-toolbar {
            display: flex;
            gap: 4px;
            padding: 4px;
            background: rgba(255,255,255,0.05);
            border-radius: 6px;
            margin-bottom: 8px;
            flex-wrap: wrap;
        }
        
        .rte-btn {
            width: 28px;
            height: 28px;
            border: none;
            background: transparent;
            color: rgba(255,255,255,0.7);
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }
        
        .rte-btn:hover, .rte-btn.active {
            background: rgba(255,255,255,0.1);
            color: white;
        }
        
        .rte-select {
            background: rgba(255,255,255,0.1);
            border: none;
            color: white;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 12px;
        }

        [contenteditable]:empty:before {
            content: attr(placeholder);
            color: rgba(255,255,255,0.4);
        }

        /* Music widget */
        .music-progress {
            height: 4px;
            background: rgba(255,255,255,0.1);
            border-radius: 2px;
            overflow: hidden;
            cursor: pointer;
        }
        
        .music-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #ec4899, #8b5cf6);
            width: 0%;
            transition: width 0.1s;
        }

        /* Quote widget */
        .quote-text {
            font-style: italic;
            line-height: 1.6;
        }
        
        .quote-author {
            text-align: right;
            margin-top: 1rem;
            opacity: 0.8;
        }

        /* System monitor */
        .monitor-bar {
            height: 8px;
            background: rgba(255,255,255,0.1);
            border-radius: 4px;
            overflow: hidden;
        }
        
        .monitor-fill {
            height: 100%;
            border-radius: 4px;
            transition: width 0.5s ease;
        }

        /* Bookmarks */
        .bookmark-icon-wrap {
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }
        .bookmark-icon-wrap .bookmark-favicon {
            width: 100%;
            height: 100%;
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }
        .bookmark-item {
            transition: all 0.2s;
        }
        
        .bookmark-item:hover {
            transform: translateX(4px);
            background: rgba(255,255,255,0.05);
        }

        /* Translator */
        .lang-select {
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            color: white;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: 12px;
        }

        /* Password generator */
        .password-display {
            font-family: 'Courier New', monospace;
            letter-spacing: 2px;
        }

        /* Color picker widget */
        .color-preview {
            width: 100%;
            height: 100px;
            border-radius: 8px;
            margin-bottom: 12px;
            border: 2px solid rgba(255,255,255,0.2);
        }
        
        .slider {
            -webkit-appearance: none;
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: rgba(255,255,255,0.1);
            outline: none;
        }
        
        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: white;
            cursor: pointer;
        }

        /* ── Autocomplete ────────────────────────────────────────────────── */
        .ac-wrapper {
            position: relative;
        }

        .ac-list {
            position: absolute;
            top: calc(100% + 4px);
            left: 0;
            right: 0;
            background: #1e293b;
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 8px;
            z-index: 100;
            max-height: 200px;
            overflow-y: auto;
            box-shadow: 0 8px 24px rgba(0,0,0,0.5);
        }

        .ac-item {
            padding: 8px 12px;
            cursor: pointer;
            font-size: 13px;
            color: #f1f5f9;
            transition: background 0.12s;
        }

        .ac-item:hover {
            background: rgba(99, 102, 241, 0.35);
        }

        /* Cuando el widget tiene fondo/fuente personalizado, el texto neutro hereda el color de contraste */
        #canvas .widget-content.widget-text-contrast .text-white,
        #canvas .widget-content.widget-text-contrast .text-gray-100,
        #canvas .widget-content.widget-text-contrast .text-gray-200,
        #canvas .widget-content.widget-text-contrast .text-gray-300,
        #canvas .widget-content.widget-text-contrast .text-gray-400,
        #canvas .widget-content.widget-text-contrast .text-gray-500 {
            color: inherit !important;
        }

        /* ── Tema claro: variables ya aplicadas por JS; solo overrides dentro del canvas ── */
        body.light-bg {
            color: var(--theme-text);
        }

        body.light-bg .corner-btn {
            background: var(--theme-corner-bg);
            color: var(--theme-corner-color);
        }

        body.light-bg .widget-content {
            color: var(--theme-content-color);
        }

        /* Clases de texto dentro de widgets (Tailwind) — contraste según tema */
        body.light-bg #canvas .text-white    { color: var(--theme-text) !important; }
        body.light-bg #canvas .text-gray-100 { color: var(--theme-text) !important; }
        body.light-bg #canvas .text-gray-200 { color: var(--theme-text) !important; }
        body.light-bg #canvas .text-gray-300 { color: var(--theme-text) !important; }
        body.light-bg #canvas .text-gray-400 { color: var(--theme-text-muted) !important; }
        body.light-bg #canvas .text-gray-500 { color: var(--theme-text-muted) !important; }
        body.light-bg #canvas .countdown-number { color: var(--theme-text); }

        /* Modal: texto y bordes */
        body.light-bg #add-modal .text-white    { color: var(--modal-text) !important; }
        body.light-bg #add-modal .text-gray-400 { color: var(--modal-text) !important; opacity: 0.7; }
        body.light-bg #add-modal .text-gray-500 { color: var(--modal-text) !important; opacity: 0.7; }
        body.light-bg #add-modal h2,
        body.light-bg #add-modal > div > h3     { color: var(--modal-text) !important; }

        /* Contenedor del módulo: solo #f0f0f1 o #373737; texto según ese fondo */
        #add-modal .widget-type-card,
        #add-modal .widget-type-card h3,
        #add-modal .widget-type-card p {
            color: var(--modal-card-text, #1e293b) !important;
        }
        #add-modal .widget-type-card p,
        #add-modal .widget-type-card p.text-gray-400,
        #add-modal .widget-type-card .text-gray-400 {
            color: var(--modal-card-text, #1e293b) !important;
            opacity: 0.9 !important;
        }

        /* Superficies semitransparentes: bg-white/* → versión oscura */
        body.light-bg #canvas .bg-white\/5,
        body.light-bg #add-modal .bg-white\/5     { background-color: rgba(0,0,0,0.04) !important; }
        body.light-bg #canvas .bg-white\/10,
        body.light-bg #add-modal .bg-white\/10    { background-color: rgba(0,0,0,0.06) !important; }
        body.light-bg #canvas .bg-white\/20,
        body.light-bg #add-modal .bg-white\/20    { background-color: rgba(0,0,0,0.08) !important; }
        body.light-bg .bg-white\/\[0\.02\]        { background-color: rgba(0,0,0,0.02) !important; }

        /* Hover sobre superficies blancas */
        body.light-bg #canvas .hover\:bg-white\/5:hover,
        body.light-bg #add-modal .hover\:bg-white\/5:hover  { background-color: rgba(0,0,0,0.06) !important; }
        body.light-bg #canvas .hover\:bg-white\/10:hover,
        body.light-bg #add-modal .hover\:bg-white\/10:hover { background-color: rgba(0,0,0,0.08) !important; }
        body.light-bg #canvas .hover\:bg-white\/20:hover,
        body.light-bg #add-modal .hover\:bg-white\/20:hover { background-color: rgba(0,0,0,0.10) !important; }

        /* Bordes blancos → oscuros */
        body.light-bg #canvas .border-white\/10,
        body.light-bg #add-modal .border-white\/10,
        body.light-bg .settings-panel .border-white\/10 { border-color: rgba(0,0,0,0.10) !important; }
        body.light-bg #canvas .border-white\/15,
        body.light-bg #add-modal .border-white\/15,
        body.light-bg .settings-panel .border-white\/15 { border-color: rgba(0,0,0,0.12) !important; }
        body.light-bg #canvas .border-white\/20,
        body.light-bg #add-modal .border-white\/20       { border-color: rgba(0,0,0,0.15) !important; }
        body.light-bg #modal-inner                        { border-color: rgba(0,0,0,0.12) !important; }

        /* Separador w-px bg-white/15 */
        body.light-bg #add-modal .bg-white\/15            { background-color: rgba(0,0,0,0.10) !important; }

        /* Buscador del modal */
        body.light-bg #widget-search {
            background: rgba(255,255,255,0.8) !important;
            border-color: rgba(0,0,0,0.12) !important;
            color: #1e293b !important;
        }
        body.light-bg #widget-search::placeholder { color: #94a3b8 !important; }

        /* Calculadora */
        body.light-bg .calc-btn {
            background: rgba(0,0,0,0.06) !important;
            color: #1e293b !important;
            border: 1px solid rgba(0,0,0,0.08);
        }
        body.light-bg .calc-btn:hover { background: rgba(0,0,0,0.10) !important; }
        body.light-bg .calc-btn.operator {
            background: rgba(99,102,241,0.15) !important;
            color: #4338ca !important;
        }
        body.light-bg .calc-btn.operator:hover { background: rgba(99,102,241,0.25) !important; }
        body.light-bg .calc-btn.equals {
            background: rgba(16,185,129,0.15) !important;
            color: #047857 !important;
        }
        body.light-bg .calc-btn.equals:hover { background: rgba(16,185,129,0.25) !important; }

        /* Editor de texto rico */
        body.light-bg .rich-text-toolbar { background: rgba(0,0,0,0.04) !important; }
        body.light-bg .rte-btn { color: #475569 !important; }
        body.light-bg .rte-btn:hover, body.light-bg .rte-btn.active { background: rgba(0,0,0,0.08) !important; color: #1e293b !important; }
        body.light-bg .rte-select { background: rgba(0,0,0,0.06) !important; color: #1e293b !important; }

        /* Settings panel */
        body.light-bg .settings-panel {
            background: rgba(255,255,255,0.96) !important;
            border-left-color: rgba(0,0,0,0.1) !important;
            color: #1e293b;
        }
        body.light-bg .settings-panel .border-t { border-color: rgba(0,0,0,0.1) !important; }
        body.light-bg .settings-panel h2 { color: #1e293b !important; }

        /* Placeholder dentro de contenteditable */
        body.light-bg [contenteditable]:empty:before { color: rgba(0,0,0,0.35) !important; }

        /* Música / progreso */
        body.light-bg .music-progress { background: rgba(0,0,0,0.08) !important; }

        /* Botones hover en widgets (delete, settings, refresh) */
        body.light-bg .corner-btn.delete-btn:hover  { background: rgba(239, 68, 68, 0.8);   color: white; }
        body.light-bg .corner-btn.settings-btn:hover { background: rgba(99, 102, 241, 0.8);  color: white; }
        body.light-bg .corner-btn.refresh-btn:hover  { background: rgba(34, 197, 94, 0.75);  color: white; }
        body.light-bg .corner-btn.sol-reset-btn:hover { background: rgba(34, 197, 94, 0.75);  color: white; }

        body.light-bg .resize-handle {
            background: linear-gradient(135deg, transparent 50%, var(--theme-resize-handle) 50%);
        }

        body.light-bg ::-webkit-scrollbar-track { background: var(--theme-scrollbar-track); }
        body.light-bg ::-webkit-scrollbar-thumb { background: var(--theme-scrollbar-thumb); }

        /* News item */
        body.light-bg .news-item:hover { background: rgba(0,0,0,0.03) !important; }
        /* ────────────────────────────────────────────────────────────────── */

        /* Solitaire */
        .sol-card {
            position: relative;
            width: 28px;
            min-height: 40px;
            border-radius: 6px;
            background: linear-gradient(160deg, #fefefe 0%, #f1f5f9 50%, #e2e8f0 100%);
            border: 1px solid rgba(0,0,0,0.12);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 11px;
            cursor: pointer;
            flex-shrink: 0;
            box-shadow: 0 1px 3px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.5) inset;
        }
        /* Número y palo en esquinas (todas las cartas + ghost al arrastrar) */
        .sol-card .sol-corner {
            position: absolute;
            line-height: 1.1;
            font-weight: 700;
        }
        .sol-card .sol-tl { top: 3px; left: 4px; }
        .sol-card .sol-br { bottom: 3px; right: 4px; transform: rotate(180deg); }
        /* Dorso de carta: patrón clásico */
        .sol-card.sol-facedown {
            background: linear-gradient(145deg, #1e3a8a 0%, #1e40af 40%, #2563eb 100%);
            border-color: rgba(0,0,0,0.25);
            box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
        }
        .sol-card.sol-facedown .sol-back {
            display: block;
            position: absolute;
            inset: 4px;
            border-radius: 4px;
            background: repeating-linear-gradient(
                45deg,
                transparent,
                transparent 3px,
                rgba(255,255,255,0.06) 3px,
                rgba(255,255,255,0.06) 4px
            ), repeating-linear-gradient(
                -45deg,
                transparent,
                transparent 3px,
                rgba(255,255,255,0.06) 3px,
                rgba(255,255,255,0.06) 4px
            );
        }
        .sol-card.sol-red-true { color: #b91c1c; }
        .sol-card.sol-red-false { color: #0f172a; }
        .sol-placeholder { cursor: pointer; }
        .sol-selected { outline: 2px solid #eab308; outline-offset: 2px; box-shadow: 0 0 0 1px rgba(234,179,8,0.5); }
        .sol-drag-ghost { cursor: grabbing !important; filter: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
