:root {
    /* Backgrounds */
    --bg-dark: #1a1c22;
    --bg-midnight: radial-gradient(circle at top left, #232732 0%, #1a1c22 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.05);
    /* Semantic surfaces */
    --sidebar-bg: rgba(10, 10, 10, 0.9);
    --modal-bg: #0f172a;
    --surface-bg: #0f172a;
    --deep-bg: #050505;
    --sticky-bg: #0f172a;
    --topbar-bg: rgba(10, 15, 25, 0.4);
    --topbar-border: rgba(255, 255, 255, 0.05);
    /* Accents */
    --accent-cian: #00e5ff;
    --accent-cyan: #00e5ff;
    --accent-blue: #00e5ff;
    --accent-pink: #ff4081;
    /* Text */
    --text-main: #f0f2f5;
    --text-dim: #a0aab2;
    --text-primary: #f0f2f5;
    /* Layout */
    --sidebar-width: 220px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    /* Department Colors */
    --dept-mkt: #ec4899;
    --dept-fin: #10b981;
    --dept-startup: #8b5cf6;
    --dept-ops: #f59e0b;
    --dept-lab: #06b6d4;
}



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

/* ===== @MENTIONS ===== */
.mention {
    color: var(--accent-cian);
    background: rgba(0, 229, 255, 0.1);
    border-radius: 4px;
    padding: 1px 4px;
    font-weight: 600;
    font-size: inherit;
    cursor: default;
    white-space: nowrap;
}
.mention-dropdown {
    position: fixed;
    background: var(--modal-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    z-index: 99999;
    min-width: 200px;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
.mention-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: background 0.1s;
}
.mention-option:hover,
.mention-option.selected {
    background: rgba(0, 229, 255, 0.08);
    color: var(--accent-cian);
}
.mention-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-cian);
    flex-shrink: 0;
}

/* ===== ACTIVITY FEED ===== */
.activity-timeline {
    position: relative;
    padding-left: 24px;
}
.activity-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 6px;
    bottom: 0;
    width: 2px;
    background: var(--card-border);
}
.activity-item {
    position: relative;
    padding: 10px 0 10px 16px;
    border-bottom: 1px solid var(--card-border);
}
.activity-item:last-child {
    border-bottom: none;
}
.activity-dot {
    position: absolute;
    left: -24px;
    top: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface-bg);
    border: 2px solid var(--card-border);
    font-size: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.activity-dot.action-create  { border-color: #10b981; background: rgba(16,185,129,0.15); }
.activity-dot.action-add     { border-color: #60a5fa; background: rgba(96,165,250,0.15); }
.activity-dot.action-upload  { border-color: #a78bfa; background: rgba(167,139,250,0.15); }
.activity-dot.action-comment { border-color: #fbbf24; background: rgba(251,191,36,0.15); }
.activity-dot.action-pin     { border-color: #f87171; background: rgba(248,113,113,0.15); }
.activity-dot.action-resolve { border-color: #34d399; background: rgba(52,211,153,0.15); }
.activity-dot.action-delete  { border-color: #ef4444; background: rgba(239,68,68,0.15); }
.activity-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 3px;
}
.activity-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.activity-filter-select {
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.activity-filter-select:focus {
    border-color: var(--accent-cian);
}

html {
    overflow: hidden;
    height: 100%;
    overscroll-behavior: none;
}

body {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
}

#global-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -10;
}

.mono {
    font-family: var(--font-mono);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem 0.5rem;
    position: fixed;
    z-index: 1000;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}


.logo {
    margin-bottom: 0.8rem;
    padding: 0 10px;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-main);
}

.logo-accent {
    height: 2px;
    width: 40px;
    background: var(--accent-cian);
    margin-top: 4px;
    box-shadow: 0 0 10px var(--accent-cian);
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,229,255,0.15) transparent;
}
.nav-menu::-webkit-scrollbar { width: 3px; }
.nav-menu::-webkit-scrollbar-track { background: transparent; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.15); border-radius: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
    background: transparent;
    border: none;
    font-size: 0.78rem;
    cursor: pointer;
    margin-bottom: 1px;
    text-align: left;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-cian);
    background: rgba(0, 242, 255, 0.08);
    /* Fondo más suave y amable */
    border-left: 3px solid var(--accent-cian);
    /* Indicador lateral industrial */
    padding-left: 13px;
    /* Compensación por el borde */
    box-shadow: inset 5px 0 15px rgba(0, 242, 255, 0.05);
}

.market-filters {
    display: flex;
    gap: 0.5rem;
    margin-right: 2rem;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none;
    /* Amigable */
}

.filter-btn.active {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-cian);
    color: var(--accent-cian);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 8px;
    margin-right: 1rem;
    background: rgba(15, 23, 42, 0.5);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0.6;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    opacity: 1;
}

.lang-btn.active {
    background: rgba(0, 242, 255, 0.1);
    opacity: 1;
}

.nav-item .label {
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 1rem;
}

.nav-group {
    margin-bottom: 8px;
}

.sub-menu {
    padding-left: 0;
    margin-top: 4px;
}

/* ── Collapsible nav categories ─────────────────────────── */
.nav-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.nav-menu::-webkit-scrollbar { display: none; }

.nav-category {
    margin-bottom: 4px;
}

.nav-category-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 7px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    gap: 8px;
    margin-bottom: 2px;
}
.nav-category-header:hover {
    background: rgba(255,255,255,0.04);
}

.cat-icon {
    font-size: 0.85rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.cat-label {
    flex: 1;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: left;
}

.cat-arrow {
    font-size: 0.55rem;
    color: var(--text-dim);
    opacity: 0.6;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-category-items {
    overflow: hidden;
    max-height: 400px;
    transition: max-height 0.22s ease, opacity 0.2s ease;
    opacity: 1;
}

.nav-category-items.collapsed {
    max-height: 0;
    opacity: 0;
}

.sub-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    margin: 0 0 0 6px;
    color: #8899aa;
    text-decoration: none;
    font-size: 11.5px;
    font-weight: 400;
    border-radius: 7px;
    transition: all 0.15s ease;
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    width: calc(100% - 6px);
    text-align: left;
    outline: none;
}

.sub-item .icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sub-item .icon svg {
    width: 16px;
    height: 16px;
    stroke: #667788;
    fill: none;
    stroke-width: 1.5;
}

.sub-item:hover {
    background: #1a2332;
}

.sub-item.active {
    background: rgba(0, 212, 255, 0.08);
    color: #00d4ff;
}
.sub-item.active .icon svg {
    stroke: #00d4ff;
}

.sidebar-footer {
    padding: 6px 10px;
    flex-shrink: 0;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

.status-indicator {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--accent-cian);
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-cian);
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 8px var(--accent-cian);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.5;
    }
}

/* View Switching */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* Main Content */
.content {
    position: absolute;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    padding: 0;
    overflow: hidden;
    z-index: 10;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}


.view-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    display: none;
    background-color: transparent;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.top-bar h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    background: var(--card-border);
    border-radius: 50%;
    border: 1px solid var(--accent-cian);
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 1.5rem;
}

/* Default for larger screens (desktop) */
.sku-grid, .insumos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(0, 229, 255, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.card-large {
    grid-column: span 2;
    grid-row: span 2;
}

.card-medium {
    grid-column: span 2;
}

.card-header {
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--accent-blue);
    margin-bottom: 4px;
    display: block;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.3px;
    margin-bottom: 0.5rem;
}

.big-value {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--accent-cian);
    margin: 0.5rem 0;
}

.value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.trend {
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.trend.positive {
    color: var(--accent-cian);
}

.trend.glowing {
    color: var(--accent-cian);
    text-shadow: 0 0 5px var(--accent-cian);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cian));
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

/* Buttons */
.btn-primary {
    background: var(--accent-cian);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.15);
    text-transform: none;
    letter-spacing: -0.01em;
}

.btn-secondary {
    border-radius: 8px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: none;
}

.btn-tertiary {
    border-radius: 8px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: none;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.3);
    transform: translateY(-2px);
}

/* Chart Placeholder */
.chart-placeholder {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--accent-cian), transparent);
    border-radius: 4px 4px 0 0;
}

/* Production Table Section */
.production-section {
    margin-top: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.5rem;
    overflow-x: auto;
}

