:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --input-bg: rgba(15, 23, 42, 0.6);

    /* ── Variables que estaban siendo usadas sin definir (fallbacks seguros) ── */
    --secondary: #8b5cf6;
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --surface-light: rgba(255, 255, 255, 0.04);
    --surface-bg: rgba(30, 41, 59, 0.5);

    /* ── Tokens responsive (spacing/radius/touch/tipografía fluida) ── */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --touch-min: 44px;
    --container-pad: clamp(12px, 4vw, 32px);
    --modal-pad: clamp(16px, 4vw, 32px);
    --modal-max: 720px;
}

.light-theme {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #cbd5e1;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --input-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --secondary: #8b5cf6;
    --glass-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    --surface-light: rgba(15, 23, 42, 0.04);
    --surface-bg: rgba(241, 245, 249, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.3) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.3) 0, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background 0.4s, color 0.4s;
}

body.light-theme {
    background-image: none;
}

.light-theme .glass-header, 
.light-theme .glass-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view.active {
    display: block;
    opacity: 1;
}

.view.app-layout.active {
    display: flex;
}

.view.landing-page.active {
    display: block;
}

/* Glassmorphism Utilities */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.user-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.username-text {
    font-weight: 600;
    color: var(--primary);
}

/* Typography & Layout */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.logo span {
    color: var(--primary);
    font-weight: 300;
}

/* Login Screen specific legacy classes removed to fix layout issues */

.login-box {
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box p {
    color: var(--text-muted);
    margin: 1rem 0 2rem 0;
    font-size: 0.9rem;
}

/* Forms */
.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.4);
}

.error-msg {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 1rem;
    min-height: 1.2em;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    width: 100%;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary.glow {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
}
.btn-text:hover {
    color: var(--text-main);
}

.btn-delete {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
}

.btn-delete:hover {
    background: #ff6b81;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.5);
}

.btn-icon {
    background: transparent;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-back {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 0.7rem 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.btn-back:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 1rem;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.light-theme .theme-btn {
    background: rgba(0, 0, 0, 0.05);
}

.theme-btn:hover {
    background: var(--primary);
    color: white;
    transform: rotate(15deg) scale(1.1);
}

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

.header-actions button {
    width: auto;
}

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

.scale-card {
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.scale-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.scale-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.scale-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Scale Details */
.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.scale-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}
.indicator.online { background: var(--success); box-shadow: 0 0 8px var(--success); }

.plu-toolbar {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.toolbar-right {
    display: flex;
    gap: 1rem;
}

.table-container {
    overflow-x: auto;
}

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

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

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: none;
}

.editable-cell {
    background: rgba(0,0,0,0.2);
    border: 1px solid transparent;
    padding: 0.5rem;
    border-radius: 4px;
    color: white;
    width: 100%;
}
.editable-cell:focus {
    border-color: var(--primary);
    outline: none;
}
.modified {
    border-left: 2px solid var(--primary) !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}
.btn-delete:hover {
    background: var(--danger);
    color: white;
}

.terminal-log {
    margin-top: 5rem;
}

.terminal-log pre {
    background: #000;
    color: #0f0;
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-y: auto;
    max-height: 200px;
}
.mt-4 { margin-top: 1.5rem; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-content h3 { margin-bottom: 1.5rem; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}
.modal-actions button { width: auto; }

.options-header {
    margin-bottom: 1.5rem;
}

.options-header h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.option-card:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
}

.option-card:hover h4 {
    color: var(--primary);
}

.option-card.warning:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.18);
}

.option-card.warning:hover h4 {
    color: #f59e0b;
}

.option-card.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.55);
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.18);
}

.option-card.danger:hover h4 {
    color: var(--danger);
}

.option-card .option-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.option-card h4 {
    font-size: 1.05rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.option-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.option-card.active {
    background: var(--primary);
    border-color: var(--primary);
}

.option-card.active h4, .option-card.active p {
    color: white;
}

.option-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.option-card.disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    box-shadow: none;
}
.option-card.disabled:hover h4 {
    color: var(--text-main);
}

/* PLU Management Styles */
.search-toolbar {
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.premium-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 1rem 1.5rem 1rem 3.2rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
    outline: none;
}

.premium-search:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.glass-table tr {
    transition: background 0.2s;
}

.glass-table td {
    padding: 0.75rem 1.2rem !important;
}

.btn-action-table {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    width: 100px !important;
    justify-content: center;
}

.header-actions-inline {
    display: flex;
    gap: 15px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.weight-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    padding: 2rem;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    margin: 1rem 0;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}

