        :root {
            --sidebar-width: 260px;
            --sidebar-collapsed-width: 80px;
            --primary-color: #123F68;
            --accent-color: #36b9cc;
            --bg-color: #f8f9fc;
            --text-dark: #5a5c69;
            --card-blue: #4e73df;
            --transition-speed: 0.4s;
            --transition-curve: cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        body {
            font-family: 'Poppins', sans-serif;
            background-color: var(--bg-color);
            color: var(--text-dark);
            overflow-x: hidden;
        }

        /* === SPLASH SCREEN === */
        #splash-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            background: linear-gradient(135deg, var(--primary-color) 0%, #0a2540 100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease, visibility 0.5s ease;
        }

        #splash-screen.hide {
            opacity: 0;
            visibility: hidden;
        }

        .splash-logo {
            width: 120px;
            height: 120px;
            margin-bottom: 30px;
            animation: pulse 2s ease-in-out infinite;
        }

        .splash-text {
            color: white;
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 10px;
            letter-spacing: 2px;
        }

        .splash-subtitle {
            color: rgba(255, 255, 255, 0.8);
            font-size: 14px;
            font-weight: 400;
            margin-bottom: 40px;
        }

        .splash-loader {
            width: 50px;
            height: 50px;
            border: 4px solid rgba(255, 255, 255, 0.2);
            border-top: 4px solid white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        .splash-message {
            color: rgba(255, 255, 255, 0.9);
            font-size: 16px;
            font-weight: 500;
            margin-top: 20px;
            animation: fadeInUp 0.5s ease;
        }

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

        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.05); opacity: 0.8; }
        }

        /* === LOGIN SCREEN & ANIMATIONS === */
        #login-section {
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, var(--primary-color) 0%, #0a2540 100%);
            padding: 20px;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(40px);
            }

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

        @keyframes zoomIn {
            from {
                opacity: 0;
                transform: scale(0.5);
            }

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

        .login-card {
            width: 100%;
            max-width: 400px;
            padding: 40px;
            background: white;
            border-radius: 15px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            animation: fadeInUp 0.8s ease-out 0.2s both;
        }

        .logo-login-bg {
            background: white;
            border-radius: 50%;
            width: 80px;
            height: 80px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 15px;
            padding: 10px;
            animation: zoomIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s both;
        }

        .logo-login-bg img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        /* === DASHBOARD LAYOUT === */
        #dashboard-section {
            display: flex;
            min-height: 100vh;
            position: relative;
        }

        .sidebar {
            width: var(--sidebar-width);
            background-color: var(--primary-color);
            color: white;
            display: flex;
            flex-direction: column;
            position: fixed;
            height: 100vh;
            z-index: 1050;
            box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
            transition: all var(--transition-speed) var(--transition-curve);
            overflow: hidden;
            white-space: nowrap;
        }

        .sidebar-brand {
            padding: 20px;
            font-size: 1.2rem;
            font-weight: 700;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            align-items: center;
            justify-content: flex-start;
            height: 80px;
            transition: all var(--transition-speed) var(--transition-curve);
        }

        .brand-logo-bg {
            background: white;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 12px;
            min-width: 40px;
            padding: 4px;
            transition: margin var(--transition-speed);
        }

        .brand-logo-bg img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .brand-text,
        .nav-link-text,
        .logout-text {
            opacity: 1;
            transition: opacity 0.2s ease-in-out;
            transition-delay: 0.1s;
        }

        .nav-link-custom {
            padding: 12px 20px;
            cursor: pointer;
            transition: 0.3s;
            color: rgba(255, 255, 255, 0.75);
            text-decoration: none;
            display: flex;
            align-items: center;
            font-weight: 500;
            font-size: 0.875rem;
        }

        .nav-link-custom:hover,
        .nav-link-custom.active {
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border-left: 5px solid var(--accent-color);
        }

        .nav-icon {
            width: 24px;
            text-align: center;
            margin-right: 10px;
            font-size: 1rem;
            min-width: 24px;
            transition: margin var(--transition-speed);
        }

        .sidebar-footer {
            padding: 20px;
            margin-top: auto;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .sidebar-toggler {
            background: rgba(255, 255, 255, 0.15);
            border: none;
            color: white;
            width: 45px;
            height: 45px;
            border-radius: 50%;
            cursor: pointer;
            margin-bottom: 20px;
            transition: 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .sidebar-toggler:hover {
            background: var(--accent-color);
            transform: scale(1.1);
        }

        .main-content {
            margin-left: var(--sidebar-width);
            flex: 1;
            padding: 25px 35px;
            width: calc(100% - var(--sidebar-width));
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            transition: margin-left var(--transition-speed) var(--transition-curve), width var(--transition-speed) var(--transition-curve);
        }

        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 35px;
            background: white;
            padding: 10px 30px;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
        }

        #mobile-toggle {
            font-size: 1.5rem;
            color: var(--primary-color);
            cursor: pointer;
            margin-right: 15px;
            display: none;
        }

        .user-dropdown-toggle {
            cursor: pointer;
            padding: 5px 10px;
            border-radius: 10px;
            transition: background 0.3s;
        }

        .user-dropdown-toggle:hover {
            background-color: #f1f3f9;
        }

        .station-card {
            background: white;
            border-radius: 12px;
            padding: 20px;
            border: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
            transition: all 0.3s ease;
            cursor: pointer;
            border-left: 4px solid var(--primary-color);
            position: relative;
            overflow: hidden;
            height: 100%;
        }

        .station-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
            border-left-width: 6px;
        }

        /* Dynamic Parameter Card Container - Auto-adjust Grid */
        .param-grid-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            max-width: 100%;
        }

        /* Responsive adjustments */
        @media (max-width: 576px) {
            .param-grid-container {
                grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            }
        }

        @media (min-width: 1400px) {

            /* On very large screens, limit to max 6 columns */
            .param-grid-container {
                grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            }
        }

        /* Dynamic Parameter Card */
        .param-card {
            background: white;
            border-radius: 10px;
            padding: 15px;
            height: 100%;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
            border-left: 5px solid var(--primary-color);
            position: relative;
            overflow: hidden;
            transition: 0.3s;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .param-title {
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            color: #858796;
            margin-bottom: 6px;
        }

        .param-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary-color);
            margin-bottom: 0;
            line-height: 1.2;
        }

        .param-unit {
            font-size: 0.8rem;
            color: #aaa;
            font-weight: 500;
            margin-left: 5px;
        }

        .param-icon-bg {
            position: absolute;
            right: 15px;
            bottom: 15px;
            font-size: 2rem;
            /* ✅ DIKECILKAN dari 3rem ke 2rem */
            opacity: 0.1;
            color: var(--primary-color);
            pointer-events: none;
            z-index: 1;
            display: block !important;
        }

        /* Override warna jadi putih kalau card punya threshold */
        .param-card.card-safe .param-icon-bg,
        .param-card.card-warning .param-icon-bg,
        .param-card.card-danger .param-icon-bg {
            color: white !important;
            opacity: 0.15 !important;
        }

        .status-badge {
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .status-online {
            background-color: #d1fae5;
            color: #065f46;
        }

        .status-offline {
            background-color: #fee2e2;
            color: #dc2626;
        }

        .status-inactive {
            background-color: #e5e7eb;
            color: #6b7280;
        }

        .hidden {
            display: none !important;
        }

        .chart-wrapper {
            position: relative;
            height: 350px;
            width: 100%;
        }

        .table-custom-header th {
            background-color: var(--primary-color) !important;
            color: white !important;
            font-weight: 600;
            text-transform: uppercase;
            font-size: 0.85rem;
            letter-spacing: 0.5px;
            border-bottom: none;
        }

        .nav-tabs .nav-link {
            color: #5a5c69;
            font-weight: 500;
            cursor: pointer;
            border: none;
            border-bottom: 3px solid transparent;
        }

        .nav-tabs .nav-link:hover {
            color: var(--primary-color);
        }

        .nav-tabs .nav-link.active {
            color: var(--primary-color);
            border-bottom: 3px solid var(--primary-color);
            background: transparent;
            font-weight: 700;
        }

        .nav-tabs {
            border-bottom: 1px solid #eaecf4;
        }

        /* RESPONSIVE */
        @media (max-width: 992px) {
            .sidebar {
                transform: translateX(-100%);
            }

            .main-content {
                margin-left: 0;
                width: 100%;
                padding: 20px 15px;
            }

            #mobile-toggle {
                display: block;
            }

            .sidebar-toggler {
                display: none;
            }

            body.show-sidebar .sidebar {
                transform: translateX(0);
            }

            body.show-sidebar::after {
                content: '';
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.5);
                z-index: 1040;
                animation: fadeIn 0.3s;
            }
        }

        /* MOBILE FIXES */
        @media (max-width: 768px) {
            .top-bar {
                padding: 15px 20px !important;
            }

            #page-title {
                font-size: 0.95rem;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 150px;
            }

            #mobile-toggle {
                margin-right: 12px !important;
            }

            #current-date {
                display: block !important;
                font-size: 0.75rem;
                margin-top: 5px;
            }

            .top-bar .dropdown {
                margin-left: auto;
            }

            .detail-header-wrapper {
                align-items: flex-start !important;
            }

            .detail-header-right {
                text-align: right;
            }

            #btn-edit-param {
                font-size: 0.8rem;
                padding: 0.25rem 0.5rem !important;
            }

            .status-badge {
                font-size: 0.65rem;
                padding: 4px 8px;
            }

            /* Stack filter toolbar on mobile */
            #filter-toolbar .col-md-3 {
                margin-bottom: 10px;
            }
        }

        @media (min-width: 993px) {
            body.sb-collapsed .sidebar {
                width: var(--sidebar-collapsed-width);
            }

            body.sb-collapsed .main-content {
                margin-left: var(--sidebar-collapsed-width);
                width: calc(100% - var(--sidebar-collapsed-width));
            }

            body.sb-collapsed .brand-text,
            body.sb-collapsed .nav-link-text,
            body.sb-collapsed .logout-text {
                opacity: 0;
                visibility: hidden;
                width: 0;
            }

            body.sb-collapsed .sidebar-brand {
                justify-content: center;
                padding: 0;
            }

            body.sb-collapsed .brand-logo-bg {
                margin: 0;
            }

            body.sb-collapsed .nav-link-custom {
                justify-content: center;
                padding: 12px 0;
            }

            body.sb-collapsed .nav-icon {
                margin: 0;
                font-size: 1rem;
            }
        }

        /* ============================================ */
        /* THRESHOLD-BASED CARD COLORS */
        /* ============================================ */

        :root {
            --color-safe: #1cc88a;
            --color-warning: #f6c23e;
            --color-danger: #e74a3b;
        }

        .param-card.card-safe {
            background: linear-gradient(135deg, var(--color-safe) 0%, #17a673 100%) !important;
            color: white !important;
        }

        .param-card.card-safe .param-title,
        .param-card.card-safe .param-value,
        .param-card.card-safe .param-unit {
            color: white !important;
        }

        .param-card.card-warning {
            background: linear-gradient(135deg, var(--color-warning) 0%, #e0a900 100%) !important;
            color: #333 !important;
        }

        .param-card.card-warning .param-title,
        .param-card.card-warning .param-value,
        .param-card.card-warning .param-unit {
            color: #333 !important;
        }

        .param-card.card-danger {
            background: linear-gradient(135deg, var(--color-danger) 0%, #d32f2f 100%) !important;
            color: white !important;
        }

        .param-card.card-danger .param-title,
        .param-card.card-danger .param-value,
        .param-card.card-danger .param-unit {
            color: white !important;
        }

        .threshold-card-modal {
            border: 1px solid #e3e6f0;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            background: #fff;
        }

        .threshold-card-modal.disabled {
            background: #f8f9fc;
            opacity: 0.6;
        }

        .threshold-input-group label {
            font-size: 0.875rem;
            font-weight: 500;
            color: #5a5c69;
            margin-bottom: 5px;
            display: block;
        }

        .threshold-input-group input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #d1d3e2;
            border-radius: 4px;
        }

        .color-indicator {
            width: 30px;
            height: 30px;
            border-radius: 4px;
            display: inline-block;
            margin: 0 5px;
        }

        .color-safe {
            background: #1cc88a;
        }

        .color-warning {
            background: #f6c23e;
        }

        .color-danger {
            background: #e74a3b;
        }

        .card-status-badge {
            position: absolute;
            top: 8px;
            right: 8px;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            background: rgba(255, 255, 255, 0.25);
            z-index: 10;
        }

        /* ===== FIX: Icon Background Selalu Tampil ===== */
        .parameter-card .param-icon,
        .card .param-icon,
        .monitoring-card .param-icon {
            opacity: 0.12 !important;
            /* Force icon selalu terlihat */
            display: block !important;
            visibility: visible !important;
        }

        /* Tambahkan hover effect */
        .parameter-card:hover .param-icon,
        .card:hover .param-icon,
        .monitoring-card:hover .param-icon {
            opacity: 0.18 !important;
            transform: scale(1.05);
        }

        /* Modal Header Custom */
        .modal-header.custom-header {
            background: linear-gradient(135deg, var(--primary-color) 0%, #0a2540 100%);
            border-bottom: 3px solid var(--accent-color);
        }

        .modal-header.custom-header .btn-close-white {
            opacity: 0.8;
        }

        .modal-header.custom-header .btn-close-white:hover {
            opacity: 1;
        }