.production-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.production-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.production-table th {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: none;
    /* Menos agresivo */
    letter-spacing: 0.5px;
}

.production-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 0.9rem;
    color: var(--text-main);
}

.production-table .cost,
.production-table .revenue {
    font-family: var(--font-mono);
}

.price-input {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.2);
    color: var(--accent-cian);
    font-family: var(--font-mono);
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.price-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.3);
    border-color: var(--accent-cian);
}

/* Categorized Tables */
.category-header,
.sku-market-category {
    background: rgba(0, 242, 255, 0.03);
    color: var(--accent-cian);
    font-weight: 700;
    padding: 10px 15px;
    border-left: 3px solid var(--accent-cian);
    margin: 1.5rem 0 0.5rem 0;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.sku-market-category {
    margin: 2.5rem 0 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sku-market-category .market-tag {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-main);
}

/* --- Penny Tracker UI --- */
.penny-tracker {
    display: flex;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.penny-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.penny-cogs {
    background: #222;
    color: #666;
}

.badge-pipeline {
    background: #555;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    margin-left: 8px;
    vertical-align: middle;
}


/* SKU Management Styles */
.sku-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.view-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.view-toggles {
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.6);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.toggle-btn.active {
    background: var(--accent-cian);
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 242, 255, 0.2);
}

/* Container for List + Ficha */
.sku-module-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sku-list-container {
    transition: all 0.3s;
}

/* GRID MODE (Vista Compacta Horizontal) */
.sku-list-container.grid-mode {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* This rule is now handled by the combined .sku-grid, .insumos-grid rule above */
/* .sku-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
} */


/* ROW MODE (Vista Tabla Industrial) */
.sku-list-container.row-mode,
.sku-group-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sku-list-container.row-mode .sku-card {
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 150px;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    min-height: auto;
    background: rgba(15, 23, 42, 0.3);
}

.sku-list-container.row-mode .sku-card:hover {
    background: rgba(15, 23, 42, 0.6);
}

.sku-list-container.row-mode .sku-card-header {
    margin-bottom: 0;
}

/* Brand Insignia & Branding */
.brand-insignia {
    width: 48px;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    /* Smoother squircle look */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-cian);
    flex-shrink: 0;
    overflow: hidden;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer !important;
    position: relative;
    pointer-events: auto !important;
    z-index: 100 !important;
}

/* Modal System */

/* Generic .modal wrapper — used by employee-modal, run-payroll-modal, etc. */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

/* Backdrop inside .modal (click-to-close layer) */
.modal > .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1;
    display: block; /* always visible when parent .modal is shown */
}

/* Dialog panel */
.modal-content {
    position: relative;
    z-index: 2;
    background: var(--modal-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 242, 255, 0.08);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Legacy .modal-overlay used as standalone full-screen container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--modal-bg);
    border: 1px solid var(--accent-cian);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    padding: 2.5rem;
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
}

.modal-card h2 {
    color: var(--accent-cian);
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.form-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    padding: 10px 12px;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: var(--accent-cian);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15);
}

.form-input::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

.form-input:disabled,
.form-input[readonly] {
    opacity: 0.5;
    cursor: not-allowed;
}

select.form-input {
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.brand-insignia:hover::after {
    content: "EDIT";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 700;
    z-index: 101;
    pointer-events: none;
}

/* Back Button Universal */
.btn-back {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-cian);
    color: var(--accent-cian);
}

.brand-insignia:hover::after {
    content: "EDIT";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    font-weight: 700;
    z-index: 2;
}

.finance-summary h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.finance-summary .big-value {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--accent-cian);
    line-height: 1.1;
}

.finance-summary .trend {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 0.5rem;
    text-transform: uppercase;
}

#expense-modal label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: block;
}



/* Master de Insumos Table Refinement */
.materials-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 1rem;
}