/* Custom scrollbar for modals */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Weight Display */
.weight-display-container {
    padding: 3rem;
    text-align: center;
    margin: 2rem auto;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.weight-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.weight-value {
    font-size: 8rem;
    font-weight: 700;
    font-family: 'monospace';
    color: white;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    line-height: 1;
}

.weight-unit {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.5rem;
}

.weight-indicator {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 20px;
}

.weight-info {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.section-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Transitions */
.section-content {
    animation: fadeIn 0.3s ease;
}

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

/* --- APP LAYOUT (Sidebar & Dashboard) --- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #0B0F19; /* Darker background from image */
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg, #111827);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 1rem;
    text-align: center;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 1.5rem;
    gap: 0.25rem;
    overflow-y: auto;
}

/* Subtle Scrollbar for Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}

.light-theme .nav-item {
    color: #64748b;
}

.light-theme .nav-item:hover, .light-theme .nav-item.active {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: #2563EB; /* Primary blue from image */
    color: white;
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 1rem 0;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Topbar */
.topbar {
    height: 70px;
    background: transparent;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 2rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(17, 24, 39, 0.7);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.05);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3B82F6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.icon-btn:hover { color: white; }

/* Content Container */
.content-container {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

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

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

.metric-card {
    background: #171E2D; /* Dark card bg */
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s;
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.1);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-icon.blue { background: rgba(37, 99, 235, 0.2); color: #60A5FA; }
.metric-icon.green { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.metric-icon.orange { background: rgba(245, 158, 11, 0.2); color: #FBBF24; }
.metric-icon.purple { background: rgba(139, 92, 246, 0.2); color: #A78BFA; }

.metric-info h4 {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric-info p {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

/* Fix for app-layout display overriding */
.view.active.app-layout {
    display: flex !important;
}

/* Make scale-detail-view fit well as a content-view */
#scale-detail-view.content-view {
    padding: 0;
    position: relative;
}
#scale-detail-view.content-view .glass-header {
    background: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 0 0 2rem 0;
    margin-bottom: 2rem;
    position: static;
}
#scale-detail-view.content-view .container {
    margin: 0;
    padding: 0;
    max-width: 100%;
}

/* Premium Management Styles */
.metric-card.clickable {
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}
.metric-card.clickable:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

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

.compact-user-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.compact-user-card:hover {
    background: rgba(255,255,255,0.08);
    transform: translateX(5px);
    border-color: rgba(255,255,255,0.2);
}

.user-avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Premium Scale Cards (Based on Reference Image) */
.premium-scales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.premium-scale-card {
    background: var(--card-bg, #1A1D26);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}

.light-theme .premium-scale-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.light-theme .card-title-main {
    color: #1e293b;
}

.light-theme .card-data-row {
    background: #f8fafc;
}

.light-theme .data-value {
    color: #334155;
}

.premium-scale-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.badge-premium {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.card-title-main {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.card-subtitle-main {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.card-icon-right {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.05);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.card-data-row {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.data-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.data-value {
    font-size: 0.9rem;
    color: #E2E8F0;
    font-weight: 500;
}

.btn-open-premium {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.05);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.premium-scale-card:hover .btn-open-premium {
    background: var(--primary);
    color: white;
}

/* Light Mode Final Touches */
.light-theme .glass-card, .light-theme .card {
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.light-theme input, .light-theme select, .light-theme textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
}

.light-theme input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.light-theme .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.light-theme .btn-secondary:hover {
    background: #e2e8f0;
}

.light-theme .nav-divider {
    border-color: #e2e8f0;
}

.light-theme h1, .light-theme h2, .light-theme h3, .light-theme h4 {
    color: #0f172a;
}

.light-theme .card-data-row {
    border: 1px solid #f1f5f9;
}

.light-theme .compact-user-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.light-theme .compact-user-card:hover {
    background: #f8fafc;
}

/* Tickets & Maintenance Styles */
.ticket-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s;
}

.ticket-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.ticket-status-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pendiente { background: rgba(239, 68, 68, 0.2); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-encamino { background: rgba(59, 130, 246, 0.2); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.3); }
.status-enreparacion { background: rgba(245, 158, 11, 0.2); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-finalizado { background: rgba(16, 185, 129, 0.2); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }

.ticket-history-item {
    border-left: 2px solid var(--primary);
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.ticket-history-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

/* Navigation Badges */
.nav-item {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Sidebar Section Labels */
.nav-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: var(--text-muted);
    margin: 1.5rem 1.5rem 0.5rem;
    font-weight: 700;
    opacity: 0.6;
}

/* Slimmer Sidebar Items */
.sidebar-nav .nav-item {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

/* --- Novedades Premium Forum Styles --- */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 5rem;
}

.news-forum-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--glass-shadow);
}

.news-forum-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 15px rgba(59, 130, 246, 0.2);
}

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

.news-author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.news-author-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.news-meta {
    display: flex;
    flex-direction: column;
}

.news-author-name {
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

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

.news-body {
    line-height: 1.7;
    color: #CBD5E1;
    font-size: 1.05rem;
}

.news-title-link {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
    display: block;
}

.news-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-actions-admin {
    display: flex;
    gap: 1rem;
}

.btn-action-pill {
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-edit-pill {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-edit-pill:hover {
    background: var(--primary);
    color: white;
}

.btn-delete-pill {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-delete-pill:hover {
    background: #ef4444;
    color: white;
}

/* --- UI Fixes for Novedades --- */
#btn-add-news {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    height: fit-content;
    width: auto;
}

/* Fix for unreadable Select menus in Dark Mode */
select.premium-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

select.premium-input option {
    background-color: #1E293B; /* Dark background for options */
    color: white;
    padding: 10px;
}

/* Ensure modal fields don't have white flash */
.premium-input {
    color-scheme: dark;
}

/* Custom Switch */
.switch-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-main);
}

.switch-label input {
    display: none;
}

.slider {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Backup System Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 34px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--primary);
}
input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}
.backup-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.backup-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.backup-status-dot.success { 
    background: #10b981; 
    box-shadow: 0 0 10px #10b981; 
}

.settings-overlay {
    transition: all 0.3s ease;
}
.settings-overlay.active {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}

/* --- Login Landing Page Premium Styles --- */
.login-page-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    overflow: hidden;
    position: relative;
}

.login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 1200px;
    gap: 4rem;
    padding: 2rem;
    z-index: 10;
}

/* Info Side (Landing) */
.login-info-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
}

.landing-logo {
    max-height: 50px;
    margin-bottom: 3rem;
}

.badge-new {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.landing-hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.landing-desc {
    font-size: 1.2rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 3rem;
    max-width: 500px;
}

.landing-features {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 4rem;
}

.l-feature {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.l-icon {
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.l-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.l-text p {
    color: #64748b;
    font-size: 0.9rem;
}

.landing-stats {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
}

.stat-item h2 {
    font-size: 2rem;
    font-weight: 800;
    color: #6366f1;
}

.stat-item p {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.landing-footer-msg {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 2rem;
    font-size: 0.9rem;
    color: #475569;
}

.landing-link {
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.landing-link:hover {
    color: #818cf8;
}

/* Login Side */
.login-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box-premium {
    width: 100%;
    max-width: 450px;
    padding: 3.5rem;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #64748b;
    margin-bottom: 2.5rem;
}

.input-group-premium {
    margin-bottom: 1.5rem;
}

.input-group-premium label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.6rem;
}

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

.input-icon {
    position: absolute;
    left: 1.2rem;
    font-size: 1.1rem;
    opacity: 0.5;
}

.input-wrapper input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 1.1rem 1.1rem 1.1rem 3.2rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
    outline: none;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.btn-login-main {
    width: 100%;
    padding: 1.2rem;
    border-radius: 14px;
    background: #6366f1;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.btn-login-main:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.btn-login-main span {
    font-size: 1.2rem;
}

.error-msg-fancy {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 1.5rem;
    text-align: center;
    min-height: 20px;
}

.login-extra-info {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.75rem;
    color: #475569;
}

/* Animated Blobs */
.bg-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    border-radius: 50%;
    z-index: 1;
    filter: blur(40px);
}

.blob-1 {
    top: -100px;
    right: -100px;
    animation: blobMove 20s infinite alternate;
}

.blob-2 {
    bottom: -150px;
    left: -100px;
    animation: blobMove 25s infinite alternate-reverse;
}

@keyframes blobMove {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.2); }
}

/* Responsive */
@media (max-width: 1024px) {
    .login-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        max-width: 600px;
        text-align: center;
    }
    .landing-logo { margin: 0 auto 2rem auto; }
    .landing-desc { margin-left: auto; margin-right: auto; }
    .landing-features { display: none; }
    .landing-hero h1 { font-size: 2.5rem; }
    .landing-stats { justify-content: center; }
}

/* AI Focus & Scrollable Landing Styles */
.scrollable-content {
    max-height: 100vh;
    overflow-y: auto;
    padding-right: 1rem;
}
.scrollable-content::-webkit-scrollbar {
    width: 6px;
}
.scrollable-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.sticky-side {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    align-items: center;
}

.badge-ai {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    color: #a855f7;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.ai-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 5rem;
}

.ai-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 1.5rem;
    border-radius: 16px;
    transition: all 0.3s ease;
}
.ai-card:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-5px);
    border-color: rgba(168, 85, 247, 0.3);
}

.ai-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
}

.ai-card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: white;
}

