:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --panel-bg: rgba(255, 255, 255, 0.75);
    --panel-border: rgba(99, 102, 241, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-primary: #4f46e5; /* Royal Indigo */
    --accent-primary-hover: #4338ca;
    --accent-success: #0d9488; /* Teal */
    --accent-success-hover: #0f766e;
    --accent-warning: #ea580c; /* Warm Orange */
    --accent-danger: #e11d48;  /* Rose */
    --accent-glow: rgba(79, 70, 229, 0.06);
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --glass-blur: blur(16px);
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.03), 0 2px 6px -1px rgba(15, 23, 42, 0.02), inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
    --premium-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.06), 0 10px 10px -5px rgba(15, 23, 42, 0.04);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-gradient);
    font-family: var(--font-sans);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: rgba(79, 70, 229, 0.18);
    box-shadow: var(--premium-shadow);
}

/* Form inputs styling for premium light mode */
.form-control, .form-select {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-primary) !important;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus, .form-select:focus {
    background: #ffffff !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 4px var(--accent-glow) !important;
    outline: none;
}

.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 0.8 !important;
}

/* Form Inputs Small styling */
.form-control-sm {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* High Contrast Form Focus overrides */
.glass-panel input, .glass-panel select, .glass-panel textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

.glass-panel input:focus, .glass-panel select:focus, .glass-panel textarea:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 4px var(--accent-glow) !important;
}

/* Button Click Micro-animations */
.btn {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    font-weight: 600;
}
.btn:active {
    transform: scale(0.96) !important;
}

/* Primary Button */
.btn-primary {
    background: var(--accent-gradient) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 0.75rem 1.5rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15) !important;
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 4px var(--accent-glow), 0 6px 16px rgba(79, 70, 229, 0.25) !important;
    transform: translateY(-1px);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 0.75rem 1.5rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15) !important;
}

.btn-success:hover, .btn-success:focus {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15), 0 6px 16px rgba(13, 148, 136, 0.25) !important;
    transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    padding: 0.75rem 1.5rem;
}

.btn-secondary:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Custom Nav Tabs Sidebar Wrapper */
.nav-tabs-wrapper {
    background: #f1f5f9;
    border-radius: 14px;
    padding: 6px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

/* Custom Sidebar Pills Navigation (Vercel/Stripe-inspired) */
.nav-pills .nav-link {
    color: var(--text-secondary) !important;
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid transparent !important;
    border-radius: 0 10px 10px 0 !important;
    margin-bottom: 4px;
    background: transparent;
}

.nav-pills .nav-link.active {
    background: #ffffff !important;
    color: var(--accent-primary) !important;
    border-left-color: var(--accent-primary) !important;
    border-top: 1px solid rgba(79, 70, 229, 0.06) !important;
    border-right: 1px solid rgba(79, 70, 229, 0.06) !important;
    border-bottom: 1px solid rgba(79, 70, 229, 0.06) !important;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.08) !important;
}

.nav-pills .nav-link:hover:not(.active) {
    color: var(--text-primary) !important;
    background: rgba(79, 70, 229, 0.03) !important;
    border-left-color: rgba(79, 70, 229, 0.3) !important;
    transform: translateX(6px);
}

/* Navigation Badges */
.nav-pills .nav-link .badge {
    background-color: rgba(100, 116, 139, 0.08) !important;
    color: var(--text-secondary) !important;
    border: 1px solid rgba(100, 116, 139, 0.12) !important;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-pills .nav-link.active .badge {
    background-color: var(--accent-primary) !important;
    color: #ffffff !important;
    border-color: var(--accent-primary) !important;
}

/* Monospace Pill Container for Key inside Client lists */
.table td input[id^="keyShow-"] {
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #4f46e5 !important;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    border-radius: 8px;
    padding: 4px 10px;
    letter-spacing: 0.5px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Beautiful Custom Tables */
.table {
    color: var(--text-primary) !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table th {
    border-bottom: 2px solid #e2e8f0 !important;
    color: var(--text-secondary) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 1px;
    padding: 1.1rem 1rem;
    background: rgba(248, 250, 252, 0.5);
}

.table td {
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle;
    padding: 1.1rem 1rem;
}

.table tr:hover td {
    background: rgba(79, 70, 229, 0.01);
}

/* Table Pagination Override */
.dataTables_wrapper .dataTables_length select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 5px 28px 5px 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    padding: 6px 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.page-item.active .page-link {
    background: var(--accent-gradient) !important;
    border-color: var(--accent-primary) !important;
    color: #ffffff !important;
    border-radius: 8px;
    font-weight: bold;
}

.page-link {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: var(--text-secondary) !important;
    border-radius: 8px;
    margin: 0 3px;
    padding: 6px 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #f8fafc !important;
    color: var(--accent-primary) !important;
    border-color: #cbd5e1 !important;
}

/* Copy Action Button Elements */
.copy-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}
.copy-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--text-primary);
}