.materials-table th {
    text-align: left;
    padding: 12px 15px;
    color: var(--text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.materials-table td {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.materials-table td:first-child {
    font-weight: 600;
    color: var(--text-main);
}

.materials-table td:nth-child(2) {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.materials-table tr td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-weight: 400 !important;
}

.materials-table tr td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.materials-table tr:hover td {
    background: rgba(0, 242, 255, 0.04);
    border-color: rgba(0, 242, 255, 0.15);
    color: var(--accent-cian);
}

.materials-table tr:hover td:nth-child(2) {
    color: rgba(0, 242, 255, 0.7);
}

.insumos-view-wrapper {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.sku-list-container.row-mode .brand-insignia {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

/* This rule is now handled by the combined .sku-grid, .insumos-grid rule above */
/* .sku-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
} */


/* --- Premium Pipeline SKUs (Glassmorphism) --- */
.sku-card.development {
    background: rgba(255, 255, 255, 0.02) !important;
    backdrop-filter: blur(8px);
    border: 1px dashed rgba(255, 140, 0, 0.3) !important;
    opacity: 0.9;
    filter: none;
    /* Quitamos el grayscale para el look premium */
}

.sku-card.development::after {
    content: "IN PIPELINE";
    background: linear-gradient(90deg, #ff8c00, #ff4500);
    color: white;
    padding: 3px 10px;
    border-radius: 4px 0 0 4px;
    font-size: 0.55rem;
    font-weight: 900;
    top: 15px;
    right: 0;
    box-shadow: -5px 0 15px rgba(255, 69, 0, 0.3);
}

/* Ajuste para el badge dentro de la card de Pipeline */
.sku-card.development .badge-pipeline {
    background: rgba(255, 140, 0, 0.2);
    color: #ff8c00;
    border: 1px solid rgba(255, 140, 0, 0.3);
}

.sku-card:hover {
    border-color: var(--accent-cian);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.1);
    transform: translateY(-2px);
}

.sku-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.margin-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.margin-badge.high {
    color: var(--accent-cian);
    border-color: var(--accent-cian);
    background: rgba(0, 242, 255, 0.1);
}

.margin-badge.mid {
    color: #f2ff00;
    border-color: #f2ff00;
    background: rgba(242, 255, 0, 0.1);
}

.margin-badge.low {
    color: #ff004c;
    border-color: #ff004c;
    background: rgba(255, 0, 76, 0.1);
}

.btn-detail {
    background: transparent;
    border: 1px solid var(--accent-cian);
    color: var(--accent-cian);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 0.5px;
}

.btn-detail:hover {
    background: var(--accent-cian);
    color: #000;
    box-shadow: 0 0 15px var(--accent-cian);
}

/* Detail Panel Overlay */
.detail-overlay {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--card-border);
    z-index: 1000;
    padding: 2.5rem;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.detail-overlay.open {
    right: 0;
}

.close-panel {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Ficha 360 Modal Overlay */
.ficha-360-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 13, 0.92);
    backdrop-filter: blur(20px);
    z-index: 5000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.ficha-360-container.active {
    display: flex;
}

.ficha-modal-wrapper {
    width: 100%;
    max-width: min(1200px, 94vw);
    background: var(--modal-bg);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 242, 255, 0.05);
    animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    margin: auto;
    margin-bottom: 3rem;
    overflow: hidden;
}

.ficha-header-pro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(to bottom, rgba(0, 242, 255, 0.05), transparent);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ficha-tabs-pro {
    display: flex;
    gap: 2rem;
    padding: 0 2.5rem;
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn-pro {
    padding: 1.2rem 0;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn-pro:hover {
    color: #fff;
}

.tab-btn-pro.active {
    color: var(--accent-cian);
}

.tab-btn-pro.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-cian);
    box-shadow: 0 0 10px var(--accent-cian);
}

.ficha-body-pro {
    padding: 2.5rem;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asset-uploader {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.upload-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(0, 242, 255, 0.3);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-card:hover {
    background: rgba(0, 242, 255, 0.05);
    border-color: var(--accent-cian);
}

.upload-card span {
    display: block;
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 5px;
}

.upload-card input {
    display: none;
}

.detail-header h2 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.detail-header p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breakdown-item .label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.breakdown-item .value {
    font-family: var(--font-mono);
    font-weight: 600;
}

.bom-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.bom-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* --- Added for Hito 2: Finance & EBITDA --- */
.finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.finance-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.4));
    border: 1px solid rgba(0, 242, 255, 0.1);
    padding: 1.5rem;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.finance-card h4 {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.finance-card .value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-cian);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.expense-table-container {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-top: 1.5rem;
}

.expense-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    font-size: 0.9rem;
}

.expense-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.expense-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

/* Linear-style table hovers */
.expense-table tbody tr {
    transition: background-color 0.2s ease;
}

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

.expense-table td.mono {
    font-family: var(--font-mono);
    text-align: right;
    font-weight: 600;
}

.expense-desc {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.badge-reimbursable {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-reimbursable.yes {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cian);
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.badge-reimbursable.no {
    background: rgba(155, 155, 155, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* EBITDA Dashboard Metrics */
.ebitda-container {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(0, 242, 255, 0.1);
}

.break-even-wrapper {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 242, 255, 0.02);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 12px;
}

.be-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.be-progress-bar {
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.be-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00f2ff, #f2ff00);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
    transition: width 0.8s ease-in-out;
}

/* --- Responsive Design (Mobile Friendly) --- */
@media (max-width: 1024px) {
    /* Rules moved below to consolidate with tablet/mobile toggle behavior */
}


@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    body {
        overflow-x: hidden;
    }

    /* Sidebar Mobile Overlay */
    .sidebar {
        left: calc(-1*var(--sidebar-width));
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0 !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1040;       /* between content and sidebar (1050) */
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Content Adjustment */
    .content {
        left: 0 !important;
        width: 100% !important;
    }

    .view-section {
        padding: 1.5rem;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    .card-large, .card-medium {
        grid-column: span 2 !important;
        grid-row: auto !important;
    }

    .sku-grid, .insumos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    /* Hamburger Menu Button — fixed top-left, always on top */
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        width: 44px;
        height: 44px;
        background: rgba(10, 22, 40, 0.92);
        border: 1px solid rgba(0, 188, 212, 0.35);
        border-radius: 10px;
        cursor: pointer;
        z-index: 1100;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 2px 12px rgba(0,0,0,0.4);
        transition: background 0.2s, border-color 0.2s;
    }

    .mobile-nav-toggle:hover,
    .mobile-nav-toggle.active {
        background: rgba(0, 188, 212, 0.15);
        border-color: var(--accent-cian);
    }

    .hamburger {
        width: 20px;
        height: 2px;
        background: var(--accent-cian);
        position: relative;
        transition: background 0.3s;
    }

    .hamburger::before,
    .hamburger::after {
        content: '';
        position: absolute;
        width: 20px;
        height: 2px;
        background: var(--accent-cian);
        transition: transform 0.3s, top 0.3s;
    }

    .hamburger::before { top: -6px; }
    .hamburger::after  { top:  6px; }

    /* Animate to X when sidebar is open */
    .mobile-nav-toggle.active .hamburger           { background: transparent; }
    .mobile-nav-toggle.active .hamburger::before   { transform: rotate(45deg);  top: 0; }
    .mobile-nav-toggle.active .hamburger::after    { transform: rotate(-45deg); top: 0; }

    /* Top Bar — two-row mobile layout to prevent hamburger overlap */
    /* ─── Tablet header (768–1024): simple column layout ─────────── */
    .top-bar-refined {
        flex-direction: column !important;
        gap: 0.5rem;
        padding: 1rem 1rem 0.75rem 60px !important; /* space for hamburger */
        margin-top: -1.5rem;
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        margin-bottom: 1rem;
        border-radius: 0;
    }

    .market-selector-pro {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
        width: auto;
    }

    .pro-label { font-size: 0.6rem; white-space: nowrap; }
    .market-pill-btn { padding: 4px 12px; font-size: 0.72rem; }

    .header-right-actions {
        justify-content: flex-end;
        gap: 0.5rem !important;
        flex-wrap: wrap;
    }

    #load-info-btn { font-size: 0 !important; padding: 6px 8px !important; min-width: 32px; }
    #load-info-btn::before { content: "📥"; font-size: 1rem; }
    #sync-label { display: none; }
    .settings-gear-btn { padding: 5px 7px; }
    [onclick="openGlobalSearch()"] kbd { display: none; }
    [onclick="openGlobalSearch()"] { padding: 5px 7px !important; font-size: 0.75rem !important; }
    #user-display-name { display: none; }
    #user-pill { padding: 4px 8px 4px 6px !important; }
    #presence-bar { display: none !important; }

    /* KPI row: horizontal scroll with snap, 2 visible at a time */
    #dashboard-kpi-row {
        display: flex !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 0.6rem !important;
        padding-bottom: 6px;
        scrollbar-width: none;           /* Firefox */
    }
    #dashboard-kpi-row::-webkit-scrollbar {
        display: none;                    /* Chrome/Safari */
    }
    #dashboard-kpi-row > .card,
    #dashboard-kpi-row > div {
        flex: 0 0 calc(50% - 0.3rem);    /* 2 cards visible */
        min-width: calc(50% - 0.3rem);
        scroll-snap-align: start;
        box-sizing: border-box;
    }

    /* Grids & Cards */
    .insumos-grid, .sku-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    #cogs-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Pipeline / Development Columns */
    #pipeline-view .development-column {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }

    /* Modals for Mobile */
    .modal-card {
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 1.5rem !important;
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .modal-overlay {
        padding: 0 !important;
        align-items: flex-start !important;
    }

    .ficha-360-container {
        padding: 0 !important;
        padding-left: 0 !important;
    }

    .ficha-modal-wrapper {
        width: 100% !important;
        height: 100vh !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 1rem;
        overflow-y: auto;
    }

    .finance-summary {
        grid-template-columns: 1fr !important;
    }

    /* view-header-pro (back button + title in subviews) — allow wrapping */
    .view-header-pro {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Volver button: push right to clear fixed hamburger (ends at ~56px from left) */
    .btn-back-pro {
        margin-left: 48px;
    }

    .view-header-actions {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .market-pill-group {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    /* ═══════════════════════════════════════════════════════════════
       PHONE ONLY (≤768px) — Fixed header + market bar + sidebar
       ═══════════════════════════════════════════════════════════════ */
    @media (max-width: 768px) {

        /* ── 1. FIXED MOBILE HEADER (56px) ─────────────────────────── */
        .top-bar-refined {
            position: fixed !important;
            top: 0; left: 0; right: 0;
            height: 56px;
            z-index: 1000;
            display: flex !important;
            flex-direction: row !important;
            align-items: center !important;
            padding: 0 12px 0 0 !important;
            margin: 0 !important;
            gap: 0 !important;
            background: rgba(10, 10, 26, 0.97) !important;
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border-bottom: 1px solid rgba(255,255,255,0.06);
            border-radius: 0 !important;
            overflow: visible;
        }

        /* Hamburger zone — clickable area inside header */
        .top-bar-refined::before {
            content: "☰";
            display: flex;
            align-items: center;
            justify-content: center;
            width: 56px;
            height: 56px;
            font-size: 1.3rem;
            color: var(--accent-cian);
            cursor: pointer;
            flex-shrink: 0;
            /* pointer-events handled by JS overlay below */
            pointer-events: none;
        }

        /* "BOLD WATER" title — centered via flex:1 */
        .top-bar-refined .header-main-control {
            flex: 1;
            display: flex !important;
            align-items: center;
            justify-content: flex-start;
            padding: 0 !important;
            overflow: hidden;
        }

        /* Hide market selector from header — it goes in the market bar below */
        .top-bar-refined .market-selector-pro {
            display: none !important;
        }

        /* Show "BOLD WATER" text instead of market selector */
        .top-bar-refined .header-main-control::before {
            content: "BOLD WATER";
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            font-weight: 800;
            letter-spacing: 2px;
            color: var(--accent-cian);
            white-space: nowrap;
        }

        /* Right side: only settings + lang + avatar */
        .top-bar-refined .header-right-actions {
            display: flex !important;
            align-items: center;
            gap: 8px !important;
            margin-left: auto;
            padding: 0 !important;
            flex-shrink: 0;
            flex-wrap: nowrap !important;
            overflow: visible !important;
        }

        /* Hide non-essential from header row */
        .top-bar-refined #load-info-btn,
        .top-bar-refined #sync-indicator,
        .top-bar-refined #presence-bar,
        .top-bar-refined [onclick="openGlobalSearch()"] {
            display: none !important;
        }

        .top-bar-refined .settings-gear-btn {
            padding: 6px 8px;
            font-size: 1rem;
            flex-shrink: 0;
        }

        .top-bar-refined #btn-lang-toggle {
            padding: 4px 8px !important;
            font-size: 0.7rem !important;
            flex-shrink: 0;
        }

        .top-bar-refined #user-display-name { display: none !important; }
        .top-bar-refined #user-pill { padding: 4px !important; flex-shrink: 0; }

        /* ── 2. HAMBURGER: inside fixed header, always on top ────────── */
        .mobile-nav-toggle {
            position: fixed !important;
            top: 6px !important;
            left: 6px !important;
            z-index: 1100 !important;  /* always above header (1000) and content */
            width: 44px;
            height: 44px;
        }

        /* ── 3. MARKET BAR (40px, below header) ────────────────────── */
        /* We use .view-section::before as a spacer, and show the market
           selector as a fixed bar via the .market-bar-mobile element
           injected by JS below. For now, reserve space. */

        /* ── 4. CONTENT: push down below fixed header + market bar ── */
        .view-section {
            padding: 108px 1rem 1rem 1rem !important;  /* 56px header + 40px market + 12px gap */
        }

        /* ── 5. SIDEBAR: transform-based slide, not display:none ───── */
        .sidebar {
            display: flex !important;
            transform: translateX(-100%);
            transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
            z-index: 1050 !important;
            left: 0 !important;
        }

        .sidebar.active {
            transform: translateX(0) !important;
        }

        .content {
            left: 0 !important;
            width: 100% !important;
        }

        /* ── 6. GRIDS: single column ──────────────────────────────── */
        .bento-grid, .sku-grid, .insumos-grid {
            grid-template-columns: 1fr !important;
        }

        .card-large, .card-medium {
            grid-column: span 1 !important;
        }

        .big-value {
            font-size: 2.2rem !important;
        }

        /* ── 7. BACK BUTTONS: clear hamburger ─────────────────────── */
        .btn-back-pro {
            margin-left: 0 !important;
        }

        /* Non-dashboard view headers also need top padding for fixed header */
        .view-header-pro {
            padding-top: 0;
        }

        /* ── 8. BOTTOM NAV ────────────────────────────────────────── */
        .mobile-bottom-nav {
            z-index: 998 !important;
            height: 60px;
        }

        /* Move voice FAB above mobile bottom nav */
        #voice-mic-btn { bottom: 88px !important; right: 16px !important; width: 46px !important; height: 46px !important; }
        #voice-banner { bottom: 144px !important; right: 16px !important; }
    }
}



/* ── Responsive additions — tablet (≤1024px) ─────────────────────────────── */
@media (max-width: 1024px) {
    /* Tables: horizontal scroll */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    thead, tbody, tr { min-width: 0; }

    /* China view tabs: wrap so they don't overflow */
    #china-view .china-tab-btn { padding: 5px 10px !important; font-size: 0.72rem !important; }

    /* Directorio cards: 2 cols on tablet */
    #china-directorio-container > div > div[style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    }

    /* Sidebar footer lang button */
    #btn-lang-toggle { font-size: 0.72rem; padding: 6px 0; }

    /* RRHH employee grid: 2 cols */
    #employees-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; }
}

/* ── Responsive additions — mobile (≤768px) ──────────────────────────────── */
@media (max-width: 768px) {
    /* Tables: block scroll */
    table { font-size: 0.75rem; }
    th, td { padding: 8px 10px !important; white-space: nowrap; }

    /* All 2-col form grids collapse to 1 col */
    .card [style*="grid-template-columns:1fr 1fr"],
    .card [style*="grid-template-columns: 1fr 1fr"],
    .glass-effect [style*="grid-template-columns:1fr 1fr"],
    .glass-effect [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Modals (glass-effect inside fixed overlay) — full screen */
    [style*="position:fixed"] > .glass-effect,
    [style*="position: fixed"] > .glass-effect {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100dvh !important;
        height: 100dvh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 1.25rem !important;
        overflow-y: auto !important;
    }

    /* China view: hide Chinese subtitle on small screens */
    #china-view h2 span { display: none; }

    /* China tabs: full-width scroll */
    #china-view [style*="display:flex"][style*="gap:4px"] {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    /* Dashboard bento KPIs: 1 col */
    .bento-grid { grid-template-columns: 1fr !important; }

    /* China category grid: 1 col */
    #china-categorias-grid { grid-template-columns: 1fr !important; }

    /* Directorio cards: 1 col */
    #china-directorio-container > div > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Finance summary cards: 1 col */
    .finance-summary { grid-template-columns: 1fr !important; }

    /* View section padding — preserve top for fixed header + market bar */
    .view-section { padding: 108px 0.75rem 0.75rem 0.75rem !important; }

    /* View header: smaller font */
    .view-header-pro h2, .view-header-pro h3 { font-size: 0.95rem !important; }

    /* Presupuesto/proveedores: table card layout */
    .view-section table td:first-child { font-weight: 700; }

    /* Seguimiento cards full width */
    #china-seguimiento-list { gap: 0.75rem !important; }

    /* RRHH: 1 col */
    #employees-list { grid-template-columns: 1fr !important; }

    /* Pipeline columns: stack */
    .pipeline-columns { flex-direction: column !important; }
    .pipeline-columns > div { width: 100% !important; min-width: 0 !important; }

    /* SKU / insumos: 1 col */
    .sku-grid, .insumos-grid { grid-template-columns: 1fr !important; }

    /* Typography */
    .big-value { font-size: 1.8rem !important; }
    .metric-value { font-size: 1.1rem !important; }
}

/* Global Scrolling Utilities */
.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible; /* Prevent nested vertical scrolls */
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--card-border);
    position: relative;
    scroll-behavior: smooth;
    scrollbar-width: auto; /* Use standard width for better visibility */
    scrollbar-color: var(--accent-cian) rgba(255,255,255,0.05);
    cursor: grab; /* Indicate draggable area */
}

.table-container:active {
    cursor: grabbing;
}

.table-container::-webkit-scrollbar {
    height: 10px; /* Thicker horizontal scrollbar */
    width: 10px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-cian);
    border-radius: 10px;
    border: 2px solid #0f172a; /* Add contrast */
}

.table-container table {
    width: 100%;
    min-width: 900px; /* Force overflow on smaller screens */
    border-collapse: separate;
    border-spacing: 0 8px;
}

/* Sticky Headers */
.table-container thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sticky-bg); /* Solid background for sticky header */
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

/* Visual Indicator for Horizontal Scroll */
.table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(5, 5, 5, 0.5), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-container.has-scroll-right::after {
    opacity: 1;
}

/* Modal Improvements */
.modal-overlay {
    padding: 2rem;
    overflow-y: auto;
}

.modal-card {
    max-height: 90vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

@media (min-width: 1025px) {
    .mobile-nav-toggle {
        display: none;
    }
}

/* --- Market Filter Label --- */
.market-filters-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.filter-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    margin-right: 4px;
}

@media (max-width: 768px) {
    .market-filters-container {
        display: none;
        /* Mantener oculto en móvil como los filtros */
    }
}

/* --- Enhanced Top Bar Actions --- */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: auto;
}

.language-selector-wrapper,
.market-filters-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.action-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    margin-right: 4px;
}

.settings-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-btn:hover {
    background: var(--card-border);
    border-color: var(--accent-cian);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
    transform: rotate(45deg);
}

.settings-btn .icon {
    font-size: 1.2rem;
}

/* --- SKU Card Market Badge --- */
.market-badge-sku {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Mobile Fixes for Reorganized actions --- */
@media (max-width: 768px) {
    .top-bar-actions {
        gap: 0.8rem;
    }

    .language-selector-wrapper .action-label,
    .market-filters-wrapper .action-label {
        display: none;
    }
}

/* --- Refined Header Style (Expert UI) --- */
.top-bar-refined {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1.5rem 2rem;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    border-radius: 0 0 15px 15px;
    margin-top: -2rem;
    margin-left: -2rem;
    margin-right: -2rem;
}

.header-main-control {
    flex: 1;
}

.market-selector-pro {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(15, 23, 42, 0.4);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: fit-content;
}

.pro-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-cian);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

.market-pill-group,
.lang-selector-pro {
    display: flex;
    gap: 10px;
}

.market-pill-btn,
.lang-pill-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.market-pill-btn:hover,
.lang-pill-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.market-pill-btn.active,
.lang-pill-btn.active {
    background: var(--accent-cian);
    color: var(--bg-dark);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.header-right-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.translate-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.settings-gear-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.settings-gear-btn:hover {
    background: var(--accent-cian);
    color: var(--bg-dark);
    transform: rotate(90deg);
}

/* --- Pro Back Button --- */
.btn-back-pro {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-back-pro:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-cian);
    border-color: var(--accent-cian);
}

/* --- Ficha 360 Visual Refinements --- */
.asset-preview-thumb-pro {
    width: 120px;
    height: 120px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid rgba(0, 242, 255, 0.2);
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.2);
    align-self: center;
    transition: all 0.3s;
}

.asset-preview-thumb-pro:hover {
    transform: scale(1.05);
    border-color: var(--accent-cian);
}

.view-header-pro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

/* Hidden File Input */
.hidden-upload {
    display: none !important;
}

.brand-insignia.uploading {
    opacity: 0.5;
    pointer-events: none;
}

.brand-insignia.uploading::after {
    content: "LOADING...";
    display: flex !important;
}

/* Asset & Branding Styles */
.asset-uploader-box {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
}

.asset-uploader-box:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-cian);
    transform: scale(1.05);
}

.tech-pill {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

.pill-vidrio {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cian);
    border: 1px solid rgba(0, 242, 255, 0.2);
}

.pill-pet {
    background: rgba(255, 242, 0, 0.1);
    color: #f2ff00;
    border: 1px solid rgba(255, 242, 0, 0.2);
}
/* Pipeline UI Fixes */
.sku-status-tag {
    display: inline-block;
    max-width: 85px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Matrix Table Styles */
.matrix-container {
    width: 100%;
    margin-top: 1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.4);
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.matrix-table th {
    background: rgba(15, 23, 42, 0.8);
    padding: 12px 15px;
    text-align: center;
    color: var(--accent-cian);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.matrix-table td {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.matrix-table .sticky-col {
    position: sticky;
    left: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 10;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.matrix-table th.sticky-col {
    top: 0;
    z-index: 11;
}

.matrix-category-row {
    background: rgba(0, 242, 255, 0.05) !important;
    font-weight: 800;
    color: var(--accent-cian);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.matrix-category-row td {
    padding: 15px !important;
    border-bottom: 2px solid rgba(0, 242, 255, 0.2) !important;
}

.matrix-table input {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    color: white;
    font-family: var(--font-mono);
    width: 80px;
    padding: 4px;
    text-align: right;
    border-radius: 4px;
    transition: 0.2s;
}

.matrix-table input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-cian);
    outline: none;
}

.matrix-table input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- SKU Management Card Fix --- */
.sku-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 242, 255, 0.2);
    /* Estructura industrial */
    border-radius: 6px;
    /* Más industrial, menos redondeado */
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: auto; /* Permite que la tarjeta sea compacta */
    align-self: start; /* Previene que se estire en el grid */
}

.sku-card:hover {
    border-color: var(--accent-cian);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.1);
    transform: translateY(-5px);
}

.sku-details {
    display: flex;
    flex-direction: column;
}

.sku-actions {
    display: flex;
    gap: 8px;
    margin-top: 1rem;
}

.sku-manager-btn {
    background: var(--accent-cian);
    color: #000;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.sku-manager-btn:hover {
    background: #00e0eb;
    box-shadow: 0 0 15px var(--accent-cian);
}

/* Ficha 360 Modal Overlay */
.ficha-360-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.9);
    backdrop-filter: blur(15px);
    z-index: 5000;
    /* Superpone a todo */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-left: calc(var(--sidebar-width) + 2rem);
    overflow-y: auto;
}

.ficha-360-container.active {
    display: flex;
}

.ficha-modal-wrapper {
    width: 100%;
    max-width: 1100px;
    background: rgba(16, 24, 39, 0.98);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    margin: auto;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header Sections */
.ficha-header-persistent {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ficha-header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.ficha-header-tags {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.ficha-tag-sm {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ficha-tag-accent {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cian);
    border-color: rgba(0, 242, 255, 0.2);
}

/* Tabs */
.ficha-tabs-pro {
    display: flex;
    gap: 0.5rem;
    padding: 0 2rem;
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.tab-btn-pro {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.tab-btn-pro:hover {
    color: #fff;
}

.tab-btn-pro.active {
    color: var(--accent-cian);
}

.tab-btn-pro.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-cian);
    box-shadow: 0 0 10px var(--accent-cian);
}

/* Body & Layout */
.ficha-content-scroller {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 242, 255, 0.2) transparent;
}

.ficha-content-scroller::-webkit-scrollbar {
    width: 6px;
}

.ficha-content-scroller::-webkit-scrollbar-thumb {
    background: rgba(0, 242, 255, 0.2);
    border-radius: 10px;
}

.ficha-grid-2col {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .ficha-grid-2col {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .ficha-modal-wrapper {
        height: 95vh;
        border-radius: 0;
    }
}

/* Sections & Cards */
.ficha-section-title {
    color: var(--accent-cian);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ficha-card-readonly {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
}

/* Footer Control */
.ficha-footer-sticky {
    padding: 1.5rem 2.5rem;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

.btn-cancel {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-save-cyan {
    padding: 12px 24px;
    background: var(--accent-cian);
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 242, 255, 0.2);
    transition: 0.3s;
}

.btn-save-cyan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 255, 0.3);
}

/* Kanban Board */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    height: calc(100% - 120px);
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-col {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    min-width: 320px;
    max-height: 100%;
}

.kanban-col-header {
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-main);
}

.kanban-col-header .col-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-col-header .task-count {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.kanban-cards-container {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 200px;
}

/* Task Cards */
.task-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}

.task-card:active {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.task-card:hover {
    border-color: rgba(0, 242, 255, 0.2);
    background: rgba(30, 41, 59, 0.9);
}

.task-card.dragging {
    opacity: 0.5;
    border: 1px dashed var(--accent-cian);
}

.task-card .task-priority {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.priority-Alta { color: #ff004c; }
.priority-Media { color: #fbbf24; }
.priority-Baja { color: #22c55e; }

.task-card .task-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    color: var(--text-main);
}

.task-card .task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.task-card .task-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-card .task-assignee {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-main);
    font-weight: 600;
}

.task-card .task-due {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card .task-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.btn-task-action {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-dim);
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

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

/* Drag & Drop Styles */
.kanban-col.drag-over {
    background: rgba(0, 242, 255, 0.03);
    border: 1px dashed var(--accent-cian);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1), toast-out 0.3s 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.error {
    border-color: rgba(255, 0, 76, 0.3);
    background: rgba(40, 10, 20, 0.95);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-20px); }
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.workspace-title {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.workspace-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Filters */
.filter-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(0,0,0,0.3);
    padding: 0.4rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.filter-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

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

.filter-btn.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: rgba(0,0,0,0.3);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

/* Kanban Board */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.kanban-column {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 500px;
}

.kanban-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.kanban-col-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.task-count {
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.70rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
}

/* Task Cards */
.task-card {
    background: var(--surface-bg);
    border: 1px solid rgba(255, 255, 255, 0.05); /* very subtle */
    border-radius: 12px;
    padding: 1.2rem;
    cursor: grab;
    transition: all 0.2s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.dept-pill {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dept-pill.mkt { background: rgba(236, 72, 153, 0.15); color: var(--dept-mkt); }
.dept-pill.fin { background: rgba(16, 185, 129, 0.15); color: var(--dept-fin); }
.dept-pill.start { background: rgba(139, 92, 246, 0.15); color: var(--dept-startup); }
.dept-pill.ops { background: rgba(245, 158, 11, 0.15); color: var(--dept-ops); }
.dept-pill.lab { background: rgba(6, 182, 212, 0.15); color: var(--dept-lab); }

.task-priority {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 600;
}

.task-priority.high { color: #ef4444; }

.task-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.task-content p {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 0.8rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.assignee {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
}

/* List View */
.list-view {
    display: none; /* hidden by default */
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th, .list-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.list-table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1px;
    background: rgba(0,0,0,0.2);
}

.list-table td {
    font-size: 0.9rem;
    color: var(--text-main);
}

.list-table tr:hover {
    background: rgba(255,255,255,0.02);
}

/* Show/Hide Logic */
.board-active .kanban-board { display: grid; }
.board-active .list-view { display: none; }

.list-active .kanban-board { display: none; }
.list-active .list-view { display: block; }

/* Workspace Header Buttons */
.filter-btn, .toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.filter-btn.active, .toggle-btn.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 8px rgba(0,0,0,0.2);
}

/* Brand Building - Real CSS Grid Masonry */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 10px;
    gap: 0 1.5rem;
    padding-bottom: 2rem;
    align-items: start;
}

/* Borderless Cards */
.brand-card {
    position: relative;
    border-radius: 16px;
    margin-bottom: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent;
    border: none;
    padding: 0;
}

.brand-card:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

/* Base Content Styling */
.brand-content {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

/* Premium Image Interaction */
.brand-content img, .brand-content video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center;
}

.brand-card:hover .brand-content img, 
.brand-card:hover .brand-content video {
    transform: scale(1.03);
}

/* Floating Delete Button on Hover */
.brand-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ff004c;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    pointer-events: none;
}

.brand-card:hover .brand-delete-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.brand-delete-btn:hover {
    background: rgba(255, 0, 76, 0.2);
    border-color: rgba(255, 0, 76, 0.5);
    color: #fff;
}

/* Gradient Overlay Footer */
.brand-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 1rem 1rem 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5;
    pointer-events: none;
}

.brand-card:hover .brand-footer {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* FigJam Style Notes */
.brand-card.note-card {
    background: linear-gradient(135deg, rgba(230, 248, 255, 0.9), rgba(153, 233, 255, 0.9));
    color: #0f172a;
    padding: 1.5rem;
    box-shadow: 2px 4px 12px rgba(0,0,0,0.2);
    transform: rotate(-1deg);
    border-radius: 12px;
}

.brand-card.note-card:hover {
    transform: rotate(0deg) scale(1.02);
    box-shadow: 4px 8px 16px rgba(0,0,0,0.3);
}

/* ==========================================================================
   BRAND BUILDING STUDIO - NEW MODULE
   ========================================================================== */

/* ---- VIEW 1: HOME (BOARDS LIST) ---- */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.board-card {
    height: 180px;
    border-radius: 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
}
.board-card-options-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 3px 9px;
    border-radius: 7px;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    position: relative;
    z-index: 5;
}
.board-card-options-btn:hover {
    background: rgba(0, 229, 255, 0.18) !important;
    border-color: var(--accent-cian) !important;
    color: var(--accent-cian) !important;
}

.board-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    background-image: var(--bg-url);
    opacity: 0.4;
    transition: all 0.5s ease;
    z-index: 0;
}
.board-card:hover::before {
    opacity: 0.6;
    transform: scale(1.05);
}

.board-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9) 0%, transparent 100%);
    z-index: 1;
}

.board-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cian);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.board-content {
    position: relative;
    z-index: 2;
}

.board-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.board-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.board-card-new {
    border: 2px dashed rgba(255,255,255,0.1);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    height: 180px;
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
}
.board-card-new:hover {
    border-color: var(--accent-cian);
    color: var(--accent-cian);
    background: rgba(0, 242, 255, 0.05);
}

/* ---- VIEW 2: CANVAS (INSIDE A BOARD) ---- */
.canvas-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: auto; /* Infinite scroll simulation */
    cursor: grab;
}
.canvas-container:active {
    cursor: grabbing;
}

.canvas-toolbar {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    padding: 8px;
    border-radius: 16px;
    display: flex;
    gap: 8px;
    z-index: 50;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.toolbar-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.toolbar-btn:hover {
    background: rgba(255,255,255,0.1);
}
.toolbar-btn.active-tool {
    background: var(--accent-cian);
    color: #000;
}

.canvas-item {
    position: absolute;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    backdrop-filter: blur(16px);
    cursor: default;
    transition: transform 0.2s;
    overflow: visible;
}
.canvas-item:hover {
    border-color: rgba(255,255,255,0.2);
    z-index: 10;
}
.canvas-item.dragging {
    cursor: grabbing;
    opacity: 0.85;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: none;
}

.item-img img {
    max-width: 300px;
    border-radius: 8px;
    display: block;
}

.item-note {
    width: 250px;
    padding: 1rem;
    background: rgba(254, 240, 138, 0.12);
    border: 1px solid rgba(254, 240, 138, 0.2);
}

.item-link {
    width: 280px;
    padding: 14px;
    background: var(--card-bg);
}

/* Action buttons on canvas items */
.item-actions-bar {
    position: absolute;
    top: -34px;
    right: 0;
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, top 0.15s;
    z-index: 30;
}
.canvas-item:hover .item-actions-bar {
    opacity: 1;
    pointer-events: auto;
    top: -38px;
}
.item-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: var(--modal-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.item-action-btn:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cian);
    transform: translateY(-1px);
}
.item-action-btn.danger:hover {
    background: rgba(248,113,113,0.18);
    border-color: #f87171;
}
.item-menu-dropdown {
    display: none;
    position: fixed; /* always fixed — escapes all stacking contexts */
    background: var(--modal-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.55);
    z-index: 9999;
    min-width: 160px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.item-menu-dropdown.open {
    display: block;
    animation: itemMenuFadeIn 0.12s ease;
}
@keyframes itemMenuFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
.item-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 9px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    white-space: nowrap;
}
.item-menu-dropdown button:hover {
    background: rgba(255,255,255,0.08);
}
.item-menu-dropdown button.danger {
    color: #f87171;
}
.item-menu-dropdown button.danger:hover {
    background: rgba(248,113,113,0.1);
}

.icon-selector-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-selector-btn:hover {
    background: rgba(255,255,255,0.08);
}
.icon-selector-btn.active {
    background: rgba(37,99,235,0.25);
    border-color: rgba(37,99,235,0.6);
}

.comment-badge {
    background: rgba(0, 242, 255, 0.15);
    color: var(--accent-cian);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---- VIEW 3: IMAGE ANNOTATION MODAL ---- */
.annotation-modal {
    background: var(--modal-bg);
    width: 90vw;
    height: 90vh;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    display: grid;
    grid-template-columns: 1fr 400px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.image-canvas-area {
    background: var(--deep-bg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-canvas-area img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.pin-marker {
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--accent-pink);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(255, 0, 76, 0.5);
    transform: translate(-50%, -50%);
    cursor: pointer;
    border: 3px solid white;
    transition: transform 0.2s;
    z-index: 10;
}
.pin-marker:hover, .pin-marker.active {
    transform: translate(-50%, -50%) scale(1.2);
}
.pin-marker.resolved {
    background: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
}

.comments-sidebar {
    background: rgba(15, 23, 42, 0.95);
    border-left: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-thread {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem;
}

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

.pin-ref {
    display: inline-flex;
    width: 20px;
    height: 20px;
    background: var(--accent-pink);
    color: white;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 8px;
}
.pin-ref.resolved {
    background: #10b981;
}

.comment-box {
    margin-top: 10px;
    padding-left: 28px;
}

.comment-author {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.comment-author .mention {
    color: var(--accent-cian);
}

.comment-text {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.4;
}

.comment-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--card-border);
    background: rgba(0,0,0,0.2);
}

.comment-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--card-border);
    color: white;
    border-radius: 8px;
    padding: 12px;
    min-height: 80px;
    resize: none;
    font-family: var(--font-sans);
    outline: none;
    margin-bottom: 10px;
}
.comment-input:focus {
    border-color: var(--accent-cian);
}

.resolve-btn {
    background: transparent;
    border: 1px solid #10b981;
    color: #10b981;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}
.resolve-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}


/* ========================================= */
/* BRAND BUILDING STUDIO STYLES (from demo)  */
/* ========================================= */
/* Top Navigation for Demo */
        .demo-nav {
            padding: 1.5rem 2rem;
            border-bottom: 1px solid var(--card-border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(15, 23, 42, 0.8);
            backdrop-filter: blur(12px);
            z-index: 100;
        }

        .demo-nav h1 {
            font-size: 1.0rem;
            font-weight: 800;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .tag-pro {
            font-size: 0.55rem;
            padding: 4px 8px;
            background: rgba(0, 242, 255, 0.1);
            color: var(--accent-cian);
            border-radius: 4px;
            text-transform: uppercase;
            letter-spacing: 1px;
            border: 1px solid rgba(0, 242, 255, 0.2);
        }

        .view-toggles {
            display: flex;
            gap: 4px;
            background: rgba(0, 0, 0, 0.2);
            padding: 4px;
            border-radius: 8px;
            border: 1px solid var(--card-border);
        }

        .toggle-btn {
            background: transparent;
            border: none;
            color: var(--text-dim);
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.65rem;
            font-weight: 700;
            transition: all 0.2s;
        }

        .toggle-btn.active {
            background: var(--accent-cian);
            color: #000;
        }

        /* View Container */
        #brand-view.active {
            display: flex;
            flex-direction: column;
        }
        
        .views-container {
            flex: 1;
            position: relative;
            overflow: hidden;
        }

        .view-pane {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: none;
            overflow-y: auto;
            padding: 2rem;
        }

        .view-pane.active {
            display: block;
            animation: fadeIn 0.3s ease;
        }

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

        /* ---- VIEW 1: HOME (BOARDS LIST) ---- */
        .home-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 3rem;
        }

        .search-bar {
            background: rgba(0, 0, 0, 0.2);
            border: 1px solid var(--card-border);
            padding: 10px 16px;
            border-radius: 12px;
            width: 300px;
            color: white;
            font-family: var(--font-sans);
            font-size: 0.85rem;
            outline: none;
            transition: all 0.3s;
        }
        .search-bar:focus {
            border-color: var(--accent-cian);
            box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
        }

        .btn-primary {
            background: var(--accent-cian);
            color: #000;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            font-family: var(--font-sans);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 242, 255, 0.3);
        }

        .boards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 2rem;
        }

        .board-card {
            border-radius: 12px;
            position: relative;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .board-card:hover {
            transform: translateY(-2px);
            border-color: rgba(255,255,255,0.15) !important;
            background: rgba(255,255,255,0.05) !important;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        }

        .board-title {
            font-size: 1.2rem;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .board-meta {
            font-size: 0.8rem;
            color: var(--text-dim);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .board-card-new {
            border: 2px dashed rgba(255,255,255,0.1);
            background: transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 10px;
            height: 180px;
            border-radius: 16px;
            cursor: pointer;
            color: var(--text-dim);
            transition: all 0.2s;
        }
        .board-card-new:hover {
            border-color: var(--accent-cian);
            color: var(--accent-cian);
            background: rgba(0, 242, 255, 0.05);
        }

        /* ---- VIEW 2: CANVAS (INSIDE A BOARD) ---- */
        .canvas-container {
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: #f8f9fa;
            background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
            background-size: 24px 24px;
            overflow: auto; /* Infinite scroll simulation */
            cursor: grab;
        }
        .canvas-container:active {
            cursor: grabbing;
        }

        .canvas-toolbar {
            position: absolute;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%);
            z-index: 50;
        }

        .toolbar-btn {
            border: none;
            background: transparent;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 500;
        }
        .toolbar-btn:hover {
            background: rgba(0,0,0,0.06) !important;
        }
        .toolbar-btn.active-tool {
            background: var(--accent-cian);
            color: #000;
        }

        .canvas-item {
            position: absolute;
            background: white;
            border-radius: 8px;
            padding: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.06);
            border: 1px solid rgba(0,0,0,0.04);
            cursor: grab;
            transition: box-shadow 0.2s, transform 0.2s;
        }
        .canvas-item:hover {
            box-shadow: 0 8px 24px rgba(0,0,0,0.1);
            z-index: 10;
        }
        .canvas-item.dragging {
            cursor: grabbing;
            opacity: 0.9;
            box-shadow: 0 16px 48px rgba(0,0,0,0.15);
            transition: none;
        }

        .item-img img {
            max-width: 300px;
            border-radius: 8px;
            display: block;
        }

        .item-note {
            width: 240px;
            padding: 16px;
            background: #fef9c3;
            color: #1a202c;
            border: 1px solid rgba(234,179,8,0.3);
            box-shadow: 0 4px 16px rgba(0,0,0,0.07);
            border-radius: 10px;
        }
        .item-note:hover {
            box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        }
        .item-link {
            width: 280px;
            padding: 14px;
            background: white;
        }

        .item-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
            font-size: 0.75rem;
            color: var(--text-dim);
            padding: 0 4px;
        }

        .comment-badge {
            background: rgba(0, 242, 255, 0.15);
            color: var(--accent-cian);
            padding: 2px 8px;
            border-radius: 10px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* ---- VIEW 3: IMAGE ANNOTATION MODAL ---- */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(10px);
            display: none;
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }
        .modal-overlay.active {
            display: flex;
        }

        .annotation-modal {
            background: var(--modal-bg);
            width: 90vw;
            height: 90vh;
            border-radius: 20px;
            border: 1px solid var(--card-border);
            display: grid;
            grid-template-columns: 1fr 400px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        }

        .image-canvas-area {
            background: var(--deep-bg);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .image-canvas-area img {
            max-width: 90%;
            max-height: 90%;
            object-fit: contain;
            box-shadow: 0 0 50px rgba(0,0,0,0.5);
        }

        .pin-marker {
            position: absolute;
            width: 32px;
            height: 32px;
            background: var(--accent-pink);
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 800;
            font-size: 0.9rem;
            box-shadow: 0 4px 15px rgba(255, 0, 76, 0.5);
            transform: translate(-50%, -50%);
            cursor: pointer;
            border: 3px solid white;
            transition: transform 0.2s;
            z-index: 10;
        }
        .pin-marker:hover, .pin-marker.active {
            transform: translate(-50%, -50%) scale(1.2);
        }
        .pin-marker.resolved {
            background: #10b981;
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.5);
        }

        .comments-sidebar {
            background: rgba(15, 23, 42, 0.95);
            border-left: 1px solid var(--card-border);
            display: flex;
            flex-direction: column;
        }

        .sidebar-header {
            padding: 1.5rem;
            border-bottom: 1px solid var(--card-border);
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }

        .close-btn {
            background: transparent;
            border: none;
            color: var(--text-dim);
            font-size: 1.5rem;
            cursor: pointer;
        }

        .comments-list {
            flex: 1;
            overflow-y: auto;
            padding: 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .comment-thread {
            background: rgba(255,255,255,0.02);
            border: 1px solid var(--card-border);
            border-radius: 12px;
            padding: 1rem;
        }

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

        .pin-ref {
            display: inline-flex;
            width: 20px;
            height: 20px;
            background: var(--accent-pink);
            color: white;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            font-weight: bold;
            margin-right: 8px;
        }
        .pin-ref.resolved {
            background: #10b981;
        }

        .comment-box {
            margin-top: 10px;
            padding-left: 28px;
        }

        .comment-author {
            font-weight: 600;
            color: var(--text-main);
            font-size: 0.9rem;
            margin-bottom: 4px;
        }
        .comment-author .mention {
            color: var(--accent-cian);
        }

        .comment-text {
            color: var(--text-dim);
            font-size: 0.85rem;
            line-height: 1.4;
        }

        .comment-input-area {
            padding: 1.5rem;
            border-top: 1px solid var(--card-border);
            background: rgba(0,0,0,0.2);
        }

        .comment-input {
            width: 100%;
            background: rgba(255,255,255,0.05);
            border: 1px solid var(--card-border);
            color: white;
            border-radius: 8px;
            padding: 12px;
            min-height: 80px;
            resize: none;
            font-family: var(--font-sans);
            outline: none;
            margin-bottom: 10px;
        }
        .comment-input:focus {
            border-color: var(--accent-cian);
        }

        .resolve-btn {
            background: transparent;
            border: 1px solid #10b981;
            color: #10b981;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.7rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .resolve-btn:hover {
            background: rgba(16, 185, 129, 0.1);
        }

        /* Mockup specific fixes */
        .mockup-img {
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, #1e293b, #0f172a);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 4rem;
        }

/* ── Toast Notifications ─────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 380px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    pointer-events: all;
    cursor: pointer;
    animation: toast-in 0.35s cubic-bezier(0.16,1,0.3,1) forwards;
    border: 1px solid rgba(255,255,255,0.08);
}

.toast.hide {
    animation: toast-out 0.3s ease forwards;
}

.toast-success { background: rgba(16, 185, 129, 0.18); border-color: rgba(16,185,129,0.4); }
.toast-error   { background: rgba(239, 68,  68,  0.18); border-color: rgba(239,68,68,0.4);   }
.toast-warning { background: rgba(245, 158, 11,  0.18); border-color: rgba(245,158,11,0.4);  }
.toast-info    { background: rgba(0,   188, 212, 0.18); border-color: rgba(0,188,212,0.4);   }

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }
.toast-close {
    flex-shrink: 0;
    opacity: 0.5;
    font-size: 1rem;
    line-height: 1;
    transition: opacity 0.2s;
}
.toast-close:hover { opacity: 1; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(60px) scale(0.92); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0)    scale(1);    }
    to   { opacity: 0; transform: translateX(60px) scale(0.92); }
}

@media (max-width: 1024px) {
    #toast-container {
        bottom: 16px;
        right: 12px;
        left: 12px;
    }
    .toast {
        min-width: unset;
        max-width: 100%;
    }
}


.gsearch-item:hover { background: rgba(0,188,212,0.08) !important; }

@keyframes sync-pulse {
    0%,100% { transform: scale(1);   opacity: 1;   }
    50%      { transform: scale(1.5); opacity: 0.5; }
}
.sync-active { animation: sync-pulse 1.2s ease infinite; }

/* ── Skeleton Loaders ────────────────────────────────────────────────────── */
@keyframes skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease infinite;
    border-radius: 6px;
    display: inline-block;
}

/* ── Semáforo Dashboard Cards ──────────────────────────────────────────── */
@keyframes semaforo-rojo-pulse {
    0%, 100% { border-color: rgba(255, 77, 77, 0.6); box-shadow: 0 0 8px rgba(255, 77, 77, 0.15); }
    50%      { border-color: rgba(255, 77, 77, 1); box-shadow: 0 0 18px rgba(255, 77, 77, 0.35); }
}
.semaforo-rojo {
    border: 1.5px solid rgba(255, 77, 77, 0.6) !important;
    animation: semaforo-rojo-pulse 2s ease-in-out infinite;
}
.semaforo-amarillo {
    position: relative;
}
.semaforo-amarillo .semaforo-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.semaforo-verde {
    border: 1.5px solid rgba(34, 197, 94, 0.35) !important;
    transition: border-color 0.5s;
}

/* ── Skeleton KPI block ──────────────────────────────────────────────── */
.skeleton-kpi {
    padding: 1rem 1.25rem;
}
.skeleton-kpi .skeleton-label {
    height: 10px;
    width: 70%;
    margin-bottom: 10px;
}
.skeleton-kpi .skeleton-value {
    height: 24px;
    width: 55%;
    margin-bottom: 8px;
}
.skeleton-kpi .skeleton-sub {
    height: 8px;
    width: 40%;
}

.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    overflow: hidden;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.skeleton-title  { height: 20px; width: 60%; margin-bottom: 14px; }
.skeleton-text   { height: 12px; width: 80%; }
.skeleton-text-sm { height: 10px; width: 45%; }
.skeleton-circle { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton-badge  { height: 22px; width: 80px; border-radius: 20px; }

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ── Welcome Message — Disney Edition ────────────────────────────────────── */
#welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 40%, rgba(0,229,255,0.06) 0%, rgba(5,5,5,0.92) 70%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
#welcome-overlay.visible { opacity: 1; }
#welcome-overlay.hiding  { opacity: 0; transition: opacity 1.2s ease; }

#welcome-inner {
    text-align: center;
    padding: 2rem;
    max-width: 560px;
    position: relative;
    z-index: 2;
}

.welcome-line {
    margin: 0;
    opacity: 0;
    transform: translateY(18px) scale(0.97);
    transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.welcome-line.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#welcome-line1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 200;
    color: #f0f2f5;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1.2rem;
    text-shadow: 0 0 40px rgba(0,229,255,0.15);
}

#welcome-line2 {
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    font-weight: 300;
    color: rgba(160, 170, 178, 0.8);
    letter-spacing: 0.02em;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    font-style: italic;
}

#welcome-line3 {
    font-size: clamp(0.72rem, 1.5vw, 0.85rem);
    font-weight: 600;
    color: var(--accent-cian);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0;
    text-shadow: 0 0 20px rgba(0,229,255,0.4);
}
#welcome-line3.show { opacity: 0.85; }

/* Welcome particles canvas */
#welcome-particles {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* ── View Transitions — Cinematic ───────────────────────────────────────── */
.view-section.active {
    animation: viewEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* ── Card Entrance Stagger ──────────────────────────────────────────────── */
.card-animate-in {
    animation: cardFloat 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardFloat {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Card Hover Glow ────────────────────────────────────────────────────── */
.card:hover {
    border-color: rgba(0, 229, 255, 0.25);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 229, 255, 0.05);
}

/* ── KPI Counter Pulse ──────────────────────────────────────────────────── */
.kpi-value-animate {
    animation: kpiPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes kpiPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.08); color: var(--accent-cian); }
    100% { transform: scale(1); }
}

/* ── Button Ripple ──────────────────────────────────────────────────────── */
.btn-ripple {
    position: relative;
    overflow: hidden;
}
.btn-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(0,229,255,0.3) 0%, transparent 60%);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.5s, opacity 0.5s;
    pointer-events: none;
}
.btn-ripple:active::after {
    opacity: 1;
    transform: scale(2.5);
    transition: transform 0s, opacity 0s;
}

/* ── Sidebar Glow Line ──────────────────────────────────────────────────── */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(0,229,255,0.15) 30%, rgba(0,229,255,0.25) 50%, rgba(0,229,255,0.15) 70%, transparent 100%);
    z-index: 1;
}

/* ── Nav Item Hover Glow ────────────────────────────────────────────────── */
.nav-item:hover {
    text-shadow: 0 0 12px rgba(0,229,255,0.25);
}
.nav-item.active {
    text-shadow: 0 0 15px rgba(0,229,255,0.3);
}

/* ── Toast Slide-in ─────────────────────────────────────────────────────── */
.toast {
    animation: toastSlide 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.hide {
    animation: toastOut 0.35s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes toastSlide {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(40px) scale(0.9); }
}

/* ── Confetti Container ─────────────────────────────────────────────────── */
#confetti-canvas {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
}

/* Aurora removed — caused scroll overflow via 200% pseudo-element */

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE SAFARI FIXES — Prevents content clipping & horizontal overflow
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Cards: prevent overflow beyond viewport */
    .card, .glass-effect {
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    /* Big values in dashboard cards — prevent text from pushing card wider */
    .big-value, .metric-value {
        overflow-wrap: break-word;
        word-break: break-all;
        max-width: 100%;
    }

    /* Bento grid items — prevent card-large/card-medium from exceeding viewport */
    .bento-grid .card {
        min-width: 0;
        overflow: hidden;
    }

    /* China view tabs — horizontal scroll on small screens */
    #china-view .view-header-pro {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    #china-view .view-header-pro > div:last-child {
        width: 100%;
        flex-wrap: wrap;
    }

    /* China tab buttons container — scrollable */
    #china-view .view-header-pro div[style*="gap:4px"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap !important;
        max-width: 100%;
        padding-bottom: 4px;
    }
    #china-view .view-header-pro div[style*="gap:4px"]::-webkit-scrollbar {
        display: none;
    }

    /* China tab buttons — compact on mobile */
    .china-tab-btn {
        padding: 5px 10px !important;
        font-size: 0.7rem !important;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* China categoria detalle — full width content */
    #china-categoria-detalle {
        padding: 0.75rem !important;
    }
    #china-categoria-detalle .card,
    #china-categoria-detalle .glass-effect {
        max-width: 100%;
        overflow: hidden;
    }

    /* Lab estaciones grid — single column on mobile */
    #china-lab-estaciones {
        grid-template-columns: 1fr !important;
        max-width: 100%;
    }

    /* Prevent any element from exceeding viewport */
    .view-section * {
        max-width: 100%;
        box-sizing: border-box;
    }
    .view-section img, .view-section video {
        max-width: 100%;
        height: auto;
    }

    /* View header actions — wrap on mobile */
    .view-header-pro > div {
        max-width: 100%;
    }
    .view-header-actions {
        width: 100%;
    }

    /* Top bar refined — settings gear must not overlap filter */
    .top-bar-refined .settings-gear-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
    }
    #pallet-layout {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }
    #pallet-controls {
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }
    #container-layout {
        flex-direction: column !important;
        height: auto !important;
        overflow: visible !important;
    }
    #container-controls {
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }
}