.ai-card p {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

.landing-secondary-info {
    margin-top: 4rem;
    padding-bottom: 4rem;
}

.divider-line {
    width: 60px;
    height: 4px;
    background: #6366f1;
    border-radius: 2px;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: white;
}

.landing-desc-small {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* --- Full Landing Page Redesign --- */
.login-page-full {
    background: #0f172a;
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}

.landing-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 3rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    max-height: 40px;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 3rem 4rem 3rem;
    position: relative;
}

.landing-grid-hero {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 5rem;
    align-items: center;
}

.hero-content h1 {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.4rem;
    color: #94a3b8;
    line-height: 1.6;
    max-width: 700px;
    margin-bottom: 4rem;
}

.ai-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.ai-feature-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 2rem;
    border-radius: 20px;
    transition: transform 0.3s;
}

.ai-feature-card:hover {
    transform: translateY(-10px);
    border-color: #6366f1;
}

.f-icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
.ai-feature-card h4 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.ai-feature-card p { font-size: 0.9rem; color: #64748b; }

/* Metrics Section */
.metrics-section {
    padding: 8rem 0;
    background: #0b1120;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.metrics-grid-full {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.stat-box-large h2 {
    font-size: 4rem;
    font-weight: 800;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.stat-box-large p {
    font-size: 1rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Company Info Section */
.company-info-section {
    padding: 10rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.info-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8rem;
    align-items: center;
}

.info-text h2 {
    font-size: 3rem;
    margin: 1.5rem 0 2rem 0;
}

.info-text p {
    font-size: 1.2rem;
    color: #94a3b8;
    line-height: 1.7;
    margin-bottom: 3rem;
}

.info-features-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.info-feature-item {
    display: flex;
    gap: 2rem;
}

.if-icon {
    font-size: 2rem;
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.if-text strong { font-size: 1.3rem; display: block; margin-bottom: 0.5rem; }
.if-text p { font-size: 1rem; color: #64748b; margin: 0; }

.btn-primary-glow {
    display: inline-block;
    padding: 1.2rem 2.5rem;
    background: #6366f1;
    color: white;
    text-decoration: none;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s;
}

.btn-primary-glow:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.6);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.mouse {
    width: 24px;
    height: 40px;
    border: 2px solid #64748b;
    border-radius: 20px;
    margin: 1rem auto;
    position: relative;
}

.mouse::before {
    content: "";
    width: 4px;
    height: 8px;
    background: #6366f1;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    animation: scroll 2s infinite;
}

@keyframes scroll {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 15px); opacity: 0; }
}

.landing-footer-simple {
    padding: 4rem 3rem;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: #475569;
}

/* responsive */
@media (max-width: 1200px) {
    .landing-grid-hero, .info-content-wrapper {
        grid-template-columns: 1fr;
        gap: 4rem;
        text-align: center;
    }
    .hero-content h1 { font-size: 3rem; }
    .ai-cards-container { grid-template-columns: 1fr; }
    .hero-desc { margin-left: auto; margin-right: auto; }
}

/* --- Fast & Clean Landing Login --- */
.login-landing-clean {
    background: #0f172a;
    color: white;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.view.active.login-landing-clean {
    display: flex !important;
    flex-direction: column;
}

.login-logo-header {
    margin-bottom: 2rem;
    text-align: left;
}

.login-logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.landing-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.login-hero {
    margin-bottom: 3rem;
}

.hero-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
}

.badge-tech {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.hero-info h1 {
    font-size: 2.8rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.feature-list-simple {
    list-style: none;
    padding: 0;
}
.feature-list-simple li {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #cbd5e1;
}
.feature-list-simple li span { color: #22c55e; font-weight: bold; }

/* Login Card */
.login-card-simple {
    background: #1e293b;
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.login-card-simple h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.form-group-simple { margin-bottom: 1.5rem; }
.form-group-simple label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: #94a3b8; }
.form-group-simple input {
    width: 100%;
    padding: 1rem;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: white;
}
.form-group-simple input:focus { border-color: #6366f1; outline: none; }

.btn-submit-fast {
    width: 100%;
    padding: 1.1rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-submit-fast:hover { background: #4f46e5; }

/* Company Info */
.company-section-clean {
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 4rem;
}

.company-grid-clean {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
}

.company-text h2 { margin-bottom: 1.5rem; }
.company-text p { color: #94a3b8; line-height: 1.6; }

.company-stats-simple {
    display: flex;
    gap: 3rem;
    justify-content: center;
    align-items: center;
}

.stat-box { text-align: center; }
.stat-val { font-size: 2.5rem; font-weight: 800; color: #6366f1; display: block; }
.stat-lab { font-size: 0.8rem; color: #64748b; text-transform: uppercase; }

.login-footer-clean {
    margin-top: 6rem;
    text-align: center;
    color: #475569;
    font-size: 0.8rem;
}

@media (max-width: 1200px) {
    .hero-info h1 { font-size: 2.5rem; }
    .landing-container { max-width: 1000px; }
}

@media (max-width: 1024px) {
    .hero-info h1 { font-size: 2.2rem; }
    .hero-columns { gap: 2rem; }
    .login-hero { margin-bottom: 3rem; }
}

@media (max-width: 900px) {
    .hero-columns, .company-grid-clean { 
        grid-template-columns: 1fr; 
        gap: 3rem; 
        text-align: center; 
    }
    .login-logo-header { margin-bottom: 2rem; display: flex; justify-content: center; }
    .company-stats-simple { justify-content: center; }
    .feature-list-simple li { justify-content: center; }
}

@media (max-width: 480px) {
    .hero-info h1 { font-size: 1.8rem; }
    .landing-container { padding: 2rem 1.5rem; }
    .login-card-simple { padding: 2rem 1.2rem; }
    .stat-val { font-size: 1.8rem; }
}

@media (max-height: 800px) {
    .landing-container { padding-top: 1rem; }
    .login-logo-header { margin-bottom: 1rem; }
    .login-hero { margin-bottom: 1.5rem; }
    .hero-info h1 { font-size: 2rem; }
    .login-card-simple { padding: 2rem; }
    .company-section-clean { padding-top: 2rem; }
    .login-footer-clean { margin-top: 2rem; }
}

/* =========================================
   Mobile Responsiveness & Hamburger Menu
   ========================================= */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-block;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .metrics-grid, .features-grid, .stats-row {
        grid-template-columns: 1fr !important;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .modal-content {
        width: 95%;
        margin: 5vh auto;
    }
    
    .topbar-left {
        display: flex;
        align-items: center;
    }
}

/* =========================================
   New Landing Page Styles
   ========================================= */
.landing-page {
    min-height: 100vh;
    background: radial-gradient(circle at top right, #111827 0%, #0b0f19 100%);
    color: var(--text-main);
}

.landing-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6rem 1rem 2rem 1rem;
    min-height: 100vh;
}

.landing-logo-center {
    margin-bottom: 2rem;
}

.landing-logo-center img {
    height: 50px;
}

.landing-login-center {
    width: 100%;
    max-width: 420px;
    margin-bottom: 3rem;
}

.login-card-glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.login-card-glass h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text-main);
}

.login-desc {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.landing-hero-center {
    padding: 2rem;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.landing-hero-center h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 1.5rem 0;
    background: linear-gradient(90deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 800px;
}

.landing-features {
    background: var(--surface-light);
    padding: 5rem 2rem;
}

.features-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.feature-card {
    background: var(--surface-bg);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    text-align: left;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.landing-company {
    padding: 5rem 2rem;
    text-align: center;
}

.company-content {
    max-width: 900px;
    margin: 0 auto;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.landing-footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .landing-login-form {
        flex-direction: column;
        width: 100%;
    }
    .landing-login-form input, .landing-login-form button {
        width: 100%;
    }
    .landing-hero-center h1 {
        font-size: 2.5rem;
    }
}

/* Diseño de pantalla — selector de color de interfaz */
.theme-interface-block {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-interface-title {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.theme-interface-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.theme-current-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.theme-current-preview {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
    min-width: 220px;
}

.theme-swatch-lg {
    width: 88px;
    height: 88px;
    min-width: 88px;
    min-height: 88px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 4px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 2px 8px rgba(255, 255, 255, 0.15);
}

.theme-current-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.theme-summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.theme-summary-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
    line-height: 1.2;
}

.theme-gallery-open-btn {
    padding: 0.9rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    white-space: nowrap;
    min-width: 200px;
    cursor: pointer;
}

/* Modal galería de colores */
.modal-theme-picker {
    z-index: 10050 !important;
}

.modal-theme-picker .theme-picker-modal {
    max-width: 640px;
    width: 96%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
}

.theme-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.theme-picker-header-text h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1.35rem;
}

.theme-picker-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.theme-picker-close {
    font-size: 1.35rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.theme-gallery-body {
    overflow-y: auto;
    flex: 1;
    min-height: 200px;
    max-height: min(58vh, 520px);
    padding-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.theme-gallery-section {
    margin-bottom: 1.5rem;
}

.theme-gallery-section:last-child {
    margin-bottom: 0;
}

.theme-gallery-section h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 0 0 0.85rem 0;
    font-weight: 700;
    padding-left: 0.15rem;
}

.theme-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.theme-palette-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.theme-palette-chip:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-palette-chip.selected {
    border-color: var(--primary, #3b82f6);
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.theme-palette-dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
}

.theme-palette-chip.selected .theme-palette-dot {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary, #3b82f6), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.theme-palette-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
}

.theme-palette-chip.selected .theme-palette-name {
    color: var(--text-main);
}

.theme-picker-actions {
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.light-theme .theme-current-card {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
}

.light-theme .theme-palette-chip {
    background: rgba(0, 0, 0, 0.03);
}

.light-theme .theme-palette-chip:hover {
    background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 600px) {
    .theme-current-card {
        flex-direction: column;
        align-items: stretch;
    }
    .theme-gallery-open-btn {
        width: 100%;
    }
    .theme-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    }
}

/* --- Modal Editar PLU --- */
.plu-modal-content {
    max-width: 720px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

.plu-modal-header {
    padding: 1.5rem 1.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.plu-modal-header h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1.35rem;
}

.plu-modal-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.plu-modal-form {
    padding: 0 1.75rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.plu-form-section {
    margin-top: 1.25rem;
    padding-top: 0.25rem;
}

.plu-form-section:first-of-type {
    margin-top: 1rem;
}

.plu-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.85rem 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.plu-section-icon {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.9;
}

.plu-section-hint {
    margin: -0.35rem 0 0.85rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.plu-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}

.plu-form-grid-compact {
    grid-template-columns: repeat(3, 1fr);
}

.plu-field-full {
    grid-column: 1 / -1;
}

.plu-modal-form .input-group {
    margin-bottom: 0;
}

.plu-modal-form .input-group label {
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    font-weight: 500;
}

.plu-modal-form .plu-field,
.plu-modal-form .input-group input.plu-field,
.plu-modal-form .input-group select.plu-field {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
}

.plu-modal-form select.plu-select {
    appearance: none;
    cursor: pointer;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 1.1em;
    color-scheme: dark;
}

.plu-modal-form select.plu-select option {
    background-color: #1e293b;
    color: #f1f5f9;
    padding: 0.5rem;
}

.plu-modal-form .plu-field:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.plu-form-section-image .plu-image-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.plu-image-preview-box {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
}

.plu-image-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
}

.plu-image-preview-box span {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 0.5rem;
}

.plu-image-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 180px;
}

.plu-img-btn {
    font-size: 0.88rem !important;
    padding: 0.55rem 1rem !important;
    width: auto !important;
    align-self: flex-start;
}

.plu-modal-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.light-theme .plu-modal-form .plu-field,
.light-theme .plu-modal-form select.plu-select {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    color-scheme: light;
}

.light-theme .plu-modal-form select.plu-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-color: #f8fafc;
}

.light-theme .plu-modal-form select.plu-select option {
    background-color: #ffffff;
    color: #1e293b;
}

.light-theme .plu-image-preview-box {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

@media (max-width: 640px) {
    .plu-modal-content {
        max-height: 95vh;
    }
    .plu-form-grid,
    .plu-form-grid-compact {
        grid-template-columns: 1fr;
    }
    .plu-field-full {
        grid-column: 1;
    }
    .plu-modal-header,
    .plu-modal-form {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

/* ════════════════════════════════════════════════════════════════════════════
   ╔══════════════════════════════════════════════════════════════════════════╗
   ║  RESPONSIVE MOBILE (>= 2026-05)                                          ║
   ║  ───────────────────────────────────────────────────────────────────────  ║
   ║  Todo lo que está acá ABAJO es nuevo y solo se activa en tamaños mobile/  ║
   ║  tablet. NO modifica el desktop (>= 1024px). Cualquier cambio que aplica   ║
   ║  fuera de @media usa solo helper classes nuevas (view-header-row,         ║
   ║  responsive-table, kv-table, design-split, etc.) sin pisar las reglas     ║
   ║  desktop pre-existentes. Lógica de negocio y roles no se tocan.            ║
   ╚══════════════════════════════════════════════════════════════════════════╝
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Helper classes neutras (sirven en desktop y mobile, no rompen nada) ── */

.view-header-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
.view-header-top { align-items: flex-start; }
.view-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}
.search-fluid { width: clamp(200px, 100%, 400px); }

.form-card-wide {
    padding: 2.5rem;
    margin-top: 2rem;
    max-width: 900px;
}
.form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}
.form-2col-tight { gap: 1rem; }
.form-2col-full { grid-column: 1 / -1; margin-top: 1rem; }

.design-split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.scale-detail-main { padding: 2rem; }

.section-header-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}
.plu-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.plu-header-actions .btn-primary,
.plu-header-actions .btn-secondary,
.btn-send-all, .btn-force-sync, .btn-add-plu {
    padding: 0.6rem 1.2rem;
    width: auto;
    font-size: 0.9rem;
}
.btn-force-sync {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
}
.pending-count-badge {
    margin-left: 6px;
    background: rgba(0,0,0,0.25);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.ventas-section-header { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.ventas-tabs { display: flex; flex-wrap: wrap; gap: 1rem; }
.ventas-tabs .tab-button { width: auto; padding: 0.6rem 1.2rem; font-size: 0.95rem; }
/* El estado activo lo da .btn-primary global; el inactivo lo da .btn-secondary global.
   El JS hace toggle entre ambas clases (líneas 868-895 de app.js). No agregamos clases extra. */
.ventas-filters-container {
    background: rgba(255,255,255,0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.ventas-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.ventas-filter-row-range { /* JS lo conmuta a display:flex/none */ }
.filter-label { font-weight: 600; color: var(--text-muted); }
.filter-date-input { width: auto; padding: 0.5rem 1rem; flex: 1 1 160px; min-width: 0; }
.btn-generate-pdf { background: #eab308; color: white; border-color: #ca8a04; margin-left: auto; }

.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.modal-image-picker-content { max-width: 720px; width: 95%; }
.modal-manage-users-content { max-width: 800px; width: 95%; }
.manage-users-table-wrapper { margin-top: 1rem; max-height: 400px; overflow-y: auto; }
.image-picker-message { text-align: center; padding: 2rem; color: var(--text-muted); }
.image-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    max-height: 420px;
    overflow-y: auto;
}
.form-actions-spaced { margin-top: 1rem; }

.backup-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}
.backup-card-toggle { padding: 2.5rem; position: relative; }
.backup-card-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ── Tablas responsive (helpers neutras) ── */
.responsive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.responsive-table { width: 100%; }
.kv-table { margin: 0; }
.kv-key { font-weight: 700; }

/* ── Backdrop del sidebar (oculto por defecto en desktop) ── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 998;
    backdrop-filter: blur(2px);
}

/* ════════════════════════════════════════════════════════════════════════════
   BREAKPOINT TABLET / MOBILE  ≤ 1024px
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    /* Padding LATERAL fluido (no tocamos top/bottom para preservar el aire vertical) */
    .container,
    .content-container { padding-left: var(--container-pad) !important; padding-right: var(--container-pad) !important; }
    .scale-detail-main { padding: var(--container-pad) !important; }

    /* Form 2col → 1col en tablet mediano hacia abajo */
    .form-2col { grid-template-columns: 1fr; gap: 1.25rem; }
    .form-2col-tight { gap: 1rem; }

    /* Design split (logo + preview) colapsa */
    .design-split { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* ════════════════════════════════════════════════════════════════════════════
   BREAKPOINT MOBILE  ≤ 768px (tablets verticales + celulares)
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Sidebar drawer ───────────────────────────────────────────────────── */
    /* La sidebar mobile ya estaba con left:-280px y .mobile-open {left:0} en
       la sección "Mobile Responsiveness & Hamburger Menu" del CSS legacy. No
       redefinimos eso para no duplicar reglas; solo ajustamos el ancho fluido
       y el backdrop. app.js sigue conmutando la clase .mobile-open como antes. */
    .sidebar {
        width: min(280px, 86vw) !important;
        max-width: 320px;
    }
    .sidebar.mobile-open ~ .sidebar-backdrop {
        display: block;
    }

    /* Main wrapper ocupa todo el ancho cuando la sidebar es drawer */
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ── Topbar / header ────────────────────────────────────────────────── */
    .topbar {
        padding: 0.75rem 1rem !important;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .topbar-left, .topbar-right { gap: 0.5rem; }
    .user-badge .username-text {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
    }
    .icon-btn {
        min-width: var(--touch-min);
        min-height: var(--touch-min);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ── Tipografía fluida en headers de las vistas ──────────────────────── */
    .view-header h1 { font-size: clamp(1.4rem, 5vw, 2rem); line-height: 1.2; }
    .view-header h2 { font-size: clamp(1.2rem, 4.5vw, 1.6rem); }
    .view-header .view-subtitle { font-size: clamp(0.85rem, 3.2vw, 1rem); }
    .section-header h3 { font-size: clamp(1.1rem, 4.5vw, 1.5rem); }

    /* ── Header de balanza-detail compacto en mobile ─────────────────────── */
    .glass-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .glass-header h2 { font-size: clamp(1.1rem, 4.5vw, 1.5rem); }
    .scale-status { font-size: 0.85rem; }

    /* ── Glass-cards: reducir padding para no comerse el ancho ───────────── */
    .glass-card {
        padding: 1.25rem !important;
        border-radius: 12px;
    }
    .form-card-wide { padding: 1.5rem; }
    .backup-card-toggle { padding: 1.5rem; }

    /* ── Grids principales ──────────────────────────────────────────────── */
    .premium-scales-grid,
    .options-grid,
    .features-grid,
    .stats-row {
        grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)) !important;
        gap: 1rem !important;
    }
    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)) !important;
        gap: 1rem !important;
    }
    .input-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    .input-grid .input-group.full-width { grid-column: 1; }

    /* Botón hamburger visible en mobile (.mobile-only ya lo controla;
       acá nos aseguramos del touch target) */
    #mobile-menu-btn { font-size: 1.5rem; padding: 0.4rem 0.6rem; }

    /* ── view-header-row colapsa con buen wrap ──────────────────────────── */
    .view-header-row,
    .section-header-row {
        align-items: flex-start;
        gap: 0.75rem;
    }
    .view-header-actions,
    .plu-header-actions { width: 100%; }
    .view-header-actions .btn-primary,
    .plu-header-actions .btn-primary,
    .plu-header-actions .btn-secondary { flex: 1 1 auto; min-width: 140px; }
    .search-fluid { width: 100%; min-width: 0; flex: 1 1 100%; }

    /* ── Filtros de ventas: tabs / pickers full width ────────────────────── */
    .ventas-tabs .tab-button { flex: 1 1 calc(50% - 0.5rem); min-width: 0; }
    .filter-date-input { flex: 1 1 100%; }
    .btn-generate-pdf { margin-left: 0; flex: 1 1 100%; }

    /* ── MODALES ────────────────────────────────────────────────────────── */
    .modal {
        padding: 0.5rem !important;
        align-items: flex-end;
    }
    .modal.active { align-items: center; }
    .modal-content,
    .modal-content-premium {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92vh;
        overflow-y: auto;
        border-radius: var(--radius-lg);
        padding: 1.25rem !important;
    }
    .modal-image-picker-content,
    .modal-manage-users-content { width: 100% !important; max-width: 100% !important; }

    .modal-header-fancy { flex-wrap: wrap; gap: 0.5rem; }
    .modal-header-fancy .header-text h3 { font-size: 1.15rem; }
    .modal-footer-premium {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .modal-footer-premium .btn-primary,
    .modal-footer-premium .btn-text { flex: 1 1 calc(50% - 0.25rem); min-width: 0; }

    /* PLU modal: footer sticky para que «Guardar» quede siempre accesible */
    .plu-modal-content { padding-bottom: 0; }
    .plu-modal-actions,
    .plu-modal-content .modal-actions,
    .plu-modal-content .form-actions {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        margin: 0 -1.25rem -1.25rem;
        border-top: 1px solid var(--border-color);
        z-index: 5;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .plu-modal-content .modal-actions .btn-primary,
    .plu-modal-content .modal-actions .btn-secondary,
    .plu-modal-content .form-actions .btn-primary,
    .plu-modal-content .form-actions .btn-secondary { flex: 1 1 calc(50% - 0.25rem); }

    /* ── TABLAS: cards apiladas para tablas estáticas KV ─────────────────── */
    .kv-table thead { display: none; }
    .kv-table,
    .kv-table tbody,
    .kv-table tr,
    .kv-table td { display: block; width: 100% !important; }
    .kv-table tr {
        background: var(--surface-light);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 0.5rem;
        padding: 0.75rem 0.9rem;
    }
    .kv-table td { border: none; padding: 0.15rem 0; }
    .kv-table .kv-key {
        font-size: 0.75rem;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.5px;
        font-weight: 600;
        margin-bottom: 0.2rem;
    }
    .kv-table .kv-value { font-size: 1rem; word-break: break-word; }

    /* ── TABLAS DINÁMICAS: scroll horizontal controlado + indicador ──────── */
    .responsive-table-wrapper {
        overflow-x: auto;
        border-radius: var(--radius-md);
        /* Indicador de scroll (sombras laterales que avisan "hay más") */
        background:
            linear-gradient(90deg, var(--card-bg) 30%, rgba(0,0,0,0)),
            linear-gradient(-90deg, var(--card-bg) 30%, rgba(0,0,0,0)) right,
            linear-gradient(90deg, rgba(0,0,0,0.25), rgba(0,0,0,0) 40%),
            linear-gradient(-90deg, rgba(0,0,0,0.25), rgba(0,0,0,0) 40%) right;
        background-repeat: no-repeat;
        background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
        background-attachment: local, local, scroll, scroll;
    }
    .responsive-table {
        min-width: 480px; /* fuerza scroll si la suma de cols excede el ancho */
    }
    .responsive-table th,
    .responsive-table td {
        white-space: nowrap;
        padding: 0.6rem 0.75rem !important;
        font-size: 0.88rem;
    }

    /* ── Login responsive (mantiene visual, achica tipografía + alturas) ── */
    .landing-content-wrapper { padding: 1rem; }
    .login-card-glass {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }
    .landing-hero-center h1 { font-size: clamp(1.5rem, 6vw, 2.4rem); line-height: 1.2; }
    .landing-hero-center .hero-subtitle { font-size: clamp(0.9rem, 3.4vw, 1.1rem); }

    /* ── Touch targets globales ─────────────────────────────────────────── */
    .btn-primary, .btn-secondary, .btn-back, .btn-delete {
        min-height: var(--touch-min);
    }
    /* iOS evita zoom si los inputs tienen font-size >= 16px */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="search"],
    select,
    textarea,
    .premium-input,
    .premium-search,
    .plu-field { font-size: 16px !important; }
    .plu-field-hint { font-size: 12px !important; }

    /* ── Weight section: número grande proporcional ─────────────────────── */
    .weight-value { font-size: clamp(3rem, 18vw, 6rem) !important; }
    .weight-display-container { padding: 1.5rem !important; }

    /* ── Terminal log más compacto ─────────────────────────────────────── */
    .terminal-log pre { font-size: 0.75rem; }

    /* ── Toolbars / actions inline ─────────────────────────────────────── */
    .header-actions-inline { width: 100%; justify-content: flex-start; }
}

/* ════════════════════════════════════════════════════════════════════════════
   BREAKPOINT MOBILE CHICO  ≤ 480px
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Cards y grids al mínimo manteniendo legibilidad */
    .premium-scales-grid,
    .options-grid,
    .features-grid,
    .stats-row,
    .metrics-grid {
        grid-template-columns: 1fr !important;
    }
    .glass-card { padding: 1rem !important; }

    .topbar { padding: 0.6rem 0.75rem !important; }
    .user-badge .username-text { max-width: 64px; }
    .topbar-right .icon-btn { padding: 0.4rem; }
    .topbar-right .icon-btn,
    .avatar-circle { width: 38px; height: 38px; }

    /* Tabs ventas a una columna en pantallas chicas */
    .ventas-tabs .tab-button { flex: 1 1 100%; }

    /* Modal full-screen en celulares chicos */
    .modal-content,
    .modal-content-premium {
        max-height: 100vh;
        min-height: 100vh;
        border-radius: 0;
    }
    .modal { padding: 0 !important; }

    /* PDF button vuelve full width abajo */
    .btn-generate-pdf { width: 100%; }

    /* Sidebar drawer un poco más angosto */
    .sidebar { width: min(260px, 88vw); }
}

/* ════════════════════════════════════════════════════════════════════════════
   BREAKPOINT MUY CHICO  ≤ 360px (smartphones antiguos / muy angostos)
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    :root {
        --container-pad: 8px;
        --modal-pad: 12px;
    }
    .glass-card { padding: 0.85rem !important; }
    .view-header h1 { font-size: 1.25rem; }
    .section-header h3 { font-size: 1.05rem; }
    .btn-primary, .btn-secondary, .btn-back { padding: 0.6rem 0.9rem; font-size: 0.9rem; }
    .responsive-table { min-width: 420px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   PREFERENCIAS DE ACCESIBILIDAD
   ════════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}