.api-key-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    color: var(--accent-primary) !important;
    letter-spacing: 0.75px !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02) !important;
}

/* Header Avatar Elements styling */
.avatar-circle {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}
@keyframes avatarPulse {
    0% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.06); opacity: 0.85; }
    100% { transform: scale(1); opacity: 0.4; }
}
.avatar-circle::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    opacity: 0.4;
    transition: all 0.3s ease;
    animation: avatarPulse 2.5s infinite ease-in-out;
}
.avatar-circle:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2) !important;
}
.avatar-circle:hover::after {
    transform: scale(1.05);
    opacity: 0.9;
    border-color: #a855f7;
}



/* High Contrast badge system */
.text-white:not(.badge):not(.btn):not(.nav-link):not(code):not(pre *):not(.navbar-brand *):not(.avatar-circle) {
    color: var(--text-primary) !important;
}

.glass-panel .text-white:not(.badge):not(.btn):not(.nav-link):not(code):not(pre *):not(.avatar-circle):not(h2),
.glass-panel h1.text-white,
.glass-panel h2.text-white,
.glass-panel h3.text-white,
.glass-panel h4.text-white,
.glass-panel h5.text-white,
.glass-panel h6.text-white,
.glass-panel .fw-bold.text-white,
.glass-panel strong.text-white,
.glass-panel span.text-white,
.glass-panel code.text-white,
.glass-panel div.text-white,
.glass-panel p.text-white,
.glass-panel h5,
.glass-panel h6,
.glass-panel label {
    color: var(--text-primary) !important;
}

.glass-panel .badge {
    color: inherit !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* Pastels Badges styling */
.badge.bg-success {
    background-color: rgba(13, 148, 136, 0.08) !important;
    color: #0d9488 !important;
    border: 1px solid rgba(13, 148, 136, 0.18) !important;
}
.badge.bg-primary {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: #4f46e5 !important;
    border: 1px solid rgba(79, 70, 229, 0.18) !important;
}
.badge.bg-danger {
    background-color: rgba(225, 29, 72, 0.08) !important;
    color: #e11d48 !important;
    border: 1px solid rgba(225, 29, 72, 0.18) !important;
}
.badge.bg-warning {
    background-color: rgba(234, 88, 12, 0.08) !important;
    color: #ea580c !important;
    border: 1px solid rgba(234, 88, 12, 0.18) !important;
}
.badge.bg-secondary {
    background-color: rgba(100, 116, 139, 0.08) !important;
    color: #64748b !important;
    border: 1px solid rgba(100, 116, 139, 0.18) !important;
}

/* Custom premium status widget */
.badge.bg-live {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.2) !important;
}

/* Metric Cards style overrides */
.metric-card {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--premium-shadow) !important;
    border-color: rgba(79, 70, 229, 0.22) !important;
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card-glow-indigo {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%) !important;
    border: 1px solid rgba(79, 70, 229, 0.08) !important;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.02) !important;
}
.metric-card-glow-indigo::before {
    background: linear-gradient(90deg, #6366f1, #4f46e5) !important;
}

.metric-card-glow-success {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%) !important;
    border: 1px solid rgba(13, 148, 136, 0.08) !important;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.02) !important;
}
.metric-card-glow-success::before {
    background: linear-gradient(90deg, #14b8a6, #0d9488) !important;
}

.metric-card-glow-cyan {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%) !important;
    border: 1px solid rgba(6, 182, 212, 0.08) !important;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.02) !important;
}
.metric-card-glow-cyan::before {
    background: linear-gradient(90deg, #06b6d4, #0891b2) !important;
}

/* Modern High-Fidelity Uploader Drag & Drop Zone */
.drag-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 3.5rem 1.5rem;
    text-align: center;
    background: rgba(248, 250, 252, 0.85);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.drag-drop-zone:hover, .drag-drop-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(79, 70, 229, 0.04);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.02);
}

/* Floating Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

.float-animation {
    animation: float 6s ease-in-out infinite;
}

/* Mac-Style Windows Terminal for Code Snippets */
.mac-terminal-window {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15);
}

.mac-terminal-header {
    background: #1e293b;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mac-terminal-dots {
    display: flex;
    gap: 7px;
}

.mac-terminal-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.mac-terminal-dot.dot-red {
    background-color: #ef4444;
}

.mac-terminal-dot.dot-yellow {
    background-color: #f59e0b;
}

