/* ==========================================
           VARIABLES & RESET
        ========================================== */
        :root {
            --bg-color: #F5F4F1;
            --card-color: #FFFFFF;
            --text-main: #222222;
            --text-secondary: #707070;
            
            /* Status Colors */
            --color-banana: #FFC936; /* Reservada */
            --color-green: #5FA96E;  /* Disponible */
            --color-red: #C95C5C;    /* Ocupada */
            --color-blue: #6E9EB8;   /* Limpieza / Esperando */
            --color-terra: #C97B63;  /* Cuenta */

            --shadow-sm: 0 4px 12px rgba(0,0,0,0.03);
            --shadow-md: 0 8px 24px rgba(0,0,0,0.05);
            --shadow-float: 0 20px 40px rgba(0,0,0,0.08);
            
            --border-radius: 16px;
            --border-radius-sm: 10px;
            --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        body {
            font-family: 'Inter', sans-serif;
            background-color: var(--bg-color);
            color: var(--text-main);
            overflow: hidden;
            user-select: none;
            -webkit-font-smoothing: antialiased;
        }

        h1, h2, h3, h4, .brand-font { font-family: 'Outfit', sans-serif; }

        /* ==========================================
           PRELOADER CINEMATOGRÁFICO
        ========================================== */
        #preloader {
            position: fixed;
            top: 0; left: 0; width: 100vw; height: 100vh;
            background: #050505;
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            transition: opacity 1.5s ease-in-out, background 1.5s ease;
        }

        /* SCENE 1: The Dot */
        .intro-dot {
            width: 4px; height: 4px;
            background: var(--color-banana);
            border-radius: 50%;
            box-shadow: 0 0 10px var(--color-banana), 0 0 20px var(--color-banana);
            opacity: 0;
            transition: all 0.5s ease;
        }
        .scene-1 .intro-dot { opacity: 1; animation: pulse-dot 1s infinite alternate; }
        @keyframes pulse-dot { from { transform: scale(1); opacity: 0.8; } to { transform: scale(1.5); opacity: 1; } }

        /* SCENE 2 & 3: Circuits & Banana */
        .intro-circuits {
            position: absolute;
            width: 200px; height: 200px;
            opacity: 0;
            transition: opacity 1s ease;
        }
        .scene-2 .intro-circuits { opacity: 1; }
        .scene-2 .intro-dot { opacity: 0; }
        
        .circuit-line {
            fill: none;
            stroke: #333;
            stroke-width: 1;
            stroke-dasharray: 1000;
            stroke-dashoffset: 1000;
        }
        .scene-2 .circuit-line { animation: draw-line 2s forwards cubic-bezier(0.4, 0, 0.2, 1); }
        
        .banana-path {
            fill: none;
            stroke: var(--color-banana);
            stroke-width: 2.5;
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-dasharray: 500;
            stroke-dashoffset: 500;
            filter: drop-shadow(0 0 8px rgba(255, 201, 54, 0.6));
        }
        .scene-3 .banana-path { animation: draw-line 1.5s forwards ease-in-out; }
        
        @keyframes draw-line { to { stroke-dashoffset: 0; } }

        /* SCENE 4: Terminal & Scanner */
        .intro-terminal {
            position: absolute;
            top: 60%;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Courier New', monospace;
            font-size: 12px;
            color: var(--color-green);
            text-align: center;
            opacity: 0;
            height: 60px;
            width: 300px;
        }
        .scene-4 .intro-terminal { opacity: 1; }
        
        .scanner-line {
            position: absolute;
            width: 120px; height: 1px;
            background: var(--color-green);
            box-shadow: 0 0 10px var(--color-green);
            top: -10px; left: 40px;
            opacity: 0;
        }
        .scene-4 .scanner-line {
            opacity: 1;
            animation: scan 2s linear forwards;
        }
        @keyframes scan {
            0% { top: -10px; opacity: 0; }
            10% { opacity: 1; }
            90% { opacity: 1; }
            100% { top: 210px; opacity: 0; }
        }

        /* SCENE 5 & 6: Typography, Radar & Modules */
        .intro-brand {
            position: absolute;
            display: flex;
            flex-direction: column;
            align-items: center;
            top: 55%;
            opacity: 0;
            transition: all 1s ease;
            text-align: center;
        }
        .scene-5 .intro-brand { opacity: 1; top: 60%; }
        .intro-brand h1 {
            color: #FFF; font-size: 2rem; font-weight: 700; letter-spacing: 4px;
            display: flex; gap: 10px;
        }
        .intro-brand p { color: var(--color-banana); font-size: 0.9rem; letter-spacing: 2px; margin-top: 5px; opacity: 0; transform: translateY(10px); transition: all 0.8s 0.5s ease;}
        .intro-brand span.sub { color: #555; font-size: 0.7rem; letter-spacing: 1px; margin-top: 5px; opacity: 0; transition: all 0.8s 1s ease;}
        .scene-5 .intro-brand p, .scene-5 .intro-brand span.sub { opacity: 1; transform: translateY(0); }

        .radar {
            position: absolute; width: 400px; height: 400px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.05);
            opacity: 0; transition: opacity 1s;
            z-index: -1;
        }
        .radar::after {
            content: ''; position: absolute; top: 50%; left: 50%;
            width: 50%; height: 2px; background: linear-gradient(90deg, transparent, rgba(95, 169, 110, 0.3));
            transform-origin: 0 50%; animation: spin 4s linear infinite;
        }
        @keyframes spin { 100% { transform: rotate(360deg); } }
        .scene-6 .radar { opacity: 1; }

        .modules-grid {
            position: absolute; top: 10%; right: 10%;
            display: flex; flex-direction: column; gap: 8px;
            color: #555; font-size: 0.75rem; font-family: monospace;
            opacity: 0; transition: opacity 1s;
        }
        .scene-6 .modules-grid { opacity: 1; }
        .module-item { display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateX(20px); transition: all 0.5s; }
        .module-item.online { opacity: 1; transform: translateX(0); color: #FFF; }
        .module-indicator { width: 6px; height: 6px; border-radius: 50%; background: #333; }
        .module-item.online .module-indicator { background: var(--color-green); box-shadow: 0 0 5px var(--color-green); }

        .counter { position: absolute; bottom: 10%; font-family: 'Outfit'; font-size: 3rem; color: #333; opacity: 0; font-weight: 300;}
        .scene-7 .counter { opacity: 1; color: #FFF; transition: color 2s; }

        /* SCENE 8: Chip Transform & App Transition */
        .chip-box {
            position: absolute;
            top: 50%; left: 50%;
            width: 60px; height: 60px;
            border: 2px solid var(--color-banana);
            border-radius: 8px;
            transform: translate(-50%, -50%) scale(0);
            opacity: 0;
            transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
        }
        .scene-8 .chip-box { opacity: 1; transform: translate(-50%, -50%) scale(1); animation: rotate-chip 1.5s forwards cubic-bezier(0.7, 0, 0.3, 1); }
        @keyframes rotate-chip { 100% { transform: translate(-50%, -50%) scale(0.6) rotate(90deg); } }
        
        .scene-8 .intro-brand, .scene-8 .modules-grid, .scene-8 .counter, .scene-8 .radar { opacity: 0 !important; filter: blur(10px); }
        .scene-8 .intro-circuits { transform: scale(0.6); }

        .app-reveal #preloader {
            background: transparent;
            pointer-events: none;
        }
        .app-reveal .intro-circuits, .app-reveal .chip-box {
            top: 24px; left: 24px;
            transform: translate(0, 0) scale(0.35) rotate(0deg) !important;
            margin-left: -50px; margin-top: -50px; /* offset for scale */
            transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* ==========================================
           MAIN DASHBOARD APP
        ========================================== */
        #app {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            display: grid;
            grid-template-columns: 80px 1fr;
            grid-template-rows: 70px 1fr;
            opacity: 0;
            transition: opacity 1s 0.5s ease;
        }
        .app-reveal #app { opacity: 1; }

        /* HEADER */
        header {
            grid-column: 1 / 3; grid-row: 1 / 2;
            background: rgba(255, 255, 255, 0.6);
            backdrop-filter: blur(20px);
            border-bottom: 1px solid rgba(0,0,0,0.05);
            display: flex; align-items: center; justify-content: space-between;
            padding: 0 40px 0 100px; /* Space for the animated logo */
            z-index: 100;
        }
        .header-brand { font-family: 'Outfit'; font-weight: 700; font-size: 1.2rem; letter-spacing: 1px; display: flex; align-items: center; gap: 8px;}
        .header-brand span { font-weight: 300; color: var(--text-secondary); font-size: 0.8rem; letter-spacing: 0; }
        
        .search-bar {
            display: flex; align-items: center; background: var(--card-color);
            padding: 8px 16px; border-radius: 20px; box-shadow: var(--shadow-sm);
            width: 300px; gap: 10px; border: 1px solid rgba(0,0,0,0.02);
            transition: var(--transition);
        }
        .search-bar:focus-within { box-shadow: var(--shadow-md); border-color: rgba(0,0,0,0.1); width: 350px;}
        .search-bar input { border: none; outline: none; background: transparent; width: 100%; font-family: 'Inter'; font-size: 0.9rem;}
        
        .header-right { display: flex; align-items: center; gap: 30px; font-size: 0.9rem; }
        .datetime { text-align: right; }
        .time { font-weight: 600; font-family: 'Outfit'; font-size: 1.1rem;}
        .date { color: var(--text-secondary); font-size: 0.75rem; }
        .user-profile { display: flex; align-items: center; gap: 12px; border-left: 1px solid rgba(0,0,0,0.1); padding-left: 30px; }
        .avatar { width: 36px; height: 36px; background: var(--color-blue); border-radius: 50%; color: #FFF; display: flex; align-items: center; justify-content: center; font-weight: 600;}
        .status-dot { width: 8px; height: 8px; background: var(--color-green); border-radius: 50%; box-shadow: 0 0 8px var(--color-green); animation: pulse-dot 2s infinite alternate;}

        /* SIDEBAR */
        sidebar {
            grid-column: 1 / 2; grid-row: 2 / 3;
            background: var(--card-color);
            border-right: 1px solid rgba(0,0,0,0.05);
            display: flex; flex-direction: column; align-items: center; padding: 30px 0;
            gap: 30px; z-index: 90;
        }
        .nav-item {
            color: var(--text-secondary); cursor: pointer; position: relative;
            transition: var(--transition); display: flex; justify-content: center; align-items: center;
            width: 44px; height: 44px; border-radius: 12px;
        }
        .nav-item:hover, .nav-item.active { color: var(--text-main); background: var(--bg-color); }
        .nav-item.active::before {
            content: ''; position: absolute; left: -16px; top: 12px;
            width: 4px; height: 20px; background: var(--color-banana); border-radius: 4px;
        }

        /* MAIN CONTENT GRID */
        main {
            grid-column: 2 / 3; grid-row: 2 / 3;
            /* Padding bottom para no quedar oculto por el menú flotante */
            padding: 30px 40px 100px 40px; 
            overflow-y: auto;
            overflow-x: hidden;
            display: flex; flex-direction: column; gap: 24px;
            height: 100%;
        }
        
        /* Dashboard Build Animations */
        .dash-element { opacity: 0; transform: translateY(20px); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
        .app-reveal .dash-element.show { opacity: 1; transform: translateY(0); }

        /* Top Stats */
        .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
        .stat-card {
            background: var(--card-color); padding: 20px; border-radius: 16px;
            box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
            position: relative; overflow: hidden;
        }
        .stat-card::after { content:''; position: absolute; top:0; right:0; width: 100px; height: 100px; background: radial-gradient(circle, rgba(0,0,0,0.02) 0%, transparent 70%); border-radius: 50%; transform: translate(30%, -30%);}
        .stat-title { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;}
        .stat-value { font-size: 2.2rem; font-family: 'Outfit'; font-weight: 600; color: var(--text-main); display: flex; align-items: baseline; gap: 8px;}
        .stat-trend { font-size: 0.8rem; font-weight: 500; color: var(--color-green); }

        /* Layout Grid */
        .content-grid {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 24px;
            /* Altura ajustada a dvh dinámica */
            height: auto;
            min-height: 500px;
        }

        /* FLOOR PLAN */
        .floor-plan-card {
            background: var(--card-color); border-radius: var(--border-radius);
            box-shadow: var(--shadow-sm); padding: 24px; display: flex; flex-direction: column;
            position: relative; 
            overflow: hidden; 
        }
        .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;}
        .card-title { font-family: 'Outfit'; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px;}
        
        .legend { display: flex; gap: 16px; font-size: 0.75rem; color: var(--text-secondary); flex-wrap: wrap;}
        .legend-item { display: flex; align-items: center; gap: 6px; }
        .l-dot { width: 8px; height: 8px; border-radius: 50%; }

        /* Contenedor del plano ajustado para hacer scroll horizontal en móviles */
        .svg-container { flex: 1; width: 100%; min-height: 400px; position: relative; background-image: radial-gradient(#e5e5e5 1px, transparent 1px); background-size: 20px 20px; border-radius: 12px; border: 1px solid rgba(0,0,0,0.03); overflow-x: hidden; overflow-y: hidden; -webkit-overflow-scrolling: touch;}
        #restaurant-svg { width: 100%; height: 100%; min-width: 600px;}
        
        /* SVG Table Styling */
        .table-group { 
            cursor: pointer; 
            transition: transform 0.2s ease; 
            transform-origin: center; 
            transform-box: fill-box; 
        }
        .table-group:hover { transform: scale(1.05); }
        .table-base { fill: #FFF; stroke-width: 2; transition: all 0.5s ease; }
        .chair { fill: #E0E0E0; transition: fill 0.5s ease; }
        .table-text { font-family: 'Outfit'; font-size: 14px; font-weight: 600; fill: var(--text-main); text-anchor: middle; dominant-baseline: central; pointer-events: none;}
        .time-ring { fill: none; stroke-width: 3; stroke-dasharray: 125.6; stroke-dashoffset: 125.6; transition: stroke-dashoffset 1s linear; stroke-linecap: round;}
        
        /* RIGHT PANELS */
        .right-panels { display: flex; flex-direction: column; gap: 24px;}
        
        .side-card { background: var(--card-color); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 20px; }
        
        /* AI Assistant */
        .ai-assistant { background: linear-gradient(135deg, #FFC936 0%, #F5B000 100%); color: #000; border: none; box-shadow: var(--shadow-md); position: relative; overflow: hidden;}
        .ai-assistant::before { content:''; position:absolute; width:150px; height:150px; background:rgba(255,255,255,0.2); border-radius:50%; top:-50px; right:-50px; filter:blur(20px);}
        .ai-header { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: 'Outfit'; font-size: 1.1rem; margin-bottom: 12px;}
        .ai-message { font-size: 0.9rem; line-height: 1.5; font-weight: 500; min-height: 60px;}
        .typing-cursor { display: inline-block; width: 4px; height: 14px; background: #000; animation: blink 1s infinite; margin-left: 4px; vertical-align: middle;}
        @keyframes blink { 50% { opacity: 0; } }

        /* Waitlist & Timeline Lists */
        .list-container { display: flex; flex-direction: column; gap: 12px; }
        .list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-color); border-radius: var(--border-radius-sm); transition: var(--transition); border: 1px solid transparent;}
        .list-item:hover { background: #FFF; box-shadow: var(--shadow-sm); border-color: rgba(0,0,0,0.05); transform: translateX(5px);}
        .list-item.glow { animation: list-glow 2s infinite alternate; }
        @keyframes list-glow { from { box-shadow: 0 0 0 rgba(95,169,110,0); border-color: transparent;} to { box-shadow: 0 0 15px rgba(95,169,110,0.3); border-color: var(--color-green);} }
        
        .item-main { display: flex; flex-direction: column; gap: 4px; }
        .item-name { font-weight: 600; font-size: 0.9rem; }
        .item-meta { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px;}
        .item-action button { background: var(--text-main); color: #FFF; border: none; padding: 6px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: var(--transition);}
        .item-action button:hover { background: var(--color-green); }

        .timeline-item { padding-left: 20px; position: relative; font-size: 0.85rem;}
        .timeline-item::before { content: ''; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--color-blue); }
        .timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 3px; top: 18px; width: 2px; height: calc(100% + 4px); background: rgba(0,0,0,0.05); }

        /* FLOATING TABLE TOOLTIP */
        #table-tooltip {
            position: fixed; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(16px);
            border: 1px solid rgba(255,255,255,0.4); border-radius: 12px; padding: 16px;
            box-shadow: var(--shadow-float); width: 220px; opacity: 0; 
            pointer-events: none !important;
            transition: opacity 0.3s; z-index: 9999; font-size: 0.85rem;
        }
        #table-tooltip.visible { opacity: 1; }
        .tt-header { display: flex; justify-content: space-between; font-family: 'Outfit'; font-weight: 600; font-size: 1.1rem; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 8px; margin-bottom: 8px;}
        .tt-row { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--text-secondary); }
        .tt-val { color: var(--text-main); font-weight: 500; }

        /* FLOATING CONTROLS */
        .floating-controls {
            position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
            display: flex; gap: 10px; background: rgba(255,255,255,0.8); backdrop-filter: blur(20px);
            padding: 8px; border-radius: 30px; box-shadow: var(--shadow-float); border: 1px solid rgba(0,0,0,0.05);
            z-index: 9999; opacity: 0; transition: opacity 1s 1s ease;
        }
        .app-reveal .floating-controls { opacity: 1; }
        .mode-btn {
            background: transparent; border: none; padding: 8px 20px; border-radius: 20px;
            font-family: 'Inter'; font-weight: 500; font-size: 0.85rem; color: var(--text-secondary);
            cursor: pointer; transition: var(--transition);
            white-space: nowrap;
        }
        .mode-btn.active { background: var(--text-main); color: #FFF; box-shadow: 0 4px 10px rgba(0,0,0,0.15);}

        /* ==========================================
           RESPONSIVE DESIGN (NUEVO)
        ========================================== */

        /* Tablets y Portátiles Pequeños */
        @media (max-width: 1024px) {
            .content-grid {
                grid-template-columns: 1fr; /* Apilar en una sola columna */
            }
            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        /* Teléfonos Móviles */
        @media (max-width: 768px) {
            /* Transformar el layout principal */
            #app {
                grid-template-columns: 1fr; /* 1 Sola columna */
                grid-template-rows: 60px 1fr 65px; /* Header, Contenido, Barra Inferior */
            }
            
            /* Header Adaptable */
            header {
                grid-column: 1 / 2;
                grid-row: 1 / 2;
                padding: 0 15px 0 65px; /* Espacio para el logo animado */
            }
            .header-brand { font-size: 1rem; }
            .header-brand span { display: none; } /* Ocultar texto secundario del header */
            .search-bar { display: none; } /* Ocultar barra de búsqueda en móvil */
            .header-right { gap: 10px; }
            .datetime { display: none; } /* Ocultar hora */
            .user-profile { padding-left: 0; border-left: none; }
            .user-profile > div:first-child { display: none; } /* Ocultar textos de perfil, dejar avatar */

            /* Barra Lateral -> Botton Nav (Barra inferior) */
            sidebar {
                grid-column: 1 / 2;
                grid-row: 3 / 4;
                flex-direction: row;
                border-right: none;
                border-top: 1px solid rgba(0,0,0,0.05);
                padding: 0 15px;
                justify-content: space-between;
                z-index: 100;
                box-shadow: 0 -4px 12px rgba(0,0,0,0.03);
            }
            .nav-item { width: auto; flex: 1; height: 100%; border-radius: 0; }
            .nav-item.active::before {
                top: 0; left: 50%; transform: translateX(-50%);
                width: 24px; height: 4px; /* Indicador arriba en vez de a la izquierda */
            }
            sidebar > div[style="flex-grow: 1;"] { display: none; } /* Quitar separador */

            /* Área Principal */
            main {
                grid-column: 1 / 2;
                grid-row: 2 / 3;
                padding: 15px 15px 90px 15px; /* Espacio extra abajo para controles flotantes */
            }

            /* Stats a 2 columnas */
            .stats-grid { gap: 10px; }
            .stat-card { padding: 15px; }
            .stat-title { font-size: 0.7rem; }
            .stat-value { font-size: 1.6rem; }

            /* Ajustes SVG para Mobile */
            .svg-container { min-height: 350px; overflow-x: auto; }
            /* Se mantiene el min-width: 600px del SVG original para que permita hacer scroll horizontal 
               y no se encoja la imagen volviéndose ilegible. */
            
            /* Controles flotantes encima del Bottom Nav */
            .floating-controls {
                bottom: 85px; 
                width: 90%;
                justify-content: center;
                flex-wrap: nowrap;
                overflow-x: auto; /* Por si añaden más botones */
                padding: 8px;
            }
            .mode-btn { padding: 6px 16px; font-size: 0.8rem; }

            /* Ajuste del Tooltip para Móvil (fijo abajo para no tapar con el dedo) */
            #table-tooltip {
                position: fixed;
                top: auto !important;
                bottom: 150px !important;
                left: 50% !important;
                transform: translateX(-50%) !important;
                z-index: 10000;
                box-shadow: 0 10px 30px rgba(0,0,0,0.15);
            }

            /* Preloader fix for Mobile */
            .intro-brand h1 { font-size: 1.6rem; }
            .radar { width: 300px; height: 300px; }
            .modules-grid { top: auto; bottom: 20%; right: 50%; transform: translateX(50%); align-items: center;}
            .counter { bottom: 5%; }
        }