/* === COHESIVE, ELEGANT CSS THEME FOR TIPX WEB MANAGEMENT SYSTEM === */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-main: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFF5F5;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-color: #E5E7EB;
    --border-glow: rgba(6, 182, 212, 0.15);
    
    /* Dedicated Swiss Red Brand Colors -> Modernized TipX Logo Teal/Cyan */
    --color-brand: #06b6d4;
    --color-brand-light: rgba(6, 182, 212, 0.08);
    --color-brand-dark: #0d9488;
    --color-brand-glow: rgba(6, 182, 212, 0.25);
    
    /* True Professional Teal (Emerald/Mint) for Success, Highlights and Security */
    --color-teal: #06b6d4;
    --color-teal-light: rgba(6, 182, 212, 0.08);
    --color-teal-dark: #0d9488;
    --color-teal-glow: rgba(6, 182, 212, 0.20);
    
    /* True Professional Blue for Information and Accents */
    --color-blue: #0ea5e9;
    --color-blue-light: rgba(14, 165, 233, 0.08);
    --color-blue-dark: #0369a1;
    
    /* True Warning/Danger Red */
    --color-red: #EF4444;
    --color-red-light: rgba(239, 68, 68, 0.08);
    --color-yellow: #E2B93B;
    --color-yellow-light: rgba(226, 185, 59, 0.08);
    
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    
    --text-brand-primary: #06b6d4;
    --text-brand-secondary: #0d9488;
    --text-brand-muted: #0891b2;
    
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-input: #FAFAFA;
    
    --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --transition-speed: 0.22s;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    /* 8px Spacing System variables */
    --space-8px-1: 8px;
    --space-8px-1-5: 12px;
    --space-8px-2: 16px;
    --space-8px-3: 24px;
    --space-8px-4: 32px;
    --space-8px-5: 40px;
    --space-8px-6: 48px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-main: #0B0F19 !important;
    --bg-card: #151D30 !important;
    --bg-card-hover: #1E2942 !important;
    --bg-glass: rgba(21, 29, 48, 0.85) !important;
    --border-color: #24314F !important;
    --border-glow: rgba(6, 182, 212, 0.25) !important;
    
    /* Dedicated Swiss Red Brand Colors in Dark Mode -> TipX Teal/Cyan */
    --color-brand: #06b6d4 !important;
    --color-brand-light: rgba(6, 182, 212, 0.12) !important;
    --color-brand-dark: #0d9488 !important;
    --color-brand-glow: rgba(6, 182, 212, 0.3) !important;
    
    /* Clean Teal/Green Success Colors in Dark Mode for Premium Contrast */
    --color-teal: #06b6d4 !important;
    --color-teal-light: rgba(6, 182, 212, 0.12) !important;
    --color-teal-dark: #0d9488 !important;
    --color-teal-glow: rgba(6, 182, 212, 0.25) !important;
    
    --color-blue: #38bdf8 !important;
    --color-blue-light: rgba(56, 189, 248, 0.1) !important;
    --color-blue-dark: #0284c7 !important;
    
    --color-red: #F87171 !important;
    --color-red-light: rgba(248, 113, 113, 0.12) !important;
    
    /* Highly professional, elegant dark theme color scheme with premium readability and brand-perfect accents */
    --text-primary: #FFFFFF !important;       /* Crisp, bright pure white for titles, headers, and major readable text */
    --text-secondary: #94A3B8 !important;     /* Sleek Slate-Gray for subtitles, labels, unselected options and perfect UI balance */
    --text-muted: #64748B !important;         /* Muted blue-gray for captions, small descriptions, and secondary details */
    
    --text-brand-primary: #F8FAFC !important;   /* Beautiful Pearl White in dark mode */
    --text-brand-secondary: #CBD5E1 !important; /* Elegant Pearl Silver/Gray in dark mode (alternated) */
    --text-brand-muted: #94A3B8 !important;     /* Sleek Slate-Gray in dark mode (alternated) */
    
    --bg-hover: rgba(255, 255, 255, 0.05) !important;
    --bg-input: #101622 !important;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(6, 182, 212, 0.08) !important;
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 12px rgba(6, 182, 212, 0.12) !important;
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65), 0 4px 24px rgba(6, 182, 212, 0.18) !important;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.02) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-heading);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-md);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Header bar styling */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img {
    height: 42px;
    width: 42px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid var(--color-brand);
    box-shadow: 0 0 12px rgba(218, 41, 28, 0.15);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #06b6d4, #0d9488);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.connection-pill {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(16, 185, 129, 0.08);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: var(--shadow-sm);
}

