/* ============================================
   CommStack Hub v2.0
   Primary: #007bff | Dark: #19143b
   ============================================ */

:root {
    --cs-primary: #007bff;
    --cs-primary-light: #339dff;
    --cs-primary-hover: #0069d9;
    --cs-dark: #19143b;
    --cs-dark-hover: #231d52;
    --cs-topbar-height: 52px;
    --cs-subnav-height: 72px;
    --cs-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

* { font-family: var(--cs-font-family); }

body {
    background: #f0f2f5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   Top Bar - Blue Gradient
   ============================================ */

.cs-topbar {
    background: linear-gradient(135deg, var(--cs-primary) 0%, var(--cs-primary-light) 100%);
    height: var(--cs-topbar-height);
    position: sticky;
    top: 0;
    z-index: 1050;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.cs-topbar .container-fluid {
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.cs-topbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
}

.cs-topbar-brand:hover { color: #fff; }

.cs-topbar-brand i {
    font-size: 1.5rem;
}

.cs-topbar-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
}

.cs-topbar-right {
    display: flex;
    align-items: center;
}

.cs-topbar-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.cs-topbar-user-link:hover { color: #fff; }

.cs-topbar-name {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
}

.cs-topbar-company {
    font-size: 0.72rem;
    opacity: 0.8;
    line-height: 1.2;
}

.cs-topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.3);
}

/* ============================================
   Sub Navigation - White Bar
   ============================================ */

.cs-subnav {
    background: #fff;
    border-bottom: 1px solid #e0e3e8;
    position: sticky;
    top: var(--cs-topbar-height);
    z-index: 1040;
}

.cs-subnav > .container-fluid,
.cs-subtabs > .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

.cs-subnav-items {
    display: flex;
    gap: 0;
}

.cs-subnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px 20px;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
    position: relative;
}

.cs-subnav-item + .cs-subnav-item {
    border-left: 1px solid #eef0f3;
}

.cs-subnav-item:hover {
    background: #f8f9ff;
}

.cs-subnav-item.active {
    border-bottom-color: var(--cs-primary);
    background: #f8f9ff;
}

.cs-subnav-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cs-primary);
    line-height: 1.2;
}

.cs-subnav-item:not(.active) .cs-subnav-title {
    color: #374151;
}

.cs-subnav-item:hover .cs-subnav-title {
    color: var(--cs-primary);
}

.cs-subnav-desc {
    font-size: 0.73rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* ============================================
   Sub-page Tabs (contextual)
   ============================================ */

.cs-subtabs {
    background: #fff;
    border-bottom: 1px solid #e0e3e8;
}

.cs-subtabs-inner {
    display: flex;
    gap: 0;
    overflow-x: auto;
}

.cs-subtab {
    padding: 10px 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.cs-subtab:hover {
    color: var(--cs-primary);
    background: #f8f9ff;
}

.cs-subtab.active {
    color: var(--cs-primary);
    border-bottom-color: var(--cs-primary);
    font-weight: 600;
}

/* ============================================
   Page Layout - Smart sizing
   ============================================ */

.cs-page {
    min-height: calc(100vh - var(--cs-topbar-height) - var(--cs-subnav-height));
    display: flex;
    flex-direction: column;
}

.cs-page > .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
}

.cs-footer {
    margin-top: auto;
    padding: 16px 0;
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    border-top: 1px solid #e0e3e8;
    background: #fff;
}

/* ============================================
   Cards
   ============================================ */

.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 14px 20px;
    border-radius: 8px 8px 0 0 !important;
}

.card-body { padding: 20px; }

.card-footer {
    background: #fafbfc;
    border-top: 1px solid #f0f0f0;
    padding: 12px 20px;
}

/* Stat Cards */
.stat-card {
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--cs-dark);
    line-height: 1;
    margin-top: 10px;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 3px;
}

/* ============================================
   Tables - Clean, Minimal
   ============================================ */

.table {
    font-size: 0.84rem;
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8b95a5;
    border-bottom: 1px solid #eef0f3;
    padding: 10px 16px;
    background: #fafbfc;
}

.table tbody td {
    padding: 11px 16px;
    vertical-align: middle;
    color: #374151;
    border-bottom: 1px solid #f5f5f7;
}

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

.table tbody tr:hover {
    background: #f8f9ff;
}

/* DataTables overrides - much cleaner */
.dataTables_wrapper {
    padding: 0;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    padding: 12px 16px 0;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 6px;
    border: 1px solid #dfe3e8;
    padding: 6px 12px;
    font-size: 0.84rem;
    background: #f8f9fa;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08);
    background: #fff;
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1px solid #dfe3e8;
    padding: 4px 8px;
    font-size: 0.84rem;
    appearance: auto;
}

/* Fix dropdown caret on stat values */
.stat-card .stat-value,
.stat-card .stat-label {
    position: relative;
    z-index: 1;
}

.dataTables_wrapper .dataTables_info {
    padding: 10px 16px;
    font-size: 0.78rem;
    color: #8b95a5;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 8px 16px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    border-radius: 5px !important;
    font-size: 0.78rem !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 28px !important;
    line-height: 28px !important;
    border: 1px solid transparent !important;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f0f4ff !important;
    border-color: #e5e7eb !important;
    color: var(--cs-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--cs-primary) !important;
    border-color: var(--cs-primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--cs-primary-hover) !important;
    color: #fff !important;
}

/* ============================================
   Service Type Picker
   ============================================ */

.svc-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.svc-type-card {
    border: 2px solid #eef0f3;
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.svc-type-card:hover {
    border-color: var(--cs-primary);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
}

.svc-type-card.selected {
    border-color: var(--cs-primary);
    background: rgba(0, 123, 255, 0.03);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.12);
}

.svc-type-card.cs-country-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.svc-type-card.cs-country-disabled:hover {
    border-color: #eef0f3;
    box-shadow: none;
    transform: none;
}

.svc-type-card .svc-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 10px;
}

.svc-type-card .svc-type-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--cs-dark);
    margin-bottom: 4px;
}

.svc-type-card .svc-type-desc {
    font-size: 0.73rem;
    color: #6b7280;
    line-height: 1.3;
}

/* Port-type cards: distinct per-type accent + "what you'll need" chips. */
.port-type-card { --port-accent: var(--cs-primary); }
.port-type-card:hover {
    border-color: var(--port-accent);
    background: color-mix(in srgb, var(--port-accent) 5%, #fff);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--port-accent) 18%, transparent);
}
.port-type-card.selected {
    border-color: var(--port-accent);
    background: color-mix(in srgb, var(--port-accent) 8%, #fff);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--port-accent) 22%, transparent);
}
.port-chip-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #eef0f3;
}
.port-chip {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    white-space: nowrap;
}

[data-bs-theme="dark"] .port-chip-row {
    border-top-color: #2a2d38;
}
[data-bs-theme="dark"] .port-chip {
    background: #2a2d38;
    color: #c9cdd4;
}
[data-bs-theme="dark"] .port-type-card:hover {
    background: color-mix(in srgb, var(--port-accent) 10%, #181b24);
}
[data-bs-theme="dark"] .port-type-card.selected {
    background: color-mix(in srgb, var(--port-accent) 14%, #181b24);
}

/* Step 3 — Recap card on the left of the details form. Flex column +
   space-around so the icon/name/desc/chips sit vertically centered when
   the form panel on the right is taller. */
.port-recap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #eef0f3;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    height: 100%;
}
.port-recap-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 12px;
    background: rgba(0,123,255,0.08);
    color: var(--cs-primary);
}
.port-recap-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
.port-recap-desc { font-size: 0.78rem; line-height: 1.4; margin-bottom: 12px; }
.port-recap-chips {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
    padding-top: 12px;
    border-top: 1px dashed #eef0f3;
    min-height: 30px;
}
[data-bs-theme="dark"] .port-recap { border-color: #2a2d38; }
[data-bs-theme="dark"] .port-recap-chips { border-top-color: #2a2d38; }

.svc-coming-soon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 55%, #ec4899 100%);
    background-size: 200% 200%;
    animation: svc-coming-soon-shimmer 4s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.svc-coming-soon i {
    font-size: 0.85rem;
    animation: svc-coming-soon-sparkle 2.4s ease-in-out infinite;
}

@keyframes svc-coming-soon-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

@keyframes svc-coming-soon-sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50%      { transform: scale(1.15) rotate(15deg); opacity: 0.85; }
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 500;
    padding: 7px 16px;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: 1.4;
}

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* Icons inside buttons - align properly */
.btn i.bi {
    line-height: 1;
    vertical-align: -1px;
}

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

.btn-dark { background: var(--cs-dark); border-color: var(--cs-dark); }
.btn-dark:hover { background: var(--cs-dark-hover); border-color: var(--cs-dark-hover); }

/* ============================================
   Badges
   ============================================ */

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

/* ============================================
   Forms
   ============================================ */

.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #dfe3e8;
    font-size: 0.84rem;
    padding: 8px 12px;
}

/* Custom form-select arrow (replaces Bootstrap's SVG + any native browser arrow)
   Gives us full control, no duplicates regardless of browser. */
.form-select {
    --bs-form-select-bg-img: none !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px 10px;
    padding-right: 28px;
}

[data-bs-theme="dark"] .form-select {
    background-image: none !important;
}

/* Select2 provides its own arrow - suppress ours on wrapped selects */
.select2-hidden-accessible {
    background-image: none !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08);
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

/* ============================================
   Modals
   ============================================ */

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header { border-bottom: 1px solid #f0f0f0; padding: 16px 20px; }
.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid #f0f0f0; padding: 12px 20px; }

/* ============================================
   Dropdowns
   ============================================ */

.cs-dropdown {
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    padding: 6px;
    min-width: 200px;
}

.cs-dropdown .dropdown-item {
    border-radius: 5px;
    padding: 7px 12px;
    font-size: 0.84rem;
    color: #374151;
}

.cs-dropdown .dropdown-item:hover {
    background: #f0f4ff;
    color: var(--cs-primary);
}

.cs-dropdown .dropdown-item i { color: #9ca3af; width: 18px; }
.cs-dropdown .dropdown-item:hover i { color: var(--cs-primary); }
.cs-dropdown .dropdown-divider { margin: 4px 0; border-color: #f0f0f0; }
.cs-dropdown .dropdown-header { padding: 8px 12px; }

/* ============================================
   Login Page
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cs-primary) 0%, var(--cs-primary-light) 60%, #64b5f6 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 36px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cs-dark);
}

.login-logo i { font-size: 1.8rem; color: var(--cs-primary); }

/* ============================================
   Service Icons
   ============================================ */

.service-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.service-icon-sip { background: rgba(0,123,255,0.08); color: var(--cs-primary); }
.service-icon-cts { background: rgba(25,20,59,0.08); color: var(--cs-dark); }
.service-icon-sms { background: rgba(16,185,129,0.08); color: #10b981; }
.service-icon-cps { background: rgba(139,92,246,0.08); color: #8b5cf6; }
.service-icon-teams { background: rgba(70,71,117,0.08); color: #464775; }
.service-icon-fax2email { background: rgba(249,115,22,0.08); color: #f97316; }

/* ============================================
   Port Status
   ============================================ */

.port-status {
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.73rem;
    font-weight: 500;
    display: inline-block;
}

/* ============================================
   Empty States
   ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}

.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; }
.empty-state h5 { color: #6b7280; font-weight: 600; font-size: 1rem; }
.empty-state p { font-size: 0.84rem; }

/* ============================================
   Utilities
   ============================================ */

.text-cs-primary { color: var(--cs-primary) !important; }
.text-cs-dark { color: var(--cs-dark) !important; }
.bg-cs-primary { background: var(--cs-primary) !important; }
.bg-cs-dark { background: var(--cs-dark) !important; }
.min-w-0 { min-width: 0; }

.action-link {
    color: var(--cs-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
}
.action-link:hover { text-decoration: underline; }

.fade-in { animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Reused avatar style */
.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 991.98px) {
    /* Hide notification bell and user dropdown on mobile - they're in the hamburger menu */
    .cs-topbar-right .dropdown {
        display: none !important;
    }

    /* Collapse the right slot so the hamburger toggle sits at the far right */
    .cs-topbar-right {
        display: none !important;
    }

    .cs-topbar-toggle {
        margin-left: auto;
    }

    .cs-subnav-items {
        flex-direction: column;
        padding: 8px 0;
    }

    .cs-subnav-item {
        border-left: none !important;
        border-bottom: none;
        border-radius: 6px;
        padding: 10px 16px;
        border-left: 3px solid transparent !important;
    }

    .cs-subnav-item.active {
        border-bottom-color: transparent;
        border-left-color: var(--cs-primary) !important;
        background: #f0f4ff;
    }

    .cs-subtabs-inner {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Horizontal scroll filter pills (e.g. Services filter row) */
    .cs-filter-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .cs-filter-pills::-webkit-scrollbar {
        display: none;
    }

    .cs-filter-pills > .btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* ============================================
   Logo Switching
   ============================================ */

.cs-logo { height: 30px; }
.cs-logo-dark { display: none; }
[data-bs-theme="dark"] .cs-logo-light { display: none; }
[data-bs-theme="dark"] .cs-logo-dark { display: inline; }

/* ============================================
   Top Bar Buttons (theme toggle, notif bell)
   ============================================ */

.cs-topbar-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.cs-topbar-btn:hover {
    background: rgba(255,255,255,0.25);
}

.cs-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Theme toggle icons - JS controls visibility */
.theme-icon { display: none; }

/* Theme option buttons (profile page) */
.theme-option {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.84rem;
}

/* ============================================
   Notification Bell
   ============================================ */

.cs-notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--cs-primary);
}

.cs-notif-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.cs-notif-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

.cs-notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #374151;
    transition: background 0.1s;
}

.cs-notif-item:hover { background: #f8f9ff; color: #374151; }

.cs-notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.cs-notif-text { font-size: 0.84rem; font-weight: 500; }
.cs-notif-time { font-size: 0.72rem; color: #9ca3af; }

/* ============================================
   Wizard Steps
   ============================================ */

.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 32px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: #9ca3af;
    font-weight: 500;
}

.wizard-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.wizard-step.active .wizard-step-num {
    background: var(--cs-primary);
    color: #fff;
}

.wizard-step.active {
    color: var(--cs-dark);
}

.wizard-step.completed .wizard-step-num {
    background: #10b981;
    color: #fff;
}

.wizard-step.completed {
    color: #10b981;
}

.wizard-step-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 12px;
}

.wizard-step-line.completed {
    background: #10b981;
}

.wizard-panel {
    display: none;
}

.wizard-panel.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

/* ============================================
   Dark Mode Overrides
   ============================================ */

[data-bs-theme="dark"] {
    --bs-body-bg: #0f1117;
    --bs-body-color: #c9cdd4;
}

[data-bs-theme="dark"] body {
    background: #0f1117;
}

[data-bs-theme="dark"] .cs-topbar {
    background: linear-gradient(135deg, var(--cs-dark) 0%, var(--cs-dark-hover) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .cs-topbar-avatar {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
}

[data-bs-theme="dark"] .cs-notif-badge {
    border-color: var(--cs-dark);
}

[data-bs-theme="dark"] .cs-subnav {
    background: #181b24;
    border-bottom-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-subnav-item + .cs-subnav-item {
    border-left-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-subnav-item:hover,
[data-bs-theme="dark"] .cs-subnav-item.active {
    background: rgba(0, 123, 255, 0.08);
}

[data-bs-theme="dark"] .cs-subnav-item:not(.active) .cs-subnav-title {
    color: #c9cdd4;
}

[data-bs-theme="dark"] .cs-subnav-desc {
    color: #6b7280;
}

[data-bs-theme="dark"] .cs-subtabs {
    background: #181b24;
    border-bottom-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-subtab {
    color: #8b95a5;
}

[data-bs-theme="dark"] .cs-subtab:hover,
[data-bs-theme="dark"] .cs-subtab.active {
    background: rgba(0, 123, 255, 0.08);
}

[data-bs-theme="dark"] .card {
    background: #181b24;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-bs-theme="dark"] .card-header {
    background: #181b24;
    border-bottom-color: #2a2d38;
}

[data-bs-theme="dark"] .card-footer {
    background: #14161e;
    border-top-color: #2a2d38;
}

[data-bs-theme="dark"] .stat-card {
    background: #181b24;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
}

[data-bs-theme="dark"] .stat-card .stat-value {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .table thead th {
    background: #14161e;
    color: #6b7280;
    border-bottom-color: #2a2d38;
}

[data-bs-theme="dark"] .table tbody td {
    color: #c9cdd4;
    border-bottom-color: #1e2130;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background: rgba(0, 123, 255, 0.05);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #14161e;
    border-color: #2a2d38;
    color: #c9cdd4;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #1a1d28;
    border-color: var(--cs-primary);
}

[data-bs-theme="dark"] .modal-content {
    background: #181b24;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-dropdown {
    background: #1e2130;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

[data-bs-theme="dark"] .cs-dropdown .dropdown-item {
    color: #c9cdd4;
}

[data-bs-theme="dark"] .cs-dropdown .dropdown-item:hover {
    background: rgba(0, 123, 255, 0.1);
}

[data-bs-theme="dark"] .cs-dropdown .dropdown-divider {
    border-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-notif-header {
    border-bottom-color: #2a2d38;
}

[data-bs-theme="dark"] .cs-footer {
    background: #181b24;
    border-top-color: #2a2d38;
    color: #6b7280;
}

[data-bs-theme="dark"] .svc-type-card {
    background: #181b24;
    border-color: #2a2d38;
}

[data-bs-theme="dark"] .svc-type-card:hover {
    border-color: var(--cs-primary);
}

[data-bs-theme="dark"] .svc-type-card .svc-type-name {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .empty-state {
    color: #6b7280;
}

[data-bs-theme="dark"] .empty-state h5 {
    color: #8b95a5;
}

[data-bs-theme="dark"] .wizard-step-num {
    background: #2a2d38;
    color: #6b7280;
}

[data-bs-theme="dark"] .wizard-step.active {
    color: var(--cs-primary-light);
}

[data-bs-theme="dark"] .wizard-step-line {
    background: #2a2d38;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background: #14161e;
    border-color: #2a2d38;
    color: #c9cdd4;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #6b7280;
}

[data-bs-theme="dark"] .login-card {
    background: #181b24;
}

[data-bs-theme="dark"] .login-logo {
    color: #e5e7eb;
}

/* CTS dark color (#19143b) is too dark for dark mode - lighten it */
[data-bs-theme="dark"] .service-icon-cts {
    background: rgba(167, 139, 250, 0.15) !important;
    color: #a78bfa !important;
}

/* Inline-styled CTS elements (service index filter pills, detail pages) */
[data-bs-theme="dark"] .badge[style*="rgba(25,20,59"],
[data-bs-theme="dark"] .badge[style*="#19143b"],
[data-bs-theme="dark"] [style*="color: #19143b"] {
    background: rgba(167, 139, 250, 0.15) !important;
    color: #a78bfa !important;
}

[data-bs-theme="dark"] .svc-type-card .svc-type-icon[style*="#19143b"],
[data-bs-theme="dark"] .service-icon[style*="#19143b"] {
    background: rgba(167, 139, 250, 0.15) !important;
    color: #a78bfa !important;
}

/* Dark mobile subnav */
@media (max-width: 991.98px) {
    [data-bs-theme="dark"] .cs-subnav-item.active {
        border-left-color: var(--cs-primary) !important;
        background: rgba(0, 123, 255, 0.1);
    }
}

/* ============================================
   Select2 Theme Tweaks
   ============================================ */

.select2-container--bootstrap-5 .select2-selection {
    min-height: 36px;
    font-size: 0.84rem;
    border-color: #dfe3e8;
    border-radius: 6px;
}

.select2-container--bootstrap-5 .select2-selection--single {
    padding: 6px 28px 6px 12px;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.4;
    padding: 0;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.08);
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: #dfe3e8;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    overflow: hidden;
}

.select2-container--bootstrap-5 .select2-search--dropdown {
    padding: 8px;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 6px;
    border: 1px solid #dfe3e8;
    padding: 6px 10px;
    font-size: 0.84rem;
}

.select2-container--bootstrap-5 .select2-results__option {
    padding: 7px 12px;
    font-size: 0.84rem;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: #f0f4ff !important;
    color: var(--cs-primary) !important;
}

.select2-container--bootstrap-5 .select2-results__option[aria-selected=true] {
    background: var(--cs-primary) !important;
    color: #fff !important;
}

/* Dark mode Select2 */
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection {
    background: #14161e;
    border-color: #2a2d38;
    color: #c9cdd4;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__rendered {
    color: #c9cdd4 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #6b7280 !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown {
    background: #1e2130;
    border-color: #2a2d38;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-search__field {
    background: #14161e;
    border-color: #2a2d38;
    color: #c9cdd4;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: #c9cdd4;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: rgba(0, 123, 255, 0.1) !important;
    color: #89b4fa !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__arrow b {
    border-color: #8b95a5 transparent transparent transparent;
}

/* ============================================
   Compact Mode (dashboard toggle)
   ============================================ */

body.cs-compact .card-body { padding: 14px; }
body.cs-compact .stat-card { padding: 14px; }
body.cs-compact .stat-card .stat-value { font-size: 1.35rem; margin-top: 6px; }
body.cs-compact .stat-card .stat-icon { width: 34px; height: 34px; font-size: 0.95rem; }
body.cs-compact .card-header { padding: 10px 14px; font-size: 0.85rem; }
body.cs-compact .row.g-3 { --bs-gutter-x: 0.75rem; --bs-gutter-y: 0.75rem; }
body.cs-compact .mb-4 { margin-bottom: 1rem !important; }
body.cs-compact .table thead th { padding: 8px 12px; }
body.cs-compact .table tbody td { padding: 8px 12px; }

/* ============================================
   Dashboard Widgets - Health, Live Calls, Tip, Achievements
   ============================================ */

/* Health dots */
.cs-health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* Live badge + pulsing dot */
.cs-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 2px 8px;
    border-radius: 4px;
}
.cs-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: pulse-dot 1.4s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

/* Gauge */
.cs-gauge {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 200px;
}
.cs-gauge-value {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -40%);
    text-align: center;
    width: 100%;
}

/* Tip card - gradient accent */
.cs-tip-card {
    background: linear-gradient(135deg, rgba(0,123,255,0.05), rgba(139,92,246,0.05));
    border: 1px solid rgba(0,123,255,0.15);
}
[data-bs-theme="dark"] .cs-tip-card {
    background: linear-gradient(135deg, rgba(0,123,255,0.1), rgba(139,92,246,0.1));
    border-color: rgba(0,123,255,0.2);
}
.cs-tip-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #007bff, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.cs-tip-card kbd {
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.75rem;
    color: inherit;
}

/* Quick actions grid */
.cs-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.cs-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: #374151;
    font-size: 0.8rem;
    text-align: center;
    font-weight: 500;
    transition: all 0.15s ease;
    background: #fff;
}
.cs-quick-action:hover {
    border-color: var(--cs-primary);
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    color: var(--cs-primary);
}
.cs-quick-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

[data-bs-theme="dark"] .cs-quick-action {
    background: #181b24;
    border-color: #2a2d38;
    color: #c9cdd4;
}
[data-bs-theme="dark"] .cs-quick-action:hover {
    background: rgba(0,123,255,0.08);
    color: #89b4fa;
}

/* Achievements grid */
.cs-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.cs-achievement {
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    transition: all 0.2s ease;
}
.cs-achievement.earned {
    border-color: rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.cs-achievement.locked {
    opacity: 0.55;
    background: #f8f9fa;
}
.cs-achievement.locked .cs-achievement-icon {
    background: #e5e7eb;
    color: #9ca3af;
}
.cs-achievement.earned:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.cs-achievement-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 10px;
}

[data-bs-theme="dark"] .cs-achievement {
    background: #181b24;
    border-color: #2a2d38;
}
[data-bs-theme="dark"] .cs-achievement.locked {
    background: #14161e;
}
[data-bs-theme="dark"] .cs-achievement.locked .cs-achievement-icon {
    background: #2a2d38;
    color: #6b7280;
}

/* Achievement pill in welcome row */
.cs-achievement-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.15));
    border: 1px solid rgba(251,191,36,0.3);
    color: #b45309;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
}
[data-bs-theme="dark"] .cs-achievement-pill {
    color: #fbbf24;
    background: rgba(251,191,36,0.1);
}

/* ============================================
   Confetti (welcome-back celebration)
   ============================================ */

.cs-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.cs-welcome-modal {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.cs-welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #8b5cf6);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* ============================================
   Dashboard Drag-and-Drop
   ============================================ */

.cs-row {
    position: relative;
    transition: box-shadow 0.2s ease;
}

.cs-drag-handle {
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: grab;
    z-index: 5;
    border-radius: 6px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 1.2rem;
}

body.cs-editing-dashboard .cs-drag-handle {
    display: flex;
}

body.cs-editing-dashboard .cs-row {
    outline: 2px dashed rgba(0, 123, 255, 0.25);
    outline-offset: 4px;
    border-radius: 10px;
    padding-left: 28px;
    transition: outline-color 0.15s ease;
}

body.cs-editing-dashboard .cs-row:hover {
    outline-color: var(--cs-primary);
}

body.cs-editing-dashboard .cs-row:hover .cs-drag-handle {
    color: var(--cs-primary);
    background: #fff;
}

.cs-drag-handle:active {
    cursor: grabbing;
}

/* Reorder button active state */
#reorderToggle.active {
    background: var(--cs-primary);
    border-color: var(--cs-primary);
    color: #fff;
}

[data-bs-theme="dark"] .cs-drag-handle {
    background: #2a2d38;
    color: #8b95a5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
[data-bs-theme="dark"] body.cs-editing-dashboard .cs-row:hover .cs-drag-handle {
    background: #1e2130;
    color: #89b4fa;
}

.cs-row-ghost {
    opacity: 0.4;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 10px;
}

.cs-row-chosen {
    opacity: 0.95;
}

.cs-row-dragging {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
    transform: scale(1.01);
}

@media (max-width: 991.98px) {
    .cs-drag-handle { display: none !important; }
    body.cs-editing-dashboard .cs-row { outline: none; }
}

/* ============================================
   Impersonation Banner (CommStack admin mode)
   ============================================ */

.cs-impersonation-banner {
    background: repeating-linear-gradient(45deg, #19143b, #19143b 12px, #231d52 12px, #231d52 24px);
    color: #fff;
    padding: 8px 0;
    font-size: 0.85rem;
    box-shadow: inset 0 -2px 0 rgba(255,255,255,0.08);
}

.cs-impersonation-banner strong { color: #ffd966; }

.cs-impersonation-banner .btn {
    font-size: 0.8rem;
    padding: 4px 10px;
}

body.cs-impersonating {
    border: 3px solid #19143b;
    box-sizing: border-box;
}

/* ============================================
   Topic / Category Icon Picker
   (Used on the new ticket and feature request pages)
   ============================================ */

.cs-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.cs-topic-card {
    position: relative;
    display: flex;
    cursor: pointer;
    margin: 0;
    height: 100%;
}

.cs-topic-card-inner,
.cs-topic-card { width: 100%; }

.cs-topic-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cs-topic-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border: 2px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1.1rem 0.75rem;
    text-align: center;
    background: var(--bs-body-bg);
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    height: 100%;
    min-height: 130px;
}

.cs-topic-card { --cs-topic-accent: #007bff; }

.cs-topic-card:hover .cs-topic-card-inner {
    border-color: var(--cs-topic-accent);
    transform: translateY(-2px);
}

.cs-topic-card input:checked + .cs-topic-card-inner {
    border-color: var(--cs-topic-accent);
    background: color-mix(in srgb, var(--cs-topic-accent) 8%, var(--bs-body-bg));
    box-shadow: 0 0 0 1px var(--cs-topic-accent) inset;
}

.cs-topic-card input:focus-visible + .cs-topic-card-inner {
    outline: 2px solid var(--cs-topic-accent);
    outline-offset: 2px;
}

.cs-topic-icon {
    font-size: 1.8rem;
    line-height: 1;
    color: var(--cs-topic-accent);
    margin-bottom: 0.5rem;
    display: block;
}

.cs-topic-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--bs-body-color);
    display: block;
}

.cs-topic-desc {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.cs-topic-card input:checked + .cs-topic-card-inner .cs-topic-icon {
    color: var(--cs-topic-accent);
}

/* Compact variant of the topic card — used for priority selectors where
   the cards are denser (no description line). */
.cs-topic-card.cs-topic-card-sm .cs-topic-card-inner {
    min-height: 100px;
    padding: 0.85rem 0.6rem;
}
.cs-topic-card.cs-topic-card-sm .cs-topic-icon { font-size: 1.4rem; }
.cs-topic-card.cs-topic-card-sm .cs-topic-label { font-size: 0.85rem; }