.mac-terminal-dot.dot-green {
    background-color: #10b981;
}

.mac-terminal-lang {
    font-family: monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
}

.mac-terminal-window pre {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 1.25rem !important;
    box-shadow: none !important;
}

.mac-terminal-window code,
.mac-terminal-window pre,
.mac-terminal-window pre * {
    font-family: 'Consolas', 'Courier New', monospace !important;
    font-size: 0.85rem !important;
    line-height: 1.5;
    color: #38bdf8 !important; /* Premium high-contrast developer blue */
}

/* Glass Credit Card Styled Active Merchant Card */
.glass-credit-card {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(255, 255, 255, 0.95) 100%) !important;
    border: 1px solid rgba(79, 70, 229, 0.15) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px -5px rgba(79, 70, 229, 0.08), inset 0 1px 0 0 rgba(255, 255, 255, 0.9) !important;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-credit-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.15), inset 0 1px 0 0 rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(79, 70, 229, 0.3) !important;
}

/* Metallic Credit Card Watermark elements */
.card-chip {
    width: 42px;
    height: 32px;
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 6px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
}

.card-chip::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 8px;
    right: 8px;
    bottom: 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Custom premium Pipeline Progress Step badges */
.pipeline-step-badge {
    background-color: rgba(79, 70, 229, 0.06);
    color: var(--accent-primary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    border: 1.5px solid rgba(79, 70, 229, 0.15);
    margin-right: 8px;
}

/* Aesthetic Invoice Receipt Frame for output previews */
.receipt-frame {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.04);
}

.receipt-frame::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    right: 0;
    height: 12px;
    background-image: radial-gradient(circle, transparent, transparent 50%, #ffffff 50%, #ffffff);
    background-size: 12px 12px;
}

.receipt-divider {
    border-top: 2px dashed #cbd5e1;
    height: 1px;
    margin: 1.25rem 0;
}

/* Floating status glows */
.status-glow-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px #10b981, 0 0 4px #10b981;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px #10b981, 0 0 6px #10b981; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

/* Dynamic iOS-style switches */
.form-check-input:checked {
    background-color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px var(--accent-glow) !important;
}

/* Toast message overlays */
#liveToast {
    background: rgba(255, 255, 255, 0.98) !important;
    color: #0f172a !important;
    border: 1px solid rgba(79, 70, 229, 0.15) !important;
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.08) !important;
    border-radius: 14px;
    backdrop-filter: blur(8px);
}

/* Modal window styling upgrades */
.bg-glass-modal {
    background: #ffffff !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(79, 70, 229, 0.1) !important;
    border-radius: 18px !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.15) !important;
}

.modal-header {
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 1.25rem 1.5rem !important;
}

.modal-footer {
    border-top: 1px solid #f1f5f9 !important;
    padding: 1.25rem 1.5rem !important;
}

.btn-close-white {
    filter: brightness(0.2) !important;
}

/* Quota Progress Bar subtle override styling */
.progress.bg-white.bg-opacity-10 {
    background-color: #e2e8f0 !important;
    border: 1px solid rgba(148, 163, 184, 0.08);
}

/* Active Fallback preview frame overrides */
#v-pills-converter img[src*="data:image"] {
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 6px 12px -2px rgba(0,0,0,0.06) !important;
    border-radius: 12px;
}

/* Dynamic endpoint API headers */
#v-pills-docs .glass-panel div[style*="background: rgba(15, 23, 42, 0.4)"] {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
}

/* Prevent dark slate text override in doc code snippets */
#v-pills-docs .mac-terminal-window pre,
#v-pills-docs .mac-terminal-window pre code,
#v-pills-docs .mac-terminal-window pre * {
    color: #38bdf8 !important;
    background-color: transparent !important;
}

/* =============================================
   COMPREHENSIVE RESPONSIVE SYSTEM
   Breakpoints: 1200px | 992px | 768px | 576px | 400px
   ============================================= */

