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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #f5f5f5;
        }

        /* ── LOGIN PAGE ──────────────────────────────────────────────────────── */
        .login-container {
            display: none;           /* Hidden by default to prevent flash on refresh */
            min-height: 100vh;
        }

        /* JS adds .ready to body once init decides which screen to show */
        body.ready .login-container.visible {
            display: flex;
        }

        /* Left brand panel */
        .login-brand-panel {
            flex: 0 0 44%;
            background: linear-gradient(160deg, #132d1f 0%, #1e5234 45%, #2a7348 100%);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 60px 48px;
            position: relative;
            overflow: hidden;
        }

        .login-brand-panel::before {
            content: '';
            position: absolute;
            width: 420px;
            height: 420px;
            border-radius: 50%;
            border: 55px solid rgba(245, 197, 24, .07);
            top: -120px;
            right: -130px;
        }

        .login-brand-panel::after {
            content: '';
            position: absolute;
            width: 320px;
            height: 320px;
            border-radius: 50%;
            border: 45px solid rgba(255, 255, 255, .04);
            bottom: -90px;
            left: -90px;
        }

        .lbp-blob1 {
            position: absolute;
            width: 220px;
            height: 220px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(245, 197, 24, .09) 0%, transparent 70%);
            top: 12%;
            left: 55%;
            transform: translateX(-50%);
        }

        .lbp-blob2 {
            position: absolute;
            width: 160px;
            height: 160px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(255, 255, 255, .05) 0%, transparent 70%);
            bottom: 18%;
            right: 8%;
        }

        /* Logo circle */
        .login-logo-ring {
            width: 116px;
            height: 116px;
            border-radius: 50%;
            background: rgba(255, 255, 255, .08);
            border: 2.5px solid rgba(245, 197, 24, .55);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 28px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .1);
            backdrop-filter: blur(4px);
        }

        .login-brand-name {
            font-size: 28px;
            font-weight: 800;
            color: #fff;
            text-align: center;
            line-height: 1.25;
            letter-spacing: .3px;
            margin-bottom: 6px;
        }

        .login-brand-name span {
            color: #f5c518;
        }

        .login-brand-tagline {
            font-size: 11px;
            color: rgba(255, 255, 255, .5);
            text-transform: uppercase;
            letter-spacing: 2.5px;
            text-align: center;
            margin-bottom: 36px;
        }

        .login-brand-divider {
            width: 52px;
            height: 3px;
            background: linear-gradient(90deg, transparent, #f5c518, transparent);
            border-radius: 2px;
            margin: 0 auto 36px;
        }

        .login-feature-list {
            display: flex;
            flex-direction: column;
            gap: 14px;
            align-self: stretch;
        }

        .login-feature-item {
            display: flex;
            align-items: center;
            gap: 13px;
            color: rgba(255, 255, 255, .78);
            font-size: 13.5px;
        }

        .login-feature-icon {
            width: 36px;
            height: 36px;
            flex-shrink: 0;
            background: rgba(245, 197, 24, .14);
            border: 1px solid rgba(245, 197, 24, .28);
            border-radius: 9px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
        }

        .login-brand-ver {
            position: absolute;
            bottom: 22px;
            font-size: 10px;
            color: rgba(255, 255, 255, .25);
            letter-spacing: 1.5px;
            text-transform: uppercase;
        }

        /* Right form panel */
        .login-form-panel {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 48px 40px;
            background: #fff;
        }

        .login-form-box {
            width: 100%;
            max-width: 390px;
        }

        .login-erp-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #f0faf4;
            border: 1px solid #a8dfc0;
            color: #1e6e3d;
            padding: 5px 14px;
            border-radius: 20px;
            font-size: 11.5px;
            font-weight: 700;
            letter-spacing: .6px;
            margin-bottom: 30px;
        }

        .login-welcome-head {
            font-size: 27px;
            font-weight: 700;
            color: #111;
            margin-bottom: 6px;
        }

        .login-welcome-sub {
            font-size: 14px;
            color: #9a9a9a;
            margin-bottom: 36px;
        }

        .login-field {
            margin-bottom: 22px;
        }

        .login-field label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: #3a3a3a;
            margin-bottom: 8px;
        }

        .login-field input {
            width: 100%;
            padding: 12px 16px;
            border: 1.5px solid #e4e4e4;
            border-radius: 9px;
            font-size: 14px;
            color: #222;
            background: #fafafa;
            outline: none;
            transition: border-color .2s, box-shadow .2s, background .2s;
        }

        .login-field input::placeholder {
            color: #c0c0c0;
        }

        .login-field input:focus {
            border-color: #2d7a50;
            background: #fff;
            box-shadow: 0 0 0 3.5px rgba(45, 122, 80, .12);
        }

        .btn-login {
            width: 100%;
            padding: 13.5px;
            background: linear-gradient(135deg, #1e6e3d 0%, #2e9e5a 100%);
            color: #fff;
            border: none;
            border-radius: 9px;
            font-size: 15px;
            font-weight: 700;
            cursor: pointer;
            letter-spacing: .4px;
            margin-top: 6px;
            transition: all .22s;
            box-shadow: 0 5px 18px rgba(30, 110, 61, .32);
        }

        .btn-login:hover {
            background: linear-gradient(135deg, #165830 0%, #268048 100%);
            box-shadow: 0 7px 24px rgba(30, 110, 61, .42);
            transform: translateY(-1px);
        }

        .btn-login:active {
            transform: translateY(0);
            box-shadow: 0 3px 10px rgba(30, 110, 61, .3);
        }

        .login-form-footer {
            text-align: center;
            margin-top: 40px;
            font-size: 11px;
            color: #ccc;
            letter-spacing: .5px;
        }

        /* Responsive */
        @media (max-width: 780px) {
            .login-brand-panel {
                display: none;
            }

            .login-form-panel {
                padding: 36px 24px;
            }
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #555;
            font-weight: 500;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 14px;
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--primary);
        }

        .form-group small {
            color: #999;
            font-size: 12px;
            display: block;
            margin-top: 3px;
        }

        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 15px;
            background: #f9f9f9;
            border-radius: 5px;
            margin-bottom: 15px;
        }

        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .checkbox-item input[type="checkbox"] {
            width: auto;
        }

        .checkbox-item label {
            margin: 0;
            font-weight: normal;
        }

        .permission-section {
            margin-bottom: 20px;
            padding: 15px;
            background: var(--primary-bg);
            border-radius: 5px;
            border: 1px solid var(--primary-border);
        }

        .permission-section h4 {
            margin-bottom: 10px;
            color: var(--info);
        }

        .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s;
        }

        .btn-primary {
            background: var(--primary);
            color: white;
            width: 100%;
        }

        .btn-primary:hover {
            background: var(--primary-hover);
        }

        .btn-success {
            background: var(--success);
            color: white;
        }

        .btn-success:hover {
            background: var(--success-hover);
        }

        .btn-danger {
            background: var(--danger);
            color: white;
        }

        .btn-danger:hover {
            background: var(--danger-hover);
        }

        .btn-secondary {
            background: var(--secondary);
            color: #333;
        }

        .btn-secondary:hover {
            background: var(--secondary-hover);
        }

        .btn-info {
            background: var(--info);
            color: white;
        }

        .btn-info:hover {
            background: var(--info-hover);
        }

        .btn-warning {
            background: var(--warning);
            color: white;
        }

        .btn-warning:hover {
            background: var(--warning-hover);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .app-container {
            display: none;
            min-height: 100vh;
        }

        .app-container.active {
            display: flex;
        }

        .sidebar {
            width: 250px;
            background: white;
            box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 1px solid #f0f0f0;
        }

        .sidebar-header h2 {
            color: var(--primary);
            font-size: 20px;
        }

        .nav-menu {
            list-style: none;
            padding: 20px 0;
        }

        .nav-item {
            padding: 12px 20px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .nav-item:hover {
            background: #f5f5f5;
        }

        .nav-item.active {
            background: var(--primary-nav-bg);
            color: var(--primary);
            border-right: 3px solid var(--primary);
        }

        .nav-item.disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .nav-group-label {
            padding: 14px 16px 5px;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1.2px;
            color: #b0b8c1;
            cursor: default;
            pointer-events: none;
            user-select: none;
            border-top: 1px solid #f0f0f0;
            margin-top: 4px;
            list-style: none;
        }

        .nav-divider {
            height: 1px;
            background: #f0f0f0;
            margin: 8px 0;
            pointer-events: none;
            list-style: none;
        }

        .main-content {
            margin-left: 250px;
            padding: 20px;
            width: calc(100% - 250px);
        }

        .header {
            background: white;
            padding: 15px 20px;
            border-radius: 8px;
            margin-bottom: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .user-badge {
            background: var(--primary);
            color: white;
            padding: 5px 10px;
            border-radius: 5px;
            font-size: 12px;
        }

        /* ── Profile Button (header) ────────────────────────────────────── */
        .profile-btn {
            display: flex;
            align-items: center;
            gap: 10px;
            background: linear-gradient(135deg, rgba(102,126,234,0.08), rgba(118,75,162,0.08));
            border: 1.5px solid rgba(102,126,234,0.2);
            border-radius: 28px;
            padding: 5px 14px 5px 5px;
            cursor: pointer;
            color: #333;
            transition: all 0.2s ease;
            font-family: inherit;
            text-align: left;
        }
        .profile-btn:hover {
            background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.15));
            border-color: rgba(102,126,234,0.4);
            box-shadow: 0 2px 8px rgba(102,126,234,0.18);
        }
        .profile-avatar-sm {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea, #764ba2);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 13px;
            color: #fff;
            flex-shrink: 0;
            letter-spacing: 0.5px;
        }
        .profile-btn-name {
            font-size: 13px;
            font-weight: 600;
            color: #2c2c2c;
            line-height: 1.2;
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .profile-btn-role {
            font-size: 11px;
            color: #888;
            line-height: 1.2;
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .profile-chevron {
            font-size: 10px;
            color: #aaa;
            margin-left: 2px;
        }

        /* ── Profile Modal ──────────────────────────────────────────────── */
        .profile-modal-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 12px 12px 0 0;
            padding: 24px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .profile-modal-avatar-lg {
            width: 68px;
            height: 68px;
            border-radius: 50%;
            background: rgba(255,255,255,0.22);
            border: 3px solid rgba(255,255,255,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 26px;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
            letter-spacing: 1px;
        }
        .profile-tab-bar {
            display: flex;
            border-bottom: 1px solid #ebebeb;
            background: #fafafa;
        }
        .profile-tab {
            flex: 1;
            padding: 13px 8px;
            border: none;
            background: none;
            cursor: pointer;
            font-size: 13px;
            color: #777;
            border-bottom: 3px solid transparent;
            transition: all 0.18s;
            font-family: inherit;
            font-weight: 500;
        }
        .profile-tab.active {
            color: #667eea;
            border-bottom-color: #667eea;
            background: #fff;
            font-weight: 600;
        }
        .profile-tab:hover:not(.active) {
            background: #f0f0f0;
            color: #555;
        }
        .profile-info-row {
            display: flex;
            padding: 13px 0;
            border-bottom: 1px solid #f3f3f3;
            align-items: flex-start;
        }
        .profile-info-row:last-child { border-bottom: none; }
        .pil {
            width: 130px;
            font-size: 11px;
            color: #aaa;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            flex-shrink: 0;
            padding-top: 1px;
        }
        .piv {
            font-size: 14px;
            color: #222;
            font-weight: 500;
            flex: 1;
        }
        .profile-pwd-eye {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            cursor: pointer;
            color: #aaa;
            font-size: 16px;
            padding: 0;
            line-height: 1;
        }
        .profile-pwd-eye:hover { color: #667eea; }
        .profile-google-icon {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 30px;
            margin: 0 auto 14px;
            font-weight: 700;
        }

        .card {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            margin-bottom: 20px;
        }

        .card h2,
        .card h3 {
            margin-bottom: 20px;
            color: #333;
        }

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

        .stat-card {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .stat-value {
            font-size: 32px;
            font-weight: bold;
            color: var(--primary);
        }

        .stat-label {
            color: #666;
            margin-top: 5px;
        }

        .chart-container {
            position: relative;
            height: 300px;
            margin-bottom: 20px;
        }

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

        th,
        td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #f0f0f0;
        }

        th {
            background: #fafafa;
            font-weight: 600;
            color: #333;
        }

        tr:hover {
            background: #fafafa;
        }

        .badge {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
        }

        .badge-success {
            background: var(--success-bg);
            color: var(--success);
            border: 1px solid var(--success-border);
        }

        .badge-warning {
            background: var(--warning-bg);
            color: var(--warning);
            border: 1px solid var(--warning-border);
        }

        .badge-danger {
            background: var(--danger-bg);
            color: var(--danger);
            border: 1px solid var(--danger-border);
        }

        .badge-info {
            background: var(--info-bg);
            color: var(--info);
            border: 1px solid var(--info-border);
        }

        .badge-partial {
            background: #fff7e6;
            color: #fa8c16;
            border: 1px solid #ffd591;
        }

        /* Dispatch quantity input in partial dispatch modal */
        .dispatch-qty-input {
            width: 72px;
            padding: 5px 6px;
            border: 1px solid #ddd;
            border-radius: 4px;
            text-align: center;
            font-size: 13px;
        }

        .dispatch-qty-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .dispatch-row-done {
            color: #52c41a;
            font-weight: 700;
            font-size: 13px;
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: white;
            padding: 30px;
            border-radius: 8px;
            max-width: 800px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
        }

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

        .modal-header h3 {
            color: #333;
        }

        .close-btn {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            color: #999;
        }

        .close-btn:hover {
            color: #333;
        }

        .btn-group {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .action-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .error-message {
            background: var(--danger-bg);
            color: var(--danger);
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 15px;
            border: 1px solid var(--danger-border);
        }

        .success-message {
            background: var(--success-bg);
            color: var(--success);
            padding: 10px;
            border-radius: 5px;
            margin-bottom: 15px;
            border: 1px solid var(--success-border);
        }

        .warning-message {
            background: var(--warning-bg);
            color: var(--warning);
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 15px;
            border: 1px solid var(--warning-border);
        }

        .page {
            display: none;
        }

        .page.active {
            display: block;
        }

        .po-items-table {
            margin-top: 20px;
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }

        .po-items-table th {
            background: #fafafa;
            padding: 8px 10px;
            border-bottom: 2px solid #e8e8e8;
            color: #555;
            font-weight: 600;
            white-space: nowrap;
        }

        .po-items-table td {
            padding: 6px 6px;
            border-bottom: 1px solid #f5f5f5;
            vertical-align: middle;
        }

        /* Column widths */
        .po-items-table th:nth-child(1),
        .po-items-table td:nth-child(1) {
            width: 22%;
        }

        .po-items-table th:nth-child(2),
        .po-items-table td:nth-child(2) {
            width: 28%;
        }

        .po-items-table th:nth-child(3),
        .po-items-table td:nth-child(3) {
            width: 12%;
            text-align: center;
        }

        .po-items-table th:nth-child(4),
        .po-items-table td:nth-child(4) {
            width: 12%;
            text-align: center;
        }

        .po-items-table th:nth-child(5),
        .po-items-table td:nth-child(5) {
            width: 14%;
            text-align: center;
        }

        .po-items-table th:nth-child(6),
        .po-items-table td:nth-child(6) {
            width: 6%;
            text-align: center;
        }

        .po-items-table select,
        .po-items-table input[type="number"],
        .po-items-table input[type="text"] {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid #d9d9d9;
            border-radius: 5px;
            font-size: 12px;
            box-sizing: border-box;
        }

        .po-items-table select:focus,
        .po-items-table input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .po-items-table input[readonly] {
            background: #f5f5f5;
            color: #333;
            font-weight: 600;
            border-color: #e8e8e8;
            text-align: center;
        }

        .po-items-table button {
            padding: 5px 10px;
            font-size: 12px;
        }

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

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

        .filter-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .filter-buttons button {
            padding: 8px 16px;
        }

        .filter-buttons button.active {
            background: var(--primary);
            color: white;
        }

        .weight-display {
            background: var(--primary-bg);
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px;
            border: 1px solid var(--primary-border);
        }

        .weight-display strong {
            color: var(--info);
            font-size: 18px;
        }

        .auto-calculated {
            background: var(--warning-bg);
            padding: 5px;
            border-radius: 3px;
            font-size: 12px;
            color: var(--warning);
        }

        .delete-confirmation {
            background: var(--danger-bg);
            padding: 20px;
            border-radius: 5px;
            border: 2px solid var(--danger);
        }

        .delete-confirmation h4 {
            color: var(--danger);
            margin-bottom: 15px;
        }

        .delete-confirmation input {
            padding: 10px;
            border: 2px solid var(--danger);
            border-radius: 5px;
            width: 100%;
            font-size: 16px;
            text-align: center;
            font-weight: bold;
        }

        .permissions-list {
            max-height: 400px;
            overflow-y: auto;
        }

        /* Production Entry Styles */
        .production-entry-form {
            background: #f9f9f9;
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        .production-items {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .production-item-row {
            display: grid;
            grid-template-columns: 2fr 1fr auto;
            gap: 10px;
            align-items: end;
            padding: 15px;
            background: white;
            border-radius: 5px;
        }

        .packing-item-row {
            display: grid;
            grid-template-columns: 2fr 1fr auto;
            gap: 10px;
            align-items: end;
            padding: 15px;
            background: white;
            border-radius: 5px;
        }

        /* Inventory Styles */
        .inventory-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 15px;
            margin-bottom: 20px;
        }

        .inventory-card {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            border-left: 4px solid var(--primary);
        }

        .inventory-card h4 {
            margin-bottom: 10px;
            color: #333;
        }

        .inventory-stock {
            font-size: 28px;
            font-weight: bold;
            color: var(--primary);
            margin: 10px 0;
        }

        .inventory-card.low-stock {
            border-left-color: var(--danger);
        }

        .inventory-card.low-stock .inventory-stock {
            color: var(--danger);
        }

        .movement-history {
            max-height: 400px;
            overflow-y: auto;
        }

        .stock-alert {
            background: var(--danger-bg);
            padding: 15px;
            border-radius: 5px;
            border-left: 4px solid var(--danger);
            margin-bottom: 20px;
        }

        .stock-alert h4 {
            color: var(--danger);
            margin-bottom: 10px;
        }

        /* ==============================================================
           ★ DESIGN TOKENS — Edit values here to retheme the entire app
           ============================================================== */
        :root {
            /* Brand */
            --primary: #667eea;
            --primary-hover: #5568d3;
            --primary-dark: #764ba2;
            --primary-bg: #f0f5ff;
            --primary-border: #adc6ff;
            --primary-nav-bg: #e6f0ff;
            /* Success */
            --success: #52c41a;
            --success-hover: #3ea315;
            --success-bg: #f6ffed;
            --success-border: #b7eb8f;
            /* Danger */
            --danger: #ff4d4f;
            --danger-hover: #e63d3f;
            --danger-bg: #fff1f0;
            --danger-border: #ffccc7;
            /* Warning */
            --warning: #faad14;
            --warning-hover: #d89000;
            --warning-bg: #fffbe6;
            --warning-border: #ffe58f;
            /* Info */
            --info: #1890ff;
            --info-hover: #0d7de0;
            --info-bg: #e6f7ff;
            --info-border: #91d5ff;
            /* Neutral */
            --secondary: #d9d9d9;
            --secondary-hover: #c9c9c9;
            /* Text */
            --text-dark: #333;
            --text-medium: #555;
            --text-light: #666;
            --text-muted: #999;
            /* Surfaces */
            --bg-body: #f5f5f5;
            --bg-card: #ffffff;
            --bg-form: #f9f9f9;
            --bg-table: #fafafa;
            /* Borders */
            --border-light: #f0f0f0;
            --border-default: #ddd;
            /* Elevation */
            --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
            --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.10);
            /* Shape */
            --radius-sm: 4px;
            --radius-md: 5px;
            --radius-lg: 8px;
            --radius-xl: 10px;
        }

        /* ==============================================================
           TOAST NOTIFICATION SYSTEM
           ============================================================== */
        #toastContainer {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 10px;
            pointer-events: none;
        }

        .toast {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 14px 16px;
            border-radius: var(--radius-lg);
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
            font-size: 14px;
            font-weight: 500;
            line-height: 1.45;
            max-width: 380px;
            min-width: 260px;
            background: white;
            pointer-events: all;
            animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            border-left: 4px solid var(--info);
        }

        .toast.removing {
            animation: toastSlideOut 0.25s ease forwards;
        }

        .toast-success {
            border-left-color: var(--success);
        }

        .toast-error {
            border-left-color: var(--danger);
        }

        .toast-warning {
            border-left-color: var(--warning);
        }

        .toast-info {
            border-left-color: var(--info);
        }

        .toast-icon {
            font-size: 20px;
            flex-shrink: 0;
            margin-top: 1px;
        }

        .toast-body {
            flex: 1;
            color: var(--text-dark);
        }

        .toast-close {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--text-muted);
            font-size: 18px;
            line-height: 1;
            padding: 0 2px;
            flex-shrink: 0;
            transition: color 0.15s;
        }

        .toast-close:hover {
            color: var(--text-dark);
        }

        @keyframes toastSlideIn {
            from {
                opacity: 0;
                transform: translateX(110%)
            }

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

        @keyframes toastSlideOut {
            from {
                opacity: 1;
                transform: translateX(0)
            }

            to {
                opacity: 0;
                transform: translateX(110%)
            }
        }

        /* ==============================================================
           LOADING SPINNER ON BUTTONS
           ============================================================== */
        .btn-loading {
            position: relative;
            pointer-events: none;
            opacity: 0.80;
            padding-right: 36px !important;
        }

        .btn-loading::after {
            content: '';
            position: absolute;
            top: 50%;
            right: 10px;
            width: 13px;
            height: 13px;
            border: 2px solid rgba(255, 255, 255, 0.4);
            border-top-color: #fff;
            border-radius: 50%;
            transform: translateY(-50%);
            animation: btnSpin 0.65s linear infinite;
        }

        @keyframes btnSpin {
            to {
                transform: translateY(-50%) rotate(360deg);
            }
        }

        /* ==============================================================
           TABLE TOOLBAR (search + action buttons above a table)
           ============================================================== */
        .table-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 14px;
        }

        .table-toolbar h3,
        .table-toolbar h2 {
            margin-bottom: 0 !important;
        }

        .toolbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .search-input {
            padding: 7px 10px 7px 32px;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-md);
            font-size: 13px;
            width: 200px;
            background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 9px center;
            transition: border-color 0.2s;
        }

        .search-input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .date-range {
            display: flex;
            align-items: center;
            gap: 5px;
            flex-wrap: wrap;
        }

        .date-range label {
            font-size: 11px;
            color: var(--text-muted);
            white-space: nowrap;
        }

        .date-range input[type=date] {
            padding: 5px 7px;
            border: 1px solid var(--border-default);
            border-radius: var(--radius-sm);
            font-size: 12px;
            cursor: pointer;
        }

        .date-range input[type=date]:focus {
            outline: none;
            border-color: var(--primary);
        }

        .record-count {
            font-size: 11px;
            color: var(--text-muted);
            white-space: nowrap;
        }

        /* ==============================================================
           EMPTY STATE (unified across all tables)
           ============================================================== */
        .empty-state {
            text-align: center;
            padding: 50px 20px;
            color: var(--text-muted);
        }

        .empty-state .es-icon {
            font-size: 48px;
            display: block;
            margin-bottom: 10px;
        }

        .empty-state .es-title {
            font-size: 15px;
            font-weight: 600;
            color: var(--text-light);
            margin-bottom: 4px;
        }

        .empty-state .es-sub {
            font-size: 13px;
            margin: 0;
        }

        /* ==============================================================
           PRINT & EXPORT ACTION BUTTONS
           ============================================================== */
        .btn-print {
            background: var(--text-light);
            color: white;
            border: none;
            border-radius: var(--radius-md);
            padding: 7px 13px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: background 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .btn-print:hover {
            background: var(--text-dark);
        }

        .btn-export {
            background: #217346;
            color: white;
            border: none;
            border-radius: var(--radius-md);
            padding: 7px 13px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: background 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .btn-export:hover {
            background: #1a5c38;
        }

        /* ==============================================================
           PO FILTER BAR
           ============================================================== */
        .po-filter-bar {
            background: #fafafa;
            border: 1px solid var(--border-light);
            border-radius: var(--radius-lg);
            padding: 10px 14px;
            margin-bottom: 14px;
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            justify-content: space-between;
        }

        .po-chip-group {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        .po-chip {
            padding: 5px 12px;
            border-radius: 20px;
            border: 1px solid #d9d9d9;
            background: #fff;
            color: #555;
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
            white-space: nowrap;
            line-height: 1.4;
        }

        .po-chip:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: var(--primary-bg);
        }

        .po-chip.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
            font-weight: 600;
        }

        .po-chip-pending.active {
            background: #faad14;
            border-color: #faad14;
            color: #fff;
        }

        .po-chip-partial.active {
            background: #fa8c16;
            border-color: #fa8c16;
            color: #fff;
        }

        .po-chip-dispatched.active {
            background: #52c41a;
            border-color: #52c41a;
            color: #fff;
        }

        .po-chip-overdue.active {
            background: #ff4d4f;
            border-color: #ff4d4f;
            color: #fff;
        }

        .po-chip-today.active {
            background: #1890ff;
            border-color: #1890ff;
            color: #fff;
        }

        .po-chip-week.active {
            background: #722ed1;
            border-color: #722ed1;
            color: #fff;
        }

        .po-chip-divider {
            width: 1px;
            height: 22px;
            background: #d9d9d9;
            margin: 0 2px;
        }

        .po-date-filter {
            display: flex;
            align-items: center;
            gap: 7px;
            flex-wrap: wrap;
        }

        .po-date-filter select,
        .po-date-filter input[type="date"] {
            padding: 5px 8px;
            border: 1px solid #d9d9d9;
            border-radius: var(--radius-md);
            font-size: 12px;
            color: #555;
            background: #fff;
        }

        .po-date-filter select:focus,
        .po-date-filter input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .po-date-clear {
            padding: 4px 9px;
            border: 1px solid #d9d9d9;
            border-radius: var(--radius-md);
            background: #fff;
            color: #888;
            font-size: 12px;
            cursor: pointer;
        }

        .po-date-clear:hover {
            background: #fff1f0;
            border-color: #ffccc7;
            color: #cf1322;
        }

        /* Summary strip */
        .po-summary-strip {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
            align-items: center;
            font-size: 12px;
            color: #888;
            padding: 6px 4px 10px;
            border-bottom: 1px solid var(--border-light);
            margin-bottom: 4px;
        }

        .po-summary-strip .ps-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .po-summary-strip .ps-val {
            font-weight: 700;
            color: #333;
        }

        .po-summary-strip .ps-sep {
            color: #d9d9d9;
        }

        /* ==============================================================
           ANALYTICS PAGE
           ============================================================== */
        .analysis-group-tabs {
            display: flex;
            gap: 3px;
            background: #f0f2f5;
            border-radius: 8px;
            padding: 4px;
            flex-wrap: wrap;
            margin-bottom: 14px;
        }

        .analysis-group-tab {
            flex: 1 1 auto;
            min-width: 110px;
            padding: 8px 10px;
            border: none;
            border-radius: 6px;
            background: transparent;
            font-size: 12px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            transition: all .15s;
            white-space: nowrap;
            text-align: center;
        }

        .analysis-group-tab.active {
            background: #fff;
            color: var(--primary);
            box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
        }

        .analysis-group-tab:hover:not(.active) {
            background: rgba(255, 255, 255, .6);
            color: #333;
        }

        .analysis-sub-tabs {
            display: flex;
            gap: 6px;
            margin-bottom: 14px;
            flex-wrap: wrap;
        }

        .analysis-sub-tab {
            padding: 5px 14px;
            border: 1.5px solid #d9d9d9;
            border-radius: 20px;
            background: #fff;
            font-size: 12px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            transition: all .15s;
        }

        .analysis-sub-tab.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }

        .analysis-chart-wrap {
            position: relative;
            height: 320px;
            width: 100%;
        }

        .analysis-chart-wrap canvas {
            position: absolute;
            inset: 0;
        }

        .analysis-empty-overlay {
            position: absolute;
            inset: 0;
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(4px);
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 10;
            gap: 12px;
        }

        .analysis-empty-overlay.show {
            display: flex !important;
        }

        .analysis-kpi-row {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
            gap: 10px;
            margin-bottom: 14px;
        }

        .analysis-kpi-card {
            background: #fafafa;
            border: 1px solid #f0f0f0;
            border-radius: 8px;
            padding: 11px 12px;
            text-align: center;
        }

        .analysis-kpi-val {
            font-size: 20px;
            font-weight: 700;
            line-height: 1.2;
        }

        .analysis-kpi-lbl {
            font-size: 11px;
            color: #888;
            margin-top: 3px;
        }

        .analysis-date-bar {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            padding: 10px 16px;
            background: #fff;
            border: 1px solid #e8e8e8;
            border-radius: 8px;
            margin-bottom: 14px;
        }

        .analysis-group-panel {
            display: none;
        }

        .analysis-group-panel.active {
            display: block;
        }

        .analysis-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
        }

        /* ==============================================================
           DATA PROTECTION — locked entry styles
           ============================================================== */
        .btn-locked {
            background: #f5f5f5 !important;
            border: 1px solid #d9d9d9 !important;
            color: #bbb !important;
            cursor: not-allowed !important;
            padding: 4px 10px !important;
            font-size: 12px !important;
            border-radius: 4px !important;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .lock-period-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #fff1f0;
            border: 1px solid #ffa39e;
            color: #cf1322;
            border-radius: 20px;
            padding: 3px 12px;
            font-size: 12px;
            font-weight: 600;
            margin: 3px;
        }

        .lock-period-chip button {
            background: none;
            border: none;
            color: #cf1322;
            cursor: pointer;
            font-size: 15px;
            line-height: 1;
            padding: 0 0 0 4px;
        }

        .dp-setting-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 14px 0;
            border-bottom: 1px solid #f0f0f0;
        }

        .dp-setting-row:last-child {
            border-bottom: none;
        }

        .dp-setting-label {
            font-weight: 600;
            font-size: 13px;
            min-width: 200px;
        }

        .dp-setting-sub {
            font-size: 11px;
            color: #888;
            margin-top: 2px;
        }

        /* ==============================================================
           PRINT STYLES
           ============================================================== */
        @media print {

            .sidebar,
            .header,
            .filter-buttons,
            .action-buttons,
            .btn-group,
            .btn-print,
            .btn-export,
            .table-toolbar,
            #toastContainer,
            form,
            .production-entry-form {
                display: none !important;
            }

            .main-content {
                margin-left: 0 !important;
                width: 100% !important;
                padding: 10px !important;
            }

            .page {
                display: none !important;
            }

            .page.active {
                display: block !important;
            }

            .card {
                box-shadow: none !important;
                border: 1px solid #ddd !important;
                break-inside: avoid;
            }

            @page {
                margin: 1.5cm;
            }
        }


        /* ==============================================================
           CSV IMPORT MODAL
           ============================================================== */
        .import-drop-zone {
            border: 2px dashed var(--border-default);
            border-radius: var(--radius-lg);
            padding: 48px 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            background: var(--bg-form);
            position: relative;
        }

        .import-drop-zone:hover,
        .import-drop-zone.drag-over {
            border-color: var(--primary);
            background: var(--primary-bg);
        }

        .import-drop-zone .dz-icon {
            font-size: 48px;
            display: block;
            margin-bottom: 10px;
        }

        .import-drop-zone .dz-title {
            font-size: 15px;
            font-weight: 600;
            color: var(--text-medium);
            margin: 0 0 4px;
        }

        .import-drop-zone .dz-sub {
            font-size: 12px;
            color: var(--text-muted);
            margin: 0;
        }

        .import-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .import-badge-new {
            background: #f6ffed;
            color: #389e0d;
            border: 1px solid #b7eb8f;
        }

        .import-badge-newcat {
            background: #e6f7ff;
            color: #0958d9;
            border: 1px solid #91d5ff;
        }

        .import-badge-dup {
            background: #fffbe6;
            color: #d46b08;
            border: 1px solid #ffd591;
        }

        .import-badge-invalid {
            background: #fff1f0;
            color: #cf1322;
            border: 1px solid #ffa39e;
        }

        .import-status-dot {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .dot-new {
            background: #52c41a;
        }

        .dot-newcat {
            background: #1890ff;
        }

        .dot-dup {
            background: #faad14;
        }

        .dot-invalid {
            background: #ff4d4f;
        }

        #importPreviewBody tr.row-dup {
            background: #fffbe6;
        }

        #importPreviewBody tr.row-invalid {
            background: #fff1f0;
        }

        #importPreviewBody tr.row-newcat {
            background: #e6f7ff;
        }

        .import-file-chosen {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-top: 12px;
            padding: 10px 16px;
            background: var(--primary-bg);
            border-radius: var(--radius-md);
            font-size: 13px;
            color: var(--primary);
            font-weight: 500;
        }

        /* ── GUI CONSISTENCY HELPERS ──────────────────────────────────────── */

        /* Standardised form label — use on all <label> elements in forms */
        .form-label {
            display: block;
            font-size: 12px;
            font-weight: 600;
            color: #444;
            margin-bottom: 4px;
        }

        /* Sub-hint text under inputs */
        .form-hint {
            display: block;
            font-size: 10px;
            color: #888;
            margin-top: 3px;
        }

        /* Standardised modal close button (top-right ×) */
        .modal-close-btn {
            position: absolute;
            top: 14px;
            right: 16px;
            background: none;
            border: none;
            font-size: 22px;
            line-height: 1;
            color: #999;
            cursor: pointer;
            padding: 0 4px;
            border-radius: 4px;
            transition: color 0.15s, background 0.15s;
        }

        .modal-close-btn:hover {
            color: #ff4d4f;
            background: #fff1f0;
        }

        /* Standardised sub-tab bar */
        .sub-tabs-bar {
            display: flex;
            gap: 0;
            border-bottom: 2px solid #e8e8e8;
            margin-bottom: 20px;
            overflow-x: auto;
        }

        .sub-tab-btn {
            padding: 10px 20px;
            font-size: 13px;
            font-weight: 600;
            color: #888;
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -2px;
            cursor: pointer;
            white-space: nowrap;
            transition: color 0.15s, border-color 0.15s;
        }

        .sub-tab-btn:hover {
            color: #667eea;
        }

        .sub-tab-btn.active {
            color: #667eea;
            border-bottom-color: #667eea;
        }

        /* Standardised section card header */
        .card-section-header {
            padding: 14px 20px;
            border-bottom: 1px solid #f0f0f0;
            margin: -20px -20px 16px -20px;
            background: #fafbff;
            border-radius: 10px 10px 0 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .card-section-header h3,
        .card-section-header h4 {
            margin: 0;
            font-size: 15px;
            font-weight: 700;
            color: #2d2d2d;
        }

        /* Consistent info/warning/success inline banners */
        .inline-banner {
            padding: 10px 14px;
            border-radius: 6px;
            font-size: 13px;
            margin: 10px 0;
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .inline-banner.info {
            background: #e6f7ff;
            border: 1px solid #91d5ff;
            color: #0050b3;
        }

        .inline-banner.success {
            background: #f6ffed;
            border: 1px solid #b7eb8f;
            color: #237804;
        }

        .inline-banner.warning {
            background: #fffbe6;
            border: 1px solid #ffe58f;
            color: #874d00;
        }

        .inline-banner.danger {
            background: #fff1f0;
            border: 1px solid #ffa39e;
            color: #820014;
        }

        /* Monospace batch number display */
        .batch-tag {
            display: inline-block;
            font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
            font-size: 12px;
            font-weight: 700;
            background: #f0f5ff;
            color: #2f54eb;
            border: 1px solid #adc6ff;
            padding: 2px 8px;
            border-radius: 4px;
            letter-spacing: 0.5px;
        }

        /* Consistent status badges */
        .status-badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 700;
            border: 1px solid;
        }

        .status-badge.open {
            background: #f6ffed;
            color: #52c41a;
            border-color: #b7eb8f;
        }

        .status-badge.partial {
            background: #fff7e6;
            color: #fa8c16;
            border-color: #ffd591;
        }

        .status-badge.closed {
            background: #f9f0ff;
            color: #722ed1;
            border-color: #d3adf7;
        }

        .status-badge.pending {
            background: #fffbe6;
            color: #d48806;
            border-color: #ffe58f;
        }

        .status-badge.active {
            background: #f6ffed;
            color: #389e0d;
            border-color: #52c41a;
        }

        .status-badge.danger {
            background: #fff1f0;
            color: #cf1322;
            border-color: #ffa39e;
        }

        /* ── ANALYTICS PREMIUM STYLING ────────────────────────────────────────── */
        .analysis-group-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
            flex-wrap: wrap;
            background: #fff;
            padding: 6px;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
            border: 1px solid #edf2f7;
        }

        .analysis-group-tab {
            padding: 10px 18px;
            border: none;
            background: transparent;
            color: #718096;
            font-size: 13.5px;
            font-weight: 600;
            cursor: pointer;
            border-radius: 9px;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .analysis-group-tab:hover {
            background: #f7fafc;
            color: #4a5568;
        }

        .analysis-group-tab.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
        }

        .analysis-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            padding-bottom: 16px;
            border-bottom: 1px solid #f1f5f9;
        }

        .analysis-sub-tabs {
            display: flex;
            gap: 6px;
            background: #f1f5f9;
            padding: 4px;
            border-radius: 8px;
        }

        .analysis-sub-tab {
            padding: 6px 14px;
            border: none;
            background: transparent;
            font-size: 12px;
            font-weight: 600;
            color: #64748b;
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.2s;
        }

        .analysis-sub-tab:hover {
            color: #334155;
        }

        .analysis-sub-tab.active {
            background: #fff;
            color: #1e293b;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        }

        .analysis-kpi-row {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        .analysis-kpi-card {
            background: #fff;
            padding: 20px;
            border-radius: 16px;
            border: 1px solid #f1f5f9;
            position: relative;
            overflow: hidden;
            transition: transform 0.3s, box-shadow 0.3s;
        }

        .analysis-kpi-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
        }

        .analysis-kpi-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: var(--kpi-color, #667eea);
            opacity: 0.8;
        }

        .analysis-kpi-val {
            font-size: 26px;
            font-weight: 800;
            color: #1e293b;
            margin-bottom: 4px;
            letter-spacing: -0.5px;
        }

        .analysis-kpi-lbl {
            font-size: 12px;
            font-weight: 600;
            color: #94a3b8;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .analysis-chart-wrap {
            height: 380px;
            position: relative;
            background: #fff;
            padding: 15px;
            border-radius: 16px;
            border: 1px solid #f1f5f9;
        }


        /* Darker mode for financials specific button */
        .analysis-group-tab[onclick*="8"] {
            transition: border 0.3s;
        }

        .analysis-group-tab[onclick*="8"].active {
            background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
            box-shadow: 0 4px 15px rgba(56, 239, 125, 0.25) !important;
        }

        /* ── Connection Status Indicator ─────────────────────────────── */
        .connection-status {
            position: fixed;
            bottom: 16px;
            left: 16px;
            font-size: 12px;
            z-index: 9999;
            border-radius: 50%;
            width: 12px;
            height: 12px;
            line-height: 12px;
            text-align: center;
            cursor: help;
            transition: color 0.3s;
        }

        .connection-status.connected {
            color: #52c41a;
        }

        .connection-status.disconnected {
            color: #ff4d4f;
            animation: pulse-dot 1.5s infinite;
        }

        @keyframes pulse-dot {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }