:root {
            --bg-base: #0a0d14;
            --bg-panel: #131824;
            --bg-panel-light: #1c2331;
            --text-main: #ffffff;
            --text-muted: #8b9bb4;
            --steel-grey: #4a5568;
            --electric-blue: #00e5ff;
            --industrial-orange: #ff6d00;
            --turquoise: #1de9b6;
            --green-normal: #00e676;
            --red-alarm: #ff1744;
            --border-color: #2c3545;
            --font-ui: 'Rajdhani', sans-serif;
            --font-text: 'Roboto', sans-serif;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background-color: var(--bg-base);
            color: var(--text-main);
            font-family: var(--font-text);
            overflow-x: hidden;
        }

        /* --- LAYOUT GLOBAL --- */
        .app-container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            padding: 15px;
            gap: 15px;
        }

        .panel {
            background: var(--bg-panel);
            border: 1px solid var(--border-color);
            border-radius: 8px;
            padding: 20px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
            position: relative;
            overflow: hidden;
        }

        .panel::before {
            content: '';
            position: absolute;
            top: 0; left: 0; width: 100%; height: 2px;
            background: linear-gradient(90deg, transparent, var(--steel-grey), transparent);
            opacity: 0.3;
        }

        .panel-title {
            font-family: var(--font-ui);
            font-size: 1.2rem;
            font-weight: 600;
            letter-spacing: 1px;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        /* --- HEADER --- */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--bg-panel);
            padding: 15px 25px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            border-bottom: 2px solid var(--electric-blue);
        }

        .logo-area {
            display: flex;
            flex-direction: column;
        }

        .logo-title {
            font-family: var(--font-ui);
            font-size: 2rem;
            font-weight: 700;
            color: var(--text-main);
            letter-spacing: 2px;
            text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
        }

        .logo-subtitle {
            font-size: 0.75rem;
            color: var(--electric-blue);
            font-family: var(--font-ui);
            letter-spacing: 1.5px;
            text-transform: uppercase;
        }

        .header-info {
            display: flex;
            gap: 30px;
            align-items: center;
        }

        .status-badge {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(0, 230, 118, 0.1);
            border: 1px solid var(--green-normal);
            color: var(--green-normal);
            padding: 5px 12px;
            border-radius: 20px;
            font-family: var(--font-ui);
            font-weight: 600;
            letter-spacing: 1px;
        }

        .led-indicator {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--green-normal);
            box-shadow: 0 0 8px var(--green-normal);
            animation: pulse 2s infinite;
        }

        /* --- GRID PRINCIPAL --- */
        .main-grid {
            display: grid;
            grid-template-columns: 3fr 1fr;
            gap: 15px;
        }

        .left-column { display: flex; flex-direction: column; gap: 15px; }
        .right-column { display: flex; flex-direction: column; gap: 15px; }

        /* --- HERO SECTION --- */
        .hero {
            display: grid;
            grid-template-columns: 1.5fr 1fr;
            background: linear-gradient(135deg, #101622 0%, #172033 100%);
            border-left: 4px solid var(--electric-blue);
            position: relative;
        }

        .hero-content { z-index: 2; }
        
        .ai-message {
            font-size: 1.1rem;
            line-height: 1.6;
            color: #d1d9e6;
            margin-bottom: 20px;
        }

        .ai-highlight { color: var(--electric-blue); font-weight: 700; }
        .ai-warning { color: var(--industrial-orange); font-weight: 700; }

        .btn-industrial {
            background: transparent;
            border: 1px solid var(--electric-blue);
            color: var(--electric-blue);
            padding: 10px 24px;
            font-family: var(--font-ui);
            font-size: 1.1rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 1px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.1);
        }

        .btn-industrial:hover {
            background: var(--electric-blue);
            color: var(--bg-base);
            box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
        }

        .hero-visual {
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .factory-illustration {
            width: 100%;
            height: 100%;
            opacity: 0.6;
            background-image: repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(74, 85, 104, 0.1) 40px, rgba(74, 85, 104, 0.1) 80px);
            position: relative;
        }
        
        .robot-arm {
            position: absolute;
            font-size: 8rem;
            color: var(--steel-grey);
            opacity: 0.8;
            filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
            animation: arm-move 5s infinite alternate ease-in-out;
        }

        /* --- KPIs --- */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
        }

        .kpi-card {
            background: var(--bg-panel-light);
            padding: 20px;
            border-radius: 6px;
            border-bottom: 3px solid var(--steel-grey);
            display: flex;
            flex-direction: column;
            gap: 5px;
            position: relative;
            overflow: hidden;
        }

        .kpi-title { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
        .kpi-value { font-family: var(--font-ui); font-size: 2.2rem; font-weight: 700; color: var(--text-main); }
        .kpi-icon { position: absolute; right: 15px; top: 20px; font-size: 2rem; opacity: 0.1; }

        .kpi-card.kpi-blue { border-color: var(--electric-blue); }
        .kpi-card.kpi-orange { border-color: var(--industrial-orange); }
        .kpi-card.kpi-green { border-color: var(--green-normal); }
        .kpi-card.kpi-turquoise { border-color: var(--turquoise); }
        .kpi-card.kpi-red { border-color: var(--red-alarm); }
        .kpi-card.kpi-protagonist { background: linear-gradient(45deg, #131824, #1a2235); border: 1px solid var(--electric-blue); box-shadow: 0 0 15px rgba(0, 229, 255, 0.2); }
        .kpi-card.kpi-protagonist .kpi-value { color: var(--electric-blue); text-shadow: 0 0 10px rgba(0, 229, 255, 0.4); }

        /* --- SIMIAN SAGE MODULE --- */
        .sage-module {
            background: linear-gradient(180deg, rgba(29, 233, 182, 0.05) 0%, var(--bg-panel) 100%);
            border: 1px solid var(--turquoise);
            box-shadow: inset 0 0 20px rgba(29, 233, 182, 0.05);
        }

        .sage-header { display: flex; align-items: center; gap: 10px; color: var(--turquoise); font-family: var(--font-ui); font-size: 1.5rem; font-weight: 700; margin-bottom: 15px; }
        .sage-text-container { min-height: 80px; display: flex; align-items: center; }
        .sage-text { font-size: 1rem; color: #fff; font-style: italic; transition: opacity 0.5s ease; border-left: 2px solid var(--turquoise); padding-left: 15px; }

        /* --- MAPA DE PLANTA ANIMADO --- */
        .plant-map {
            width: 100%;
            height: 300px;
            background: #0f131c;
            border: 1px solid var(--border-color);
            position: relative;
            background-image: 
                linear-gradient(rgba(74, 85, 104, 0.2) 1px, transparent 1px),
                linear-gradient(90deg, rgba(74, 85, 104, 0.2) 1px, transparent 1px);
            background-size: 20px 20px;
            border-radius: 4px;
        }

        .zone {
            position: absolute;
            border: 1px dashed var(--steel-grey);
            background: rgba(28, 35, 49, 0.7);
            color: var(--text-muted);
            font-family: var(--font-ui);
            font-size: 0.8rem;
            display: flex;
            justify-content: center;
            align-items: center;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .zone-reception { top: 10%; left: 5%; width: 15%; height: 80%; }
        .zone-production { top: 10%; left: 25%; width: 40%; height: 45%; border-color: var(--electric-blue); }
        .zone-assembly { top: 60%; left: 25%; width: 40%; height: 30%; }
        .zone-qc { top: 10%; left: 70%; width: 10%; height: 30%; border-color: var(--industrial-orange); }
        .zone-warehouse { top: 45%; left: 70%; width: 25%; height: 45%; }

        .particle {
            position: absolute;
            width: 6px;
            height: 6px;
            background: var(--electric-blue);
            box-shadow: 0 0 8px var(--electric-blue);
            border-radius: 50%;
            animation: move-product 8s linear infinite;
        }

        @keyframes move-product {
            0% { top: 50%; left: 10%; }
            20% { top: 30%; left: 30%; }
            40% { top: 30%; left: 60%; }
            60% { top: 75%; left: 60%; }
            80% { top: 25%; left: 75%; }
            100% { top: 65%; left: 85%; }
        }

        /* --- LINEA DE PRODUCCION ANIMADA --- */
        .production-line {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 0;
            position: relative;
        }

        .line-track {
            position: absolute;
            top: 50%;
            left: 0;
            width: 100%;
            height: 4px;
            background: var(--bg-panel-light);
            z-index: 1;
            transform: translateY(-50%);
        }

        .line-progress {
            position: absolute;
            top: 0; left: 0; height: 100%;
            background: var(--electric-blue);
            box-shadow: 0 0 10px var(--electric-blue);
            animation: line-flow 4s infinite linear;
        }

        @keyframes line-flow { 0% { width: 0%; } 100% { width: 100%; } }

        .station {
            position: relative;
            z-index: 2;
            background: var(--bg-panel);
            border: 2px solid var(--steel-grey);
            padding: 15px;
            border-radius: 50%;
            width: 60px;
            height: 60px;
            display: flex;
            justify-content: center;
            align-items: center;
            color: var(--text-muted);
            font-size: 1.2rem;
            transition: all 0.3s;
        }

        .station.active { border-color: var(--electric-blue); color: var(--electric-blue); box-shadow: 0 0 15px rgba(0, 229, 255, 0.3); }
        .station-label { position: absolute; bottom: -25px; font-size: 0.75rem; white-space: nowrap; font-family: var(--font-ui); text-transform: uppercase; }

        /* --- MAQUINAS Y BARRAS --- */
        .machine-list { display: flex; flex-direction: column; gap: 10px; }
        .machine-item { background: var(--bg-panel-light); padding: 12px 15px; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; }
        .machine-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
        .status-dot { width: 8px; height: 8px; border-radius: 50%; }
        .dot-green { background: var(--green-normal); box-shadow: 0 0 5px var(--green-normal); }
        .dot-orange { background: var(--industrial-orange); box-shadow: 0 0 5px var(--industrial-orange); }
        .dot-red { background: var(--red-alarm); box-shadow: 0 0 5px var(--red-alarm); }

        .progress-container { margin-top: 8px; background: rgba(0,0,0,0.3); height: 6px; border-radius: 3px; overflow: hidden; }
        .progress-bar { height: 100%; }
        .pb-blue { background: var(--electric-blue); }
        .pb-orange { background: var(--industrial-orange); }
        .pb-turquoise { background: var(--turquoise); }

        /* --- CHARTS Y GRAFICOS --- */
        .chart-circle-container { display: flex; justify-content: space-around; padding: 10px 0; }
        .chart-circle {
            width: 80px; height: 80px; border-radius: 50%;
            display: flex; justify-content: center; align-items: center;
            position: relative;
        }
        .chart-circle::before { content: ''; position: absolute; width: 60px; height: 60px; background: var(--bg-panel); border-radius: 50%; }
        .chart-value { position: relative; z-index: 2; font-family: var(--font-ui); font-size: 1.2rem; font-weight: 700; }
        
        .c-quality { background: conic-gradient(var(--green-normal) 0% 92%, var(--red-alarm) 92% 100%); }
        .c-energy { background: conic-gradient(var(--turquoise) 0% 84%, var(--steel-grey) 84% 100%); }

        /* --- ALERTAS --- */
        .alert-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-left: 3px solid; background: rgba(255,255,255,0.02); margin-bottom: 8px; }
        .alert-item i { font-size: 1.2rem; }
        .alert-item.a-red { border-color: var(--red-alarm); color: var(--red-alarm); }
        .alert-item.a-orange { border-color: var(--industrial-orange); color: var(--industrial-orange); }

        /* --- RESPONSIVE --- */
        @media (max-width: 1024px) {
            .main-grid { grid-template-columns: 1fr; }
            .hero { grid-template-columns: 1fr; }
            .hero-visual { display: none; }
            .kpi-grid { grid-template-columns: repeat(2, 1fr); }
        }
        @media (max-width: 600px) {
            .header { flex-direction: column; gap: 15px; text-align: center; }
            .header-info { flex-wrap: wrap; justify-content: center; }
            .kpi-grid { grid-template-columns: 1fr; }
            .production-line { overflow-x: auto; padding-bottom: 30px; }
        }

        @keyframes arm-move {
            0% { transform: rotate(-10deg) translateY(0); }
            100% { transform: rotate(10deg) translateY(-10px); }
        }