:root {
    /* Base Color Tokens - Modern Dark & Electric Cyan / Emerald Theme */
    --background: #0b0f19;
    --foreground: #f1f5f9;
    --card: #111827;
    --card-foreground: #f8fafc;
    --card-border: #1f2937;

    --primary: #06b6d4;
    --primary-hover: #0891b2;
    --primary-light: rgba(6, 182, 212, 0.15);
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
    --primary-foreground: #ffffff;

    --accent-cyan: #06b6d4;
    --accent-cyan-bg: rgba(6, 182, 212, 0.12);
    --accent-emerald: #10b981;

    --secondary: #1e293b;
    --secondary-foreground: #cbd5e1;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #1f2937;
    --input: #1e293b;
    --ring: rgba(6, 182, 212, 0.3);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-sm: 0.5rem;

    /* Sidebar Tokens */
    --sidebar-width: 270px;
    --sidebar-bg: #060a12;
    --sidebar-border: #131c2e;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.05);
    --sidebar-item-active: linear-gradient(90deg, rgba(6, 182, 212, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);

    --navbar-height: 68px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] {
    --background: #0b0f19;
    --foreground: #f1f5f9;
    --card: #111827;
    --card-foreground: #f8fafc;
    --card-border: #1f2937;

    --primary: #06b6d4;
    --primary-hover: #0891b2;
    --primary-light: rgba(6, 182, 212, 0.15);
    --primary-gradient: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);

    --secondary: #1e293b;
    --secondary-foreground: #cbd5e1;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #1f2937;
    --input: #1e293b;
    --ring: rgba(6, 182, 212, 0.3);

    --sidebar-bg: #060a12;
    --sidebar-border: #131c2e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

.text-muted, .text-secondary {
    color: var(--muted-foreground) !important;
}

.text-foreground {
    color: var(--foreground) !important;
}

code {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Layout Structure --- */
.app-wrapper { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    position: fixed;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    font-size: 1.15rem;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.brand-title span {
    color: var(--accent-cyan);
}

.sidebar-content {
    flex: 1;
    padding: 1.25rem 1rem;
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.menu-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    margin: 1.25rem 0.75rem 0.5rem;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-category::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
    margin-bottom: 0.25rem;
    position: relative;
}

.nav-link-custom:hover {
    background: var(--sidebar-item-hover);
    color: #ffffff;
    transform: translateX(2px);
}

.nav-link-custom.active {
    background: var(--sidebar-item-active);
    color: #ffffff;
    font-weight: 600;
    border: 1px solid rgba(79, 70, 229, 0.3);
}

.nav-link-custom.active::before {
    content: '';
    position: absolute;
    left: -0.9rem;
    top: 20%;
    bottom: 20%;
    width: 4px;
    background: var(--accent-cyan);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.nav-link-custom i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    color: #64748b;
    transition: var(--transition);
}

.nav-link-custom:hover i, .nav-link-custom.active i {
    color: var(--accent-cyan);
}

/* Sidebar Profile Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.2);
}

.user-profile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.73rem;
    color: #64748b;
}

/* --- Main Content & Top Navbar --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.top-navbar {
    height: var(--navbar-height);
    background: var(--card);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* --- Dedicated Tab System Design --- */
.custom-tabs-container {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 6px;
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    gap: 6px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.custom-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.custom-tab-btn:hover {
    color: var(--foreground);
    background: var(--secondary);
}

.custom-tab-btn.active {
    background: var(--primary);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.custom-tab-btn.active i {
    color: #ffffff !important;
}

.custom-tab-badge {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
}

.custom-tab-btn:not(.active) .custom-tab-badge {
    background: var(--secondary);
    color: var(--muted-foreground);
}

/* --- Page Header --- */
.page-header {
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--foreground);
    margin: 0;
}

.page-header p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
    margin-top: 0.2rem;
    margin-bottom: 0;
}

/* --- Custom Cards --- */
.card-custom {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(79, 70, 229, 0.3);
}

/* --- Stats Grid Layout & Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stats-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1400px) {
    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .stats-grid-5 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid-5 {
        grid-template-columns: 1fr;
    }
}

.card-custom .card-custom-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-custom .card-custom-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.card-custom .card-custom-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.card-custom .card-custom-desc {
    font-size: 0.8rem;
    color: var(--muted-foreground);
}

/* Pulsing Live Dot */
.live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: livePulse 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes livePulse {
    to {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* Sync Breakdown Item */
.sync-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.48rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    transition: all 0.15s ease;
}

.sync-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.form-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.form-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Custom Buttons --- */
.btn-custom {
    padding: 0.6rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary-custom {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary-custom:hover {
    opacity: 0.95;
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-test-custom {
    background: rgba(6, 182, 212, 0.1);
    color: #0891b2 !important;
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-test-custom:hover {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
    transform: translateY(-1px);
}

[data-theme='dark'] .btn-test-custom {
    background: rgba(6, 182, 212, 0.15);
    color: #38bdf8 !important;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

[data-theme='dark'] .btn-test-custom:hover {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #ffffff !important;
}

.btn-outline-custom {
    border: 1px solid var(--border);
    color: var(--foreground);
    background: var(--card);
}

.btn-outline-custom:hover {
    background: var(--secondary);
    color: var(--foreground);
    border-color: var(--primary);
}

/* --- Warm Orange / Amber Custom Button (Soft Orange for Profile, etc.) --- */
.btn-warning-custom,
.btn-orange-custom {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-warning-custom:hover,
.btn-orange-custom:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

[data-theme='dark'] .btn-warning-custom,
[data-theme='dark'] .btn-orange-custom {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

/* --- Danger Custom Button --- */
.btn-danger-custom {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.25);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-danger-custom:hover:not(:disabled):not(.disabled) {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}

.btn-danger-custom:disabled,
.btn-danger-custom.disabled {
    opacity: 0.35;
    cursor: not-allowed !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    transform: none !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--muted-foreground) !important;
}

[data-theme='dark'] .btn-danger-custom {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Action Pill Buttons (Uniform Compact Action Buttons) --- */
.btn-action-pill {
    border-radius: 9999px !important;
    height: 32px !important;
    min-width: 36px !important;
    padding: 0 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
}

.btn-action-pill i {
    font-size: 0.82rem;
}


/* --- Form Controls --- */
.form-control-custom {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--foreground);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-select-custom {
    width: 100%;
    padding: 0.65rem 2.25rem 0.65rem 1rem;
    background-color: var(--background);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 13px 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--foreground);
    font-size: 0.9rem;
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

[data-theme='light'] .form-select-custom {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-select-custom.form-select-sm {
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    background-position: right 12px center;
    background-size: 11px 7px;
    font-size: 0.85rem;
}

.form-control-custom:focus, .form-select-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--ring);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.4rem;
}

/* --- Tables --- */
.table-container-custom {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    overflow: visible;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.table-custom thead tr:first-child th:first-child {
    border-top-left-radius: 14px;
}
.table-custom thead tr:first-child th:last-child {
    border-top-right-radius: 14px;
}
.card-custom .table-custom thead tr:first-child th:first-child,
.card-custom .table-custom thead tr:first-child th:last-child,
.table-responsive:not(:first-child) .table-custom thead tr:first-child th:first-child,
.table-responsive:not(:first-child) .table-custom thead tr:first-child th:last-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: center;
    background-color: transparent !important;
    --bs-table-bg: transparent !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-striped-bg: transparent !important;
    --bs-table-hover-bg: rgba(99, 102, 241, 0.05) !important;
    --bs-table-color: var(--foreground) !important;
}

.table-custom th {
    background: var(--secondary) !important;
    padding: 0.9rem 1.25rem;
    font-weight: 700;
    color: var(--muted-foreground);
    text-transform: uppercase;
    font-size: 0.73rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}

.table-custom td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--foreground);
    vertical-align: middle;
    text-align: center;
    background-color: transparent !important;
}

.table-custom td .d-flex {
    justify-content: center;
}

.table-custom td .table-actions-group {
    justify-content: center;
}

.table-custom tr:last-child td { border-bottom: none; }
.table-custom tr:hover { background: rgba(79, 70, 229, 0.03); }
[data-theme='dark'] .table-custom tr:hover,
[data-theme='dark'] .table-custom tr:hover td { background-color: rgba(99, 102, 241, 0.05) !important; }

[data-theme='dark'] .table,
[data-theme='dark'] .table > :not(caption) > * > * {
    background-color: transparent;
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

/* --- Badges --- */
.badge-custom {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-success-custom { background: rgba(16, 185, 129, 0.12); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-danger-custom { background: rgba(239, 68, 68, 0.12); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-warning-custom { background: rgba(245, 158, 11, 0.12); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-info-custom { background: rgba(79, 70, 229, 0.12); color: var(--primary); border: 1px solid rgba(79, 70, 229, 0.25); }
.badge-secondary-custom { background: var(--secondary); color: var(--muted-foreground); border: 1px solid var(--border); }

/* --- Modern Soft Badges with Guaranteed Contrast --- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    border-radius: 6px;
    letter-spacing: 0.01em;
    white-space: nowrap;
    vertical-align: middle;
    transition: all 0.15s ease;
}

.badge-soft-success {
    background-color: rgba(16, 185, 129, 0.16) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.32) !important;
}

.badge-soft-danger {
    background-color: rgba(239, 68, 68, 0.16) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.32) !important;
}

.badge-soft-warning {
    background-color: rgba(245, 158, 11, 0.16) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.32) !important;
}

.badge-soft-cyan,
.badge-soft-primary {
    background-color: rgba(6, 182, 212, 0.16) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(6, 182, 212, 0.32) !important;
}

.badge-soft-indigo {
    background-color: rgba(99, 102, 241, 0.16) !important;
    color: #a5b4fc !important;
    border: 1px solid rgba(99, 102, 241, 0.32) !important;
}

.badge-soft-purple {
    background-color: rgba(168, 85, 247, 0.16) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.32) !important;
}

.badge-soft-pink {
    background-color: rgba(236, 72, 153, 0.16) !important;
    color: #f472b6 !important;
    border: 1px solid rgba(236, 72, 153, 0.32) !important;
}

.badge-soft-secondary {
    background-color: rgba(148, 163, 184, 0.12) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
}

.call-dest-number {
    color: #38bdf8 !important;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.02em;
}

/* --- PBX Distribution Legend Spacing & Badges --- */
.pbx-legend-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding-top: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--card-border);
}

.pbx-legend-badge {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pbx-legend-badge:hover {
    transform: translateY(-1px);
}

/* --- Navbar Searchable Company Selector (Unified Combobox) --- */
.company-select-dropdown {
    position: relative;
    width: 250px;
}

.company-select-trigger {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease-in-out;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.company-select-trigger:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.company-trigger-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-right: 8px;
    flex-shrink: 0;
}

.company-trigger-name {
    font-size: 0.84rem;
    font-weight: 600;
}

.company-select-dropdown.show .company-select-trigger,
.company-select-trigger.show,
.company-select-trigger[aria-expanded="true"] {
    background: var(--card) !important;
    border-color: var(--primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    box-shadow: none !important;
}

.company-select-trigger .chevron-icon {
    font-size: 0.72rem;
    transition: transform 0.2s ease;
}

.company-select-dropdown.show .chevron-icon,
.company-select-trigger[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.company-dropdown-menu {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    margin-top: -1px !important;
    background: var(--card) !important;
    border: 1px solid var(--primary) !important;
    border-top: none !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5) !important;
    z-index: 1080 !important;
    padding: 0;
}

.company-list-container::-webkit-scrollbar {
    width: 4px;
}
.company-list-container::-webkit-scrollbar-track {
    background: transparent;
}
.company-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.company-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.company-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    cursor: pointer;
    border-radius: 6px;
    margin: 2px 4px;
    color: var(--foreground);
    font-size: 0.83rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.company-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.company-list-item.selected {
    background: rgba(6, 182, 212, 0.12);
    color: var(--primary);
    font-weight: 600;
}

.company-item-name {
    font-size: 0.83rem;
    line-height: 1.3;
}

/* Status indicator dot for company active / passive status */
.status-indicator-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.status-indicator-dot.status-online {
    background-color: #10b981;
    box-shadow: 0 0 7px rgba(16, 185, 129, 0.75);
}

.status-indicator-dot.status-offline {
    background-color: #ef4444;
    box-shadow: 0 0 7px rgba(239, 68, 68, 0.75);
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* --- Toast Notifications --- */
.toast-container-custom {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.norpa-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.1rem;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    color: #f8fafc;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.norpa-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #06b6d4;
}

.norpa-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.norpa-toast.toast-success::before { background: #10b981; }
.norpa-toast.toast-danger::before, .norpa-toast.toast-error::before { background: #ef4444; }
.norpa-toast.toast-warning::before { background: #f59e0b; }
.norpa-toast.toast-info::before { background: #06b6d4; }

.toast-icon {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast-icon { color: #10b981; }
.toast-danger .toast-icon, .toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #06b6d4; }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
    color: #ffffff;
}

.toast-message {
    font-size: 0.84rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.toast-close {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.toast-close:hover {
    color: #ffffff;
}

/* --- Pagination Custom Component --- */
.pagination-container-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    gap: 1rem;
    flex-wrap: wrap;
}

.pagination-custom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-custom .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--foreground);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.pagination-custom .page-btn:hover:not(.disabled):not(.active) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination-custom .page-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.pagination-custom .page-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Table Action Group No-Wrap & Uniform Buttons --- */
.table-actions-group {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
}

.table-actions-group > form {
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
}

.table-actions-group > .dropdown {
    display: inline-flex !important;
    align-items: center !important;
    position: relative;
}

.table-actions-group .dropdown-menu {
    z-index: 1060 !important;
}

.table-actions-group .btn-custom {
    padding: 0.6rem 1.25rem !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
    height: 42px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.table-actions-group .btn-custom.btn-icon-only {
    width: 42px !important;
    min-width: 42px !important;
    padding: 0 !important;
}

/* --- Segmented Custom Tabs (Dark & Modern, No Harsh White) --- */
.custom-segmented-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 5px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.custom-segmented-tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 1.15rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    transition: var(--transition);
}

.custom-segmented-tabs .tab-btn:hover {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.custom-segmented-tabs .tab-btn.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.85) 0%, rgba(6, 182, 212, 0.85) 100%);
    color: #ffffff !important;
    border: 1px solid rgba(6, 182, 212, 0.5);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.custom-segmented-tabs .tab-btn .tab-count {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted-foreground);
    transition: var(--transition);
}

.custom-segmented-tabs .tab-btn.active .tab-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* --- Sidebar Company Selector Card --- */
.sidebar-company-card {
    padding: 0.65rem 0.85rem;
    margin: 0.75rem 1rem 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-company-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Custom Modal Tabs & Settings Card --- */
.custom-modal-tabs {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
    margin-bottom: 1.25rem;
}

.custom-modal-tabs .nav-link {
    color: var(--muted-foreground);
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 0.95rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.custom-modal-tabs .nav-link:hover {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.05);
}

.custom-modal-tabs .nav-link.active {
    color: #ffffff !important;
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.35);
}

.settings-group-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* --- Secondary Custom Button --- */
.btn-secondary-custom {
    background: var(--secondary);
    color: var(--secondary-foreground) !important;
    border: 1px solid var(--border);
}

.btn-secondary-custom:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    border-color: var(--muted-foreground);
    transform: translateY(-1px);
}

[data-theme='light'] .btn-secondary-custom {
    background: #f1f5f9;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
}

[data-theme='light'] .btn-secondary-custom:hover {
    background: #e2e8f0;
    color: #0f172a !important;
    border-color: #94a3b8;
}

/* --- Global Modern Delete Modal Styling (Sistem Standartları) --- */
#globalDeleteModal .modal-content {
    background: var(--card) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--foreground) !important;
}

#globalDeleteModal .modal-dialog {
    max-width: 480px;
}

/* --- Extension Profile Selection Cards --- */
.profile-option-card {
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--foreground) !important;
    min-height: 62px;
}

.profile-option-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.profile-option-card.active,
.profile-option-card:has(input[type="radio"]:checked) {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.35) !important;
}

.profile-option-card .profile-title {
    color: #f8fafc !important;
    font-weight: 600;
}

.profile-option-card .profile-subtitle {
    color: #94a3b8 !important;
}

.profile-option-card input[type="radio"] {
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    width: 1.15rem;
    height: 1.15rem;
}

.profile-option-card input[type="radio"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.profile-option-card .current-badge-container {
    display: inline-flex;
    align-items: center;
}

/* --- PBX Core Disabled/Locked Sidebar Link in System Mode --- */
.pbx-disabled-link {
    opacity: 0.42 !important;
    cursor: not-allowed !important;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.pbx-disabled-link:hover {
    opacity: 0.65 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--muted-foreground) !important;
}

.pbx-disabled-link i.fa-lock {
    opacity: 0.6;
}

/* --- Dashboard Specific Modern Components --- */
.dashboard-stat-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.dashboard-stat-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.dashboard-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.company-report-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Global Custom Scrollbar (Sidebar Tasarımı ile Uyumlu) */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}