.connection-pill.disconnected {
    background-color: var(--color-red-light);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse 1.6s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0.4; transform: scale(0.9); }
}

/* Layout container */
.main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-8px-5); /* 40px, multiple of 8px */
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: var(--space-8px-5); /* 40px, multiple of 8px */
}

/* Sidebar navigation */
.sidebar-navigation {
    display: flex;
    flex-direction: column;
    gap: var(--space-8px-1); /* 8px spacing for modern compact density */
    position: sticky;
    top: 100px;
    height: fit-content;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-8px-1-5, 12px); /* consistent multiple of 4/8px */
    padding: var(--space-8px-1-5, 12px) var(--space-8px-2); /* 12px top/bottom, 16px left/right */
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-speed);
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.nav-item:hover svg {
    color: var(--text-primary);
}

.nav-item.active {
    color: var(--text-primary);
    background-color: var(--color-brand-light);
    border-left: 3.5px solid var(--color-brand);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-weight: 700;
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05);
}

.nav-item.active svg {
    color: var(--color-brand);
}

/* Dashboard content manager */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Card grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
}

.stats-card {
    background-color: var(--bg-card);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    transition: all var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

.stats-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-brand);
    box-shadow: var(--shadow-md), 0 0 15px var(--color-brand-glow);
}

.stats-card .title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.stats-card .value {
    font-size: 1.85rem;
    font-weight: 800;
    margin-top: 8px;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.stats-card .footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

/* Tab/Section content wrapper */
.content-section {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.content-section.active {
    display: flex;
}

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

/* Section elements card */
.section-card {
    background-color: var(--bg-card);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.01) 0%, transparent 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 6px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Tables and database listing UI */
.table-scroller, .table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

.table-scroller::-webkit-scrollbar, .table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-scroller::-webkit-scrollbar-track, .table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
.table-scroller::-webkit-scrollbar-thumb, .table-responsive::-webkit-scrollbar-thumb {
    background: var(--color-teal);
    border-radius: 3px;
}

table, .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

th {
    padding: 14px 18px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    background-color: var(--bg-hover);
    text-transform: uppercase;
    font-size: 0.725rem;
    letter-spacing: 0.05em;
}

td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

tr:hover td {
    background-color: var(--bg-hover);
}

/* Badges indicators styles */
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: capitalize;
}

.badge.success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.info {
    background-color: var(--color-blue-light);
    color: #60A5FA;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.badge.danger {
    background-color: var(--color-red-light);
    color: #F87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.badge.warning {
    background-color: var(--color-yellow-light);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Elegant Buttons UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
    font-family: var(--font-heading);
}

.btn-primary {
    background-color: var(--color-brand);
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px var(--color-brand-glow);
}
.btn-primary:hover {
    background-color: var(--color-brand-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(218, 41, 28, 0.4);
}

.btn-secondary {
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--color-teal-light);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #F87171;
}
.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.45);
    color: white;
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form layouts and style details */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control, select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    transition: all var(--transition-speed) ease;
}

.form-control::placeholder {
    color: var(--text-muted);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

.form-control:focus, select:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-glow);
    background-color: var(--bg-card);
}

/* Custom switch toggle styling */
.switch-container {
    user-select: none;
}
.switch-container input:checked + .slider-round {
    background-color: var(--color-brand) !important;
    box-shadow: 0 0 10px var(--color-brand-glow);
}
.switch-container .slider-round:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .35s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.switch-container input:checked + .slider-round:before {
    transform: translateX(24px);
}

/* Console details logs */
.console-box {
    background-color: #060913;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    max-height: 250px;
    overflow-y: auto;
    color: #34D399;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.console-line {
    margin-bottom: 6px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.console-line.error { color: #f87171; }
.console-line.info { color: #60a5fa; }

/* Alerts and popups notifications */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    line-height: 1.5;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.alert-error {
    background-color: var(--color-red-light);
    color: #F87171;
    border: 1px solid rgba(248, 113, 113, 0.25);
}

/* Branding layouts */
.branding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.branding-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.branding-image-preview {
    width: 100%;
    height: 150px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Language Switcher & identifier */
.lang-switcher a {
    transition: all var(--transition-speed) ease;
}
.lang-switcher a:hover {
    color: var(--text-primary) !important;
    background: rgba(255,255,255,0.08) !important;
}

.zone-identifier {
    transition: all var(--transition-speed) ease;
}
.zone-identifier:hover {
    transform: translateY(-1px);
    filter: brightness(1.15);
}

/* Code styling tags */
code {
    font-family: var(--font-mono);
}

/* Minimalist Swiss-inspired TIPX Brand Logo */
.minimal-app-logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    user-select: none;
}

.minimal-app-logo-badge {
    position: relative;
    background-color: var(--color-brand); /* Swiss Red */
    border-radius: 28%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(218, 41, 28, 0.2);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.minimal-app-logo-badge:hover {
    transform: scale(1.08);
}

.minimal-app-logo-cross {
    position: relative;
    width: 55%;
    height: 55%;
}

.minimal-app-logo-cross::before,
.minimal-app-logo-cross::after {
    content: '';
    position: absolute;
    background-color: #FFFFFF;
    border-radius: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Vertical bar */
.minimal-app-logo-cross::before {
    width: 32%;
    height: 100%;
}

/* Horizontal bar */
.minimal-app-logo-cross::after {
    width: 100%;
    height: 32%;
}

.minimal-app-logo-text {
    font-weight: 850;
    letter-spacing: -0.04em;
    display: flex;
    align-items: center;
}

.minimal-app-logo-text .tip {
    color: var(--color-brand); /* Swiss Red */
}

.minimal-app-logo-text .x {
    color: var(--text-primary); /* Adaptive text primary */
}

/* Responsive Grid Utilities & Custom Dashboard Layouts */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

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

.grid-240 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

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

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

.grid-4col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

/* MÓDULO: Responsive System & Breakpoints */

/* 1️⃣ Breakpoint: Desktop (>1024px) */
@media (min-width: 1025px) {
    .main-container {
        grid-template-columns: 280px 1fr !important;
        gap: var(--space-8px-4, 32px);
    }
    .sidebar-navigation {
        position: sticky;
        top: 100px;
        height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

/* 2️⃣ Breakpoint: Tablet (640px to 1024px) & Mobile (<640px) */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr !important;
        padding: 1rem 1.25rem !important;
        gap: 1.25rem !important;
    }

    .top-bar {
        padding: 1rem 1.25rem !important;
    }

    .sidebar-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .mobile-sidebar-header {
        display: flex !important;
    }

    /* Off-canvas sidebar */
    .sidebar-navigation {
        position: fixed !important;
        top: 0 !important;
        left: -300px !important;
        width: 290px !important;
        height: 100vh !important;
        background: var(--bg-card) !important;
        border-right: 1px solid var(--border-color) !important;
        z-index: 1000 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
        padding: 2rem 1.25rem !important;
        box-shadow: var(--shadow-lg) !important;
    }

    .sidebar-navigation.open {
        left: 0 !important;
    }

    /* Hide text indicators or resize stats grids */
    .stats-grid, .grid-4col {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .dashboard-charts-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem;
    }

    /* Boost touch targets to meet or exceed 44x44px standard */
    .nav-item, .sidebar-group-toggle, .btn, .sub-tab-btn, .service-pill-item {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column !important;
        gap: 14px !important;
        align-items: stretch !important;
        padding: 1rem 1.25rem !important;
    }
    .logo-container {
        justify-content: space-between !important;
        width: 100% !important;
    }
    .header-actions {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .header-actions .zone-identifier,
    .header-actions .lang-switcher,
    .header-actions .theme-toggle-btn {
        margin: 0 !important;
    }
}

/* 3️⃣ Breakpoint: Mobile (<640px) */
@media (max-width: 640px) {
    .stats-grid, .grid-4col, .form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Tablas apiladas como tarjetas en Mobile para evitar scroll horizontal molesto */
    .table-responsive table, 
    .table-responsive thead, 
    .table-responsive tbody, 
    .table-responsive th, 
    .table-responsive td, 
    .table-responsive tr {
        display: block !important;
    }

    .table-responsive thead {
        display: none !important; /* Escondemos cabeceras */
    }

    .table-responsive tr {
        background: rgba(255, 255, 255, 0.015);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-sm);
    }

    [data-theme="dark"] .table-responsive tr {
        background: rgba(0, 0, 0, 0.15);
    }

    .table-responsive td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 4px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
        font-size: 0.825rem !important;
        text-align: right !important;
    }

    .table-responsive td:last-child {
        border-bottom: none !important;
        justify-content: flex-end !important;
    }

    /* Insertamos el header original vía data-label */
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 700;
        text-align: left;
        color: var(--text-secondary);
        margin-right: 15px;
        font-size: 0.8rem;
    }
}

/* MÓDULO: Sidebar Accordion */
.sidebar-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-speed);
    border-radius: var(--radius-md);
}

.sidebar-group-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-group.active .sidebar-group-toggle {
    color: var(--color-teal);
    background: rgba(20, 184, 166, 0.05);
}

.sidebar-group-toggle .chevron-icon {
    transition: transform 0.3s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-group.active .sidebar-group-toggle .chevron-icon {
    transform: rotate(180deg);
}

.sidebar-subitems {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 16px;
    margin-top: 4px;
    border-left: 2px solid rgba(20, 184, 166, 0.15);
}

.sidebar-group.active .sidebar-subitems {
    display: flex;
}

.sidebar-subitems .nav-item {
    font-size: 0.825rem !important;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-subitems .nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-subitems .nav-item.active {
    color: var(--color-teal) !important;
    background: rgba(20, 184, 166, 0.08) !important;
    font-weight: 700 !important;
}

/* MÓDULO: Expandable Cards & Rows */
.collapsable-card {
    position: relative;
    transition: all 0.3s ease;
}

.card-expandable-content {
    max-height: 120px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-expandable-content.expanded {
    max-height: 2000px !important;
}

.card-expandable-content .fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to top, var(--bg-card), transparent);
    pointer-events: none;
    transition: opacity 0.3s;
}

[data-theme="dark"] .card-expandable-content .fade-overlay {
    background: linear-gradient(to top, #0f172a, transparent);
}

.card-expandable-content.expanded .fade-overlay {
    opacity: 0 !important;
}

.expandable-tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.expandable-tr:hover {
    background-color: rgba(20, 184, 166, 0.03) !important;
}

.details-row {
    background-color: rgba(20, 184, 166, 0.015) !important;
}

.details-container {
    padding: 16px 20px;
    border-top: 1.5px dashed rgba(20, 184, 166, 0.15);
    border-bottom: 1.5px dashed rgba(20, 184, 166, 0.15);
    font-size: 0.85rem;
    animation: slideDownFade 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === MOBILE-FIRST QR CODE & SERVICE SELECTION OPTIMIZATIONS === */

/* QR Code Display Container */
.qr-display-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed) ease;
}

.qr-display-wrapper:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--color-teal);
}