/* --- Large Tablets & Small Laptops (max 1199px) --- */
@media (max-width: 1199.98px) {
    .container-fluid.px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    .glass-panel.p-4 {
        padding: 1.25rem !important;
    }
    .nav-pills .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* --- Tablets (max 991px) --- */
@media (max-width: 991.98px) {
    /* Dashboard sidebar stacks on top */
    .container-fluid.px-4.py-3 .row.g-4 > [class*="col-xl-3"],
    .container-fluid.px-4.py-3 .row.g-4 > [class*="col-xl-9"] {
        width: 100%;
    }

    /* Nav pills go horizontal on tablet */
    #v-pills-tab {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }
    .nav-pills .nav-link {
        border-left: none !important;
        border-radius: 8px !important;
        padding: 0.6rem 0.9rem !important;
        font-size: 0.82rem !important;
        border: 1px solid transparent !important;
        margin-bottom: 0 !important;
    }
    .nav-pills .nav-link.active {
        border-color: rgba(79, 70, 229, 0.15) !important;
    }
    .nav-pills .nav-link:hover:not(.active) {
        transform: none !important;
    }
    .nav-pills .nav-link .badge {
        display: none !important; /* hide counts on small nav to save space */
    }

    /* Metric cards adjust padding */
    .metric-card {
        padding: 1.1rem !important;
    }

    /* Charts min-height when stacked */
    .chart-glow-container [style*="height: 290px"] {
        height: 220px !important;
    }

    /* Table horizontal scroll */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Quota gauge center on tablet */
    .quota-gauge-svg-container {
        width: 140px !important;
        height: 140px !important;
    }

    /* Navbar header adjustments */
    nav.navbar .container-fluid {
        flex-wrap: wrap;
    }
}

/* --- Large Phones / Small Tablets (max 767px) --- */
@media (max-width: 767.98px) {
    /* Navbar: hide email, shrink avatar */
    .navbar .d-none.d-md-block {
        display: none !important;
    }
    nav.navbar {
        margin: 0.5rem !important;
        padding: 0.6rem 0 !important;
        border-radius: 12px !important;
    }
    .navbar-brand {
        font-size: 1.4rem !important;
    }

    /* Main content padding */
    .container-fluid.px-4.py-3 {
        padding: 0.6rem 0.5rem !important;
    }

    /* Sidebar panel: horizontal scrollable nav */
    .glass-panel.p-4.h-100 {
        padding: 1rem !important;
    }
    .nav-tabs-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    #v-pills-tab {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        min-width: max-content !important;
    }
    .nav-pills .nav-link {
        white-space: nowrap !important;
        padding: 0.5rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    /* Metric cards: 2-column layout */
    .row.g-4 [class*="col-md-4"],
    .row.g-4 [class*="col-md-3"] {
        width: 50% !important;
    }

    /* Quota summary in sidebar */
    .mt-4.pt-4.border-top span.text-white {
        font-size: 0.82rem !important;
    }

    /* Tab pane titles */
    h4.fw-bold {
        font-size: 1.1rem !important;
    }
    h5.fw-bold {
        font-size: 1rem !important;
    }

    /* Charts: reduce height when stacked */
    [style*="height: 290px"],
    [style*="height: 250px"] {
        height: 200px !important;
    }

    /* Receipt card: max-width full on phone */
    .receipt-frame {
        max-width: 100% !important;
    }

    /* drag-drop-zone reduce padding */
    .drag-drop-zone {
        padding: 2rem 1rem !important;
    }

    /* Table cells: smaller text */
    .table th,
    .table td {
        padding: 0.75rem 0.65rem !important;
        font-size: 0.82rem !important;
    }

    /* Buttons in client management header */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
    }
    .d-flex.justify-content-between.align-items-center.mb-4 button {
        width: 100%;
    }

    /* Quota gauge smaller */
    .quota-gauge-svg-container {
        width: 130px !important;
        height: 130px !important;
    }

    /* Mac Terminal code block */
    .mac-terminal-window pre,
    .mac-terminal-window code {
        font-size: 0.78rem !important;
    }

    /* Collapse input-group for converter */
    .input-group .input-group-text {
        padding: 0.6rem 0.85rem !important;
        font-size: 1rem !important;
    }
    #amount {
        font-size: 1.1rem !important;
    }

    /* DataTables controls */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left !important;
        margin-bottom: 0.5rem;
    }
    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Modal improvements */
    .modal-dialog {
        margin: 0.5rem !important;
    }
    .bg-glass-modal {
        border-radius: 14px !important;
    }
}

/* --- Phones Portrait (max 575px) --- */
@media (max-width: 575.98px) {
    /* Body */
    body {
        font-size: 0.92rem;
    }

    /* Navbar minimal */
    nav.navbar {
        margin: 0.35rem !important;
        padding: 0.5rem 0 !important;
        border-radius: 10px !important;
    }
    .navbar-brand {
        font-size: 1.25rem !important;
    }
    .navbar-brand .d-inline-flex {
        width: 32px !important;
        height: 32px !important;
    }
    .badge.bg-live {
        display: none !important; /* hide Live Portal badge on tiny screens */
    }
    .btn-secondary.py-2.px-3 {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    .btn-secondary.py-2.px-3 i.me-2 {
        margin-right: 0 !important;
    }
    .btn-secondary.py-2.px-3 span:not([class]) {
        display: none !important;
    }

    /* Sidebar panel */
    #v-pills-tab .nav-link i {
        margin-right: 0 !important;
    }

    /* Metric cards: single column below 575px */
    .row.g-4 [class*="col-md-4"],
    .row.g-4 [class*="col-md-3"] {
        width: 100% !important;
    }
    .metric-card h2 {
        font-size: 1.65rem !important;
    }
    .metric-card > .d-flex > span:first-child {
        font-size: 0.65rem !important;
    }

    /* Charts on phone */
    [style*="height: 290px"],
    [style*="height: 250px"],
    [style*="height: 220px"] {
        height: 180px !important;
    }
    .chart-header {
        padding: 10px 14px !important;
        flex-wrap: wrap;
        gap: 6px;
    }
    .chart-header h6 {
        font-size: 0.8rem !important;
    }

    /* Table mobile */
    .table th {
        font-size: 0.62rem !important;
        padding: 0.6rem 0.5rem !important;
        letter-spacing: 0.5px !important;
    }
    .table td {
        font-size: 0.78rem !important;
        padding: 0.65rem 0.5rem !important;
    }
    /* Endpoint code in logs table: wrap */
    .table td code {
        font-size: 0.72rem !important;
        word-break: break-all !important;
    }

    /* Admin management table: reduce action columns */
    .btn-group .btn {
        font-size: 0.72rem !important;
        padding: 4px 8px !important;
    }

    /* Quota gauge: center */
    .quota-gauge-svg-container {
        width: 120px !important;
        height: 120px !important;
    }
    .gauge-percent {
        font-size: 1.4rem !important;
    }
    .gauge-label {
        font-size: 0.62rem !important;
    }

    /* Glass panel padding */
    .glass-panel.p-4,
    .glass-panel.p-md-5 {
        padding: 1rem !important;
    }

    /* API Key box */
    .api-key-box {
        font-size: 0.75rem !important;
        padding: 8px 10px !important;
    }
    #apiKeyText {
        max-width: 160px !important;
    }

    /* Converter area inputs */
    #amount {
        font-size: 1rem !important;
        padding: 0.65rem 0.75rem !important;
    }
    #btnConvert, #btnReset {
        padding: 0.75rem 1rem !important;
        font-size: 0.88rem !important;
    }

    /* Receipt frame on phone */
    .receipt-frame {
        padding: 1rem !important;
    }
    .receipt-frame img {
        max-height: 170px !important;
    }

    /* Credentials tab */
    .col-12.col-lg-5 .glass-panel {
        margin-bottom: 1rem !important;
    }

    /* Documentation */
    .pipeline-step-badge {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.7rem !important;
    }
    .mac-terminal-window pre {
        padding: 1rem !important;
    }

    /* Pagination */
    .page-link {
        padding: 5px 10px !important;
        font-size: 0.78rem !important;
    }

    /* DataTables */
    .dataTables_wrapper {
        overflow-x: auto !important;
    }
    .dataTables_wrapper .dataTables_info {
        font-size: 0.75rem !important;
    }
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 0.5rem !important;
    }
}

/* --- Very Small Phones (max 400px) --- */
@media (max-width: 400px) {
    nav.navbar {
        margin: 0.25rem !important;
    }
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    .glass-panel.p-4 {
        padding: 0.75rem !important;
    }
    .metric-card h2 {
        font-size: 1.45rem !important;
    }
    h4.fw-bold {
        font-size: 1rem !important;
    }
    h5.fw-bold {
        font-size: 0.92rem !important;
    }
    .table th {
        font-size: 0.58rem !important;
    }
    .table td {
        font-size: 0.72rem !important;
    }
    .btn {
        font-size: 0.82rem !important;
    }
    #v-pills-tab .nav-link {
        padding: 0.45rem 0.65rem !important;
        font-size: 0.75rem !important;
    }
    [style*="height: 290px"],
    [style*="height: 250px"],
    [style*="height: 220px"],
    [style*="height: 180px"] {
        height: 160px !important;
    }
}

/* --- Landscape Mobile (short height, wide width) --- */
@media (max-height: 500px) and (orientation: landscape) {
    .glass-panel.p-4.h-100 {
        padding: 0.75rem !important;
    }
    nav.navbar {
        margin: 0.25rem !important;
        padding: 0.4rem 0 !important;
    }
    .container-fluid.px-4.py-3 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* ==========================================================================
   Anti-Copy & Code Protection System
   ========================================================================== */
body, html {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Exempt input fields, textareas, and interactive code selectors so users can still type */
input, textarea, select, [contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}