.qr-canvas-holder-custom {
    padding: 1.25rem;
    background: #FFFFFF; /* High contrast white for QR scanning readability */
    border: 3px solid var(--text-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    display: inline-block;
    transition: transform var(--transition-speed) ease;
    max-width: 100%;
    box-sizing: border-box;
}

.qr-canvas-holder-custom:active {
    transform: scale(0.98);
}

.qr-canvas-holder-custom img, 
.qr-canvas-holder-custom canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
}

/* Service Selection Lists (Grid & Pills) */
.service-selection-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.service-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

.service-touch-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.75rem;
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-speed) ease;
    min-height: 80px; /* Generous touch area */
    box-sizing: border-box;
    gap: 6px;
}

.service-touch-card:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--color-teal-glow);
}

.service-touch-card.active {
    background-color: var(--color-teal) !important;
    border-color: var(--color-teal) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 16px var(--color-teal-glow) !important;
    transform: scale(1.03);
}

.service-touch-card.active .service-icon,
.service-touch-card.active .service-label {
    color: #ffffff !important;
}

.service-touch-card .service-icon {
    font-size: 1.5rem;
}

.service-touch-card .service-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Horizontal Scrollable Service Pill Bar for Compact Mobile Views */
.service-pill-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 6px 2px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE10+ */
    width: 100%;
    box-sizing: border-box;
}

.service-pill-bar::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.service-pill-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    height: 38px; /* Comfortable mobile touch size */
}

.service-pill-item:hover {
    border-color: var(--color-teal);
    color: var(--color-teal);
}

.service-pill-item.active {
    background-color: var(--color-teal);
    color: #FFFFFF !important;
    border-color: var(--color-teal);
    box-shadow: 0 4px 10px var(--color-teal-glow);
}

/* Swiss Branding Details & Scan Assist */
.scan-instructions-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(16, 185, 129, 0.05);
    border: 1.5px dashed rgba(16, 185, 129, 0.3);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.scan-instructions-banner .badge-swiss {
    width: 24px;
    height: 24px;
    background-color: #0d9488; /* TipX logo teal background */
    color: #FFFFFF;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.scan-instructions-banner p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    text-align: left;
}

/* Mobile responsive fixes */
@media (max-width: 480px) {
    .qr-display-wrapper {
        padding: 1rem;
    }
    
    .qr-canvas-holder-custom {
        padding: 1rem;
    }
    
    .service-selection-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on small screens */
    }
    
    .service-touch-card {
        min-height: 72px;
        padding: 0.75rem 0.5rem;
    }
}

/* 4️⃣ ESTILOS PREMIUM PARA SPINNER & CARGAS (BASADOS EN EL LOGO) */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(6, 182, 212, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-teal);
    border-right-color: #06b6d4;
    animation: tipx-spin 0.8s linear infinite;
}

.spinner-tipx {
    display: inline-block;
    width: 48px;
    height: 48px;
    border: 4px solid rgba(30, 41, 59, 0.5);
    border-radius: 50%;
    border-top: 4px solid #06b6d4;
    border-right: 4px solid #0d9488;
    animation: tipx-spin 0.85s cubic-bezier(0.4, 0.1, 0.2, 0.9) infinite;
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.3));
}

@keyframes tipx-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos de tabla expandible y drilldown */
.table-row-hover {
    cursor: pointer;
}
.table-row-hover:hover {
    background: rgba(20, 184, 166, 0.05) !important;
}
[data-theme="dark"] .table-row-hover:hover {
    background: rgba(6, 182, 212, 0.07) !important;
}

.details-row {
    background: rgba(15, 23, 42, 0.02) !important;
}
[data-theme="dark"] .details-row {
    background: rgba(0, 0, 0, 0.2) !important;
}

.details-container {
    animation: slideDownFade 0.25s ease-out;
}

.row-drilldown-card {
    border-left: 4px solid var(--color-teal);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Breadcrumbs fluidos */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.breadcrumbs span {
    transition: color 0.2s;
}
.breadcrumbs span.active {
    color: var(--color-teal);
    font-weight: 700;
}

/* ========================================================== */
/* TIPX LOADER & SKELETON COMPONENT STYLES                  */
/* ========================================================== */
@keyframes tipxHexSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes tipxPulseGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.4));
        opacity: 0.85;
    }
    50% { 
        filter: drop-shadow(0 0 16px rgba(6, 182, 212, 0.95));
        opacity: 1;
    }
}

@keyframes tipxShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tipx-loading-svg {
    transform-origin: center;
    animation: tipxPulseGlow 2s infinite ease-in-out;
}

.tipx-loading-svg .hexagon {
    transform-origin: 50px 50px;
    animation: tipxHexSpin 6s infinite linear;
}

/* Loader Overlay Container */
.tipx-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 100;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.tipx-loader-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.tipx-loader-text {
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Skeleton Shimmer Classes */
.tipx-skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 25%, rgba(255, 255, 255, 0.07) 37%, rgba(255, 255, 255, 0.02) 63%);
    background-size: 400% 100%;
    animation: tipxShimmer 1.6s infinite linear;
    border-radius: 6px;
}

.tipx-skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 8px;
}

.tipx-skeleton-title {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

/* KPI Card loading representation */
.tipx-kpi-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-sizing: border-box;
    min-height: 110px;
}

/* Table loading representation */
.tipx-table-skeleton {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tipx-table-skeleton-row {
    display: flex;
    gap: 15px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.tipx-table-skeleton-cell {
    height: 16px;
    flex: 1;
}

/* Cascade Step Locking on Client Portal */
.client-step-locked {
    opacity: 0.35 !important;
    filter: grayscale(80%) !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

