/* ==========================================================================
   ENTERPRISE CTI & CRM COMPONENT STYLES - MODERN SAAS SPECIFICATION
   ========================================================================== */

/* 1. KPI Statistic Cards */
.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.kpi-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: 2.15rem;
    font-weight: 750;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0.15rem 0;
    font-variant-numeric: tabular-nums;
}

.kpi-subtitle {
    font-size: 0.88rem;
    font-weight: 500;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.kpi-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.kpi-icon-box.indigo {
    background: var(--primary-subtle);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.kpi-icon-box.emerald {
    background: var(--success-subtle);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.kpi-icon-box.amber {
    background: var(--warning-subtle);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.kpi-icon-box.rose {
    background: var(--danger-subtle);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.kpi-icon-box.purple {
    background: var(--purple-subtle);
    color: var(--purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* 2. Surface Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.25rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
    min-width: 0;
}

.card-title svg,
.card-title .icon {
    color: var(--primary);
    flex-shrink: 0;
}

/* 3. Tables (Fully Responsive Global Design) */
.table-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.table-container::-webkit-scrollbar {
    height: 5px;
    width: 5px;
}

.table-container::-webkit-scrollbar-track {
    background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.94rem;
    table-layout: auto;
    box-sizing: border-box;
    margin: 0;
}

.table th {
    background: var(--bg-surface-elevated);
    padding: 0.65rem 0.6rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.25;
    vertical-align: middle;
    box-sizing: border-box;
}

.table td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
    font-size: 0.94rem;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: normal;
    box-sizing: border-box;
}

.table tbody tr {
    transition: background-color 0.1s ease;
}

.table tbody tr:hover td {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Table Actions, Badges & Interactive Controls Responsive Fit */
.table td .btn,
.table td button {
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
    height: auto;
    min-height: 24px;
    white-space: nowrap;
    gap: 3px;
}

.table td .badge {
    padding: 0.15rem 0.45rem;
    font-size: 0.78rem;
    white-space: nowrap;
    max-width: 100%;
}

/* 4. Status Badges & Pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-standard {
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.badge-active {
    background: var(--success-subtle);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.25);
}

.badge-vip {
    background: var(--warning-subtle);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.25);
}

.badge-lead {
    background: rgba(249, 115, 22, 0.12);
    color: #F97316;
    border-color: rgba(249, 115, 22, 0.25);
}

.badge-danger,
.badge-overdue {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.badge-today {
    background: var(--warning-subtle);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.25);
}

/* 5. Live CTI Softphone Stack & Floating Multi-Call Cards */
.cti-calls-stack {
    position: fixed;
    bottom: 1.25rem;
    left: calc(var(--sidebar-width) + 1.25rem);
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    pointer-events: none;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
}

.cti-call-card {
    pointer-events: auto;
    width: 490px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    padding: 1.15rem;
    backdrop-filter: blur(16px);
    animation: slideUpIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.cti-call-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-popover), 0 0 0 1px var(--primary);
}

.cti-call-card.selected {
    border-color: var(--primary) !important;
    background: var(--bg-surface) !important;
    box-shadow: var(--shadow-popover), 0 0 0 2px var(--primary) !important;
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

.cti-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.cti-card-close-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.15rem 0.35rem;
    border-radius: var(--radius-xs);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.cti-card-close-btn:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--danger);
}

.cti-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--danger-subtle);
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.pulse-ring {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: currentColor;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.cti-customer-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.cti-phone-display {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.cti-cust-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

.cti-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

@media (max-width: 900px) {
    .cti-calls-stack {
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
        bottom: 0.75rem;
    }

    .cti-call-card {
        width: auto;
    }
}

/* 6. Customer Profile Drawer & Timeline */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 840px;
    max-width: 95vw;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-popover);
    z-index: 1250;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
}

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

.drawer-tabs-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    overflow-x: auto;
}

.drawer-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.8rem 0.95rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.drawer-tab-btn:hover {
    color: var(--text-primary);
}

.drawer-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.drawer-tab-pane {
    display: none;
}

.drawer-tab-pane.active {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.35rem 1.5rem;
}

.profile-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.75rem;
    background: var(--bg-surface-elevated);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.meta-value {
    font-size: 0.975rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

/* Compact Timeline */
.timeline-filters {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    margin-bottom: 0.65rem;
}

.filter-chip {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.filter-chip:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.compact-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.compact-tl-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.compact-tl-item:hover {
    border-color: var(--border-strong);
    background: var(--bg-surface-hover);
}

.compact-tl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.compact-tl-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
}

.compact-tl-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-tl-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.compact-tl-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-tl-details {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8125rem;
}

.compact-tl-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    background: var(--bg-surface);
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
}

.compact-tl-full-text {
    font-size: 0.8125rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.45;
    background: var(--bg-surface);
    padding: 0.5rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
}

/* 7. Excel Import Dropzone */
.dropzone-box {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 2.25rem 1.5rem;
    text-align: center;
    background: var(--bg-surface-elevated);
    cursor: pointer;
    transition: var(--transition);
}

.dropzone-box:hover,
.dropzone-box.dragover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.dropzone-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 0.75rem;
    color: var(--primary);
}

/* 8. Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    position: relative;
    z-index: 100000;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }

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

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface-elevated);
}

.modal-header h3,
.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body {
    padding: 1.25rem;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--bg-surface-elevated);
}

/* 9. Form Controls */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: var(--transition);
}

.form-control-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    min-height: 32px;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-surface);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

select,
select.form-control {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-input, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 13px 13px;
    padding-right: 1.9rem !important;
    padding-left: 0.65rem !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    font-size: 0.84rem;
    line-height: 1.4 !important;
    vertical-align: middle;
    box-sizing: border-box;
    display: inline-block;
    min-height: 34px;
}

select.form-control-sm,
select[style*="height: 32px"],
select[style*="height: 30px"],
select[style*="height: 28px"],
select[style*="height: 26px"] {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.35 !important;
}

select option {
    background: var(--bg-surface, #ffffff);
    color: var(--text-primary, #0f172a);
    padding: 0.4rem 0.6rem;
}

/* Multi-column Form Grid Utilities with Responsive Auto-collapse */
.form-grid-4 {
    display: grid;
    grid-template-columns: 1fr 2fr 1.2fr 1.2fr;
    gap: 0.75rem;
}

.form-grid-contact {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1fr 2fr;
    gap: 0.75rem;
}

.form-grid-addr1 {
    display: grid;
    grid-template-columns: 1.2fr 2.8fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-grid-geo {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr 1fr;
    gap: 0.75rem;
}

.form-section-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-bottom: 1.15rem;
}

@media (max-width: 900px) {

    .form-grid-4,
    .form-grid-contact,
    .form-grid-geo {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.65rem !important;
    }
}

@media (max-width: 640px) {

    .form-grid-4,
    .form-grid-contact,
    .form-grid-addr1,
    .form-grid-2,
    .form-grid-geo {
        grid-template-columns: 1fr !important;
        gap: 0.65rem !important;
    }

    .form-section-box {
        padding: 0.85rem !important;
        margin-bottom: 0.85rem !important;
    }
}

/* 10. Toasts - Simple & Professional Left-Side Placement with Highest Z-Index */
#toast-container {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    right: auto;
    z-index: 2147483647 !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    pointer-events: auto;
    background: var(--bg-surface, #1E293B);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    color: var(--text-primary);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    animation: toastSlideSimple 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2147483647 !important;
}

@keyframes toastSlideSimple {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error,
.toast.danger,
.toast.delete {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--primary);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

/* 11. Follow-up items & Stream */
.followup-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.followup-item:hover {
    border-color: var(--border-strong);
}

.followup-item.overdue {
    border-left: 3px solid var(--danger);
}

.fu-priority {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.fu-priority.high,
.fu-priority.urgent {
    background: var(--danger);
}

.fu-priority.medium {
    background: var(--warning);
}

.fu-priority.low {
    background: var(--info);
}

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

.fu-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fu-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.timeline-item {
    display: flex;
    gap: 0.75rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.timeline-bullet {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.timeline-bullet.call {
    background: var(--primary-subtle);
    color: var(--primary);
}

.timeline-bullet.email {
    background: var(--purple-subtle);
    color: var(--purple);
}

.timeline-bullet.note {
    background: var(--warning-subtle);
    color: var(--warning);
}

.timeline-body {
    flex: 1;
    min-width: 0;
}

.speed-btn {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.speed-btn.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================================================
   MODERN PROFESSIONAL SKELETON LOADERS & SHIMMER EFFECTS
   ========================================================================== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.09) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite ease-in-out;
    border-radius: var(--radius-sm);
    display: inline-block;
    vertical-align: middle;
}

[data-theme="light"] .skeleton {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.04) 25%,
            rgba(0, 0, 0, 0.09) 50%,
            rgba(0, 0, 0, 0.04) 75%);
    background-size: 200% 100%;
}

.skeleton-text {
    height: 0.8125rem;
    border-radius: 4px;
    margin-bottom: 0.35rem;
}

.skeleton-circle {
    border-radius: 50% !important;
    flex-shrink: 0;
}

.skeleton-kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
}

.skeleton-highlight-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 96px;
}

.skeleton-row td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

/* ==========================================================================
   CUSTOMER INTELLIGENCE COMPONENT STYLES
   ========================================================================== */

/* 1. Rank Badges */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 0 0.4rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1;
}

.rank-badge.rank-gold {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.rank-badge.rank-silver {
    background: linear-gradient(135deg, #94A3B8, #64748B);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(148, 163, 184, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.rank-badge.rank-bronze {
    background: linear-gradient(135deg, #D97706, #92400E);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.rank-badge.rank-regular {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* 2. Customer Intelligence Category Badges */
.badge-cat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-cat-top {
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
    border-color: rgba(139, 92, 246, 0.35);
}

[data-theme="light"] .badge-cat-top {
    background: rgba(139, 92, 246, 0.12);
    color: #6D28D9;
    border-color: rgba(139, 92, 246, 0.3);
}

.badge-cat-premium {
    background: rgba(79, 70, 229, 0.15);
    color: #818CF8;
    border-color: rgba(79, 70, 229, 0.35);
}

[data-theme="light"] .badge-cat-premium {
    background: rgba(79, 70, 229, 0.1);
    color: #4338CA;
    border-color: rgba(79, 70, 229, 0.3);
}

.badge-cat-regular {
    background: rgba(148, 163, 184, 0.14);
    color: #94A3B8;
    border-color: var(--border-color);
}

[data-theme="light"] .badge-cat-regular {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    border-color: #CBD5E1;
}

.badge-cat-new {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="light"] .badge-cat-new {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-cat-potential {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
    border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="light"] .badge-cat-potential {
    background: rgba(245, 158, 11, 0.12);
    color: #B45309;
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-cat-attention {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border-color: rgba(239, 68, 68, 0.35);
}

[data-theme="light"] .badge-cat-attention {
    background: rgba(239, 68, 68, 0.1);
    color: #B91C1C;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 3. Star Rating Components */
.stars-display {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: var(--radius-sm);
}

.star-icon {
    width: 18px;
    height: 18px;
    fill: #F59E0B;
    stroke: #D97706;
    stroke-width: 0.8px;
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.3));
    transition: transform 0.15s ease;
}

.star-icon.empty {
    fill: rgba(245, 158, 11, 0.06);
    stroke: #F59E0B;
    stroke-width: 1.6px;
    opacity: 0.85;
    filter: none;
}

.star-rating-val {
    font-size: 0.84375rem;
    font-weight: 750;
    color: #D97706;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
}

/* 4. Interactive Star Rating Picker (Drawer) */
.star-rating-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 0.35rem;
}

/* ============================================================
   INLINE CLICKABLE STAR RATING — TABLE ROWS
   ============================================================ */

.inline-star-row {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: default;
    padding: 3px 7px;
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.12);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.inline-star-row:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.1);
}

.inline-star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 1px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.inline-star-btn svg {
    width: 19px;
    height: 19px;
    pointer-events: none;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.inline-star-btn.filled svg {
    fill: #F59E0B;
    stroke: #D97706;
    stroke-width: 0.8px;
    filter: drop-shadow(0 1px 2px rgba(245, 158, 11, 0.35));
}

.inline-star-btn.empty svg {
    fill: rgba(245, 158, 11, 0.05);
    stroke: #F59E0B;
    stroke-width: 1.6px;
    opacity: 0.85;
}

.inline-star-btn:hover {
    transform: scale(1.3);
}

.inline-star-btn:hover svg {
    fill: #FBBF24;
    stroke: #D97706;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.6));
}

/* Hover preview: light up all stars up to hovered star */
.inline-star-row:hover .inline-star-btn.empty svg {
    fill: rgba(245, 158, 11, 0.2);
    stroke: #F59E0B;
    stroke-width: 1.6px;
    opacity: 0.95;
}

.inline-star-val {
    font-size: 0.84375rem;
    font-weight: 750;
    color: #D97706;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
    min-width: 22px;
}

.star-pick-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: #F59E0B;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-pick-btn:hover {
    transform: scale(1.25);
}

.star-pick-btn svg {
    width: 32px;
    height: 32px;
    transition: all 0.15s ease;
}

.star-pick-btn.active svg {
    fill: #F59E0B;
    stroke: #F59E0B;
    stroke-width: 1px;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.4));
}

.star-pick-btn.inactive svg {
    fill: rgba(245, 158, 11, 0.04);
    stroke: #F59E0B;
    stroke-width: 1.8px;
    opacity: 0.85;
}

/* 5. Rating History Timeline Item */
.intel-history-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: all 0.2s ease;
}

.intel-history-item:hover {
    border-color: var(--border-strong);
    background: var(--bg-surface-hover);
}

.intel-history-item.newly-added {
    animation: historySlideDown 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes historySlideDown {
    0% {
        opacity: 0;
        transform: translateY(-8px);
        background: rgba(245, 158, 11, 0.18);
        border-color: #F59E0B;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        background: var(--bg-surface-elevated);
        border-color: var(--border-color);
    }
}

.intel-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.intel-history-change {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-wrap: wrap;
}

.intel-history-notes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
    background: rgba(0, 0, 0, 0.08);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-xs);
    border-left: 3px solid var(--primary);
}

/* History User Role Badges */
.badge-role-admin {
    background: rgba(147, 51, 234, 0.15) !important;
    color: #A855F7 !important;
    border: 1px solid rgba(147, 51, 234, 0.35) !important;
    font-weight: 700 !important;
}

.badge-role-employee {
    background: rgba(14, 165, 233, 0.15) !important;
    color: #0284C7 !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
    font-weight: 700 !important;
}

/* History Rating Delta Badges */
.badge-diff-kam {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #EF4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    padding: 0.1rem 0.45rem !important;
    border-radius: var(--radius-xs) !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
}

.badge-diff-zyada {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #10B981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    padding: 0.1rem 0.45rem !important;
    border-radius: var(--radius-xs) !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
}

/* Live Row Glow on Live Rating Change */
@keyframes ratingLiveGlow {
    0% {
        background-color: rgba(245, 158, 11, 0.32) !important;
        transform: scale(1.006);
    }

    40% {
        background-color: rgba(245, 158, 11, 0.18) !important;
    }

    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

.rating-live-glow {
    animation: ratingLiveGlow 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. Intelligence Drawer Overlay & Drawer Animation */
#intel-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1200;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#intel-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

#intel-drawer {
    background: var(--bg-surface);
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-popover);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#intel-drawer-overlay.open #intel-drawer {
    transform: translateX(0);
}

/* Row Hover & Clickable Indicator */
.intel-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.intel-row-clickable:hover {
    background-color: var(--bg-surface-hover) !important;
}

/* ============================================================
   CUSTOMER INTELLIGENCE — RATING HISTORY TIMELINE
   ============================================================ */

.intel-history-item {
    background: var(--bg-surface-elevated, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.intel-history-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.intel-history-item:last-child {
    margin-bottom: 0;
}

.intel-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.intel-history-change {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.intel-history-notes {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(99, 102, 241, 0.06);
    border-left: 2px solid var(--primary);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    line-height: 1.4;
}

/* Newly-added animation — slide in from top */
@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-14px) scale(0.98);
    }

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

.intel-history-item.newly-added {
    animation: slideInFromTop 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.06);
}

/* ============================================================
   ROLE BADGE VARIANTS
   ============================================================ */

.badge-role-admin {
    background: rgba(168, 85, 247, 0.14);
    color: #A855F7;
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-role-employee {
    background: rgba(2, 132, 199, 0.12);
    color: #0284C7;
    border: 1px solid rgba(2, 132, 199, 0.28);
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================================
   RATING DELTA BADGES (+/- Stars)
   ============================================================ */

.badge-diff-zyada {
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.28);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-xs);
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.badge-diff-kam {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-xs);
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* ============================================================
   IN-DRAWER SUCCESS BANNER
   ============================================================ */

@keyframes successSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }

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

@keyframes successFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.97);
    }
}

.intel-success-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-left: 3px solid #10B981;
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    animation: successSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================================
   RECENTLY CHANGED TABLE ROW
   ============================================================ */

.intel-row-recent {
    border-left: 3px solid #10B981 !important;
    background: rgba(16, 185, 129, 0.025) !important;
    transition: border-left-color 0.4s ease, background 0.4s ease;
}

/* ============================================================
   JUST UPDATED BADGE (inline stars row)
   ============================================================ */

@keyframes justUpdatedPop {
    0% {
        opacity: 0;
        transform: scale(0.75);
    }

    60% {
        transform: scale(1.08);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.badge-just-updated {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    padding: 0.08rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-left: 6px;
    animation: justUpdatedPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    vertical-align: middle;
}

/* ============================================================
   INTELLIGENCE NAVIGATION TABS (Rankings vs Recent Changes)
   ============================================================ */

.intel-tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.intel-tabs-nav {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-elevated, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 10px);
    padding: 4px;
    gap: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.intel-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    background: transparent;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-lg, 10px) - 3px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    user-select: none;
}

.intel-tab-btn:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .intel-tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.intel-tab-btn.active {
    color: var(--primary, #4f46e5) !important;
    background: var(--bg-surface, #ffffff) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    font-weight: 700 !important;
}

[data-theme="dark"] .intel-tab-btn.active {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.intel-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 15%;
    right: 15%;
    height: 2px;
    background: var(--primary, #4f46e5);
    border-radius: 2px;
}

.intel-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    min-width: 20px;
    transition: all 0.2s ease;
}

.intel-tab-btn:not(.active) .intel-tab-badge {
    background: rgba(0, 0, 0, 0.06) !important;
    color: var(--text-muted) !important;
}

.intel-tab-btn.active .intel-tab-badge {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--primary, #4f46e5) !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

/* Real-time live pulsing dot */
.live-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: livePulseGlow 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes livePulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ============================================================
   ENTERPRISE BUSINESS CATEGORY TABS NAVIGATION
   ============================================================ */
.intel-category-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
    width: 100%;
}

.intel-category-tabs-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: var(--bg-surface-elevated, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    padding: 6px;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    width: 100%;
}

.intel-cat-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.84375rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    background: transparent;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-lg, 12px) - 4px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    user-select: none;
}

.intel-cat-tab-btn:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .intel-cat-tab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.intel-cat-tab-btn.active {
    color: var(--primary, #4f46e5) !important;
    background: var(--bg-surface, #ffffff) !important;
    border-color: rgba(99, 102, 241, 0.2) !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    font-weight: 700 !important;
}

[data-theme="dark"] .intel-cat-tab-btn.active {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

.intel-cat-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 7px;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    min-width: 20px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.intel-cat-tab-btn.active .intel-cat-tab-badge {
    background: var(--primary-subtle, rgba(99, 102, 241, 0.15)) !important;
    color: var(--primary, #4f46e5) !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}

/* ============================================================
   RECENT RATING CHANGES TABLE STYLES
   ============================================================ */

.recent-change-row {
    transition: all 0.25s ease;
}

.recent-change-row:hover {
    background: var(--bg-surface-hover) !important;
}

.recent-change-row.highlight-new {
    animation: slideInFromTop 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    background: rgba(16, 185, 129, 0.08) !important;
}

.badge-you-indicator {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #FFFFFF;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.08rem 0.4rem;
    border-radius: var(--radius-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.audit-notes-bubble {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
    max-width: 360px;
    word-break: break-word;
}

.rating-delta-box {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-surface-elevated);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* ─────────────────────────────────────────────────────────────
   Permissions Matrix & Configuration Modal Styles (High-Contrast & Sharp)
   ───────────────────────────────────────────────────────────── */
.perm-cat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.perm-cat-card:hover {
    border-color: var(--primary);
    background: var(--bg-surface-elevated);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.perm-cat-card.active {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.07);
    box-shadow: 0 0 0 1.5px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .perm-cat-card.active {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.12);
    box-shadow: 0 0 0 1.5px rgba(129, 140, 248, 0.35);
}

.perm-cat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    color: var(--primary);
    transition: all 0.18s ease;
}

.perm-cat-icon svg {
    width: 18px;
    height: 18px;
}

.perm-cat-card.active .perm-cat-icon {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

[data-theme="dark"] .perm-cat-card.active .perm-cat-icon {
    background: #6366f1;
    border-color: #6366f1;
}

.perm-cat-title {
    font-weight: 800;
    font-size: 0.875rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.perm-cat-card.active .perm-cat-title {
    color: #4338ca;
}

[data-theme="dark"] .perm-cat-card.active .perm-cat-title {
    color: #c7d2fe;
}

.perm-cat-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
    line-height: 1.25;
}

.perm-cat-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    margin-left: auto;
    flex-shrink: 0;
    transition: all 0.18s ease;
    opacity: 0.35;
}

.perm-cat-card.active .perm-cat-check {
    opacity: 1;
    background: #4f46e5;
    border-color: #4f46e5;
}

[data-theme="dark"] .perm-cat-card.active .perm-cat-check {
    background: #6366f1;
    border-color: #6366f1;
}

/* ─────────────────────────────────────────────────────────────
   Upload Category Access Cards (Differentiated & Modern)
   ───────────────────────────────────────────────────────────── */
.perm-upload-section {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.035) 0%, rgba(14, 165, 233, 0.035) 100%);
    border: 1.5px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
}

[data-theme="dark"] .perm-upload-section {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(14, 165, 233, 0.06) 100%);
    border-color: rgba(129, 140, 248, 0.25);
}

.perm-upload-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: var(--bg-surface);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.perm-upload-card:hover {
    border-color: #6366f1;
    background: var(--bg-surface-elevated);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.12);
}

.perm-upload-card.active {
    border: 1.5px solid #4f46e5;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(14, 165, 233, 0.06) 100%);
    box-shadow: 0 0 0 1.5px rgba(79, 70, 229, 0.3), 0 4px 12px rgba(79, 70, 229, 0.12);
}

[data-theme="dark"] .perm-upload-card.active {
    border-color: #818cf8;
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.18) 0%, rgba(56, 189, 248, 0.1) 100%);
    box-shadow: 0 0 0 1.5px rgba(129, 140, 248, 0.4);
}

.perm-upload-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.18);
    flex-shrink: 0;
    color: #4f46e5;
    position: relative;
    transition: all 0.2s ease;
}

.perm-upload-icon svg {
    width: 19px;
    height: 19px;
}

.perm-upload-card.active .perm-upload-icon {
    background: linear-gradient(135deg, #4f46e5, #0284c7);
    color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

[data-theme="dark"] .perm-upload-card.active .perm-upload-icon {
    background: linear-gradient(135deg, #6366f1, #38bdf8);
    border-color: #6366f1;
}

.perm-upload-title {
    font-weight: 800;
    font-size: 0.875rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.perm-upload-card.active .perm-upload-title {
    color: #4338ca;
}

[data-theme="dark"] .perm-upload-card.active .perm-upload-title {
    color: #e0e7ff;
}

.perm-upload-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(79, 70, 229, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.perm-upload-card.active .perm-upload-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .perm-upload-card.active .perm-upload-badge {
    background: rgba(16, 185, 129, 0.22);
    color: #34d399;
}

.perm-upload-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
    line-height: 1.25;
}

.perm-upload-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    margin-left: auto;
    flex-shrink: 0;
    transition: all 0.2s ease;
    opacity: 0.35;
}

.perm-upload-card.active .perm-upload-check {
    opacity: 1;
    background: linear-gradient(135deg, #4f46e5, #0284c7);
    border-color: #4f46e5;
}

/* Feature Capabilities Clean Cards & Modern Toggle Switch */
.perm-switch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.perm-switch-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.perm-switch-card.allowed {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.035);
}

[data-theme="dark"] .perm-switch-card.allowed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.perm-switch-card.restricted {
    border-color: var(--border-color);
    background: var(--bg-surface);
    opacity: 0.85;
}

.perm-switch-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.18s ease;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--primary);
}

.perm-switch-icon svg {
    width: 19px;
    height: 19px;
}

.perm-switch-card.allowed .perm-switch-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
}

.perm-switch-card.restricted .perm-switch-icon {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-muted);
    opacity: 0.75;
}

.perm-switch-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.25;
}

.perm-switch-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
    line-height: 1.25;
}

/* Modern iOS Style Toggle Switch */
.perm-switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.perm-switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.perm-switch-slider {
    position: absolute;
    inset: 0;
    background-color: #cbd5e1;
    transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

[data-theme="dark"] .perm-switch-slider {
    background-color: #475569;
}

.perm-switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.perm-switch-toggle input:checked + .perm-switch-slider {
    background-color: #10b981;
}

.perm-switch-toggle input:checked + .perm-switch-slider:before {
    transform: translateX(20px);
}

/* Clean Status Badges */
.perm-status-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.perm-status-badge.allowed {
    background: rgba(16, 185, 129, 0.14);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .perm-status-badge.allowed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.4);
}

.perm-status-badge.restricted {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

[data-theme="dark"] .perm-status-badge.restricted {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.32);
}

/* Matrix Table Interactive Mini Toggle Switches */
.perm-table-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 6px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.perm-table-toggle.on {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.32);
    color: #047857;
}

[data-theme="dark"] .perm-table-toggle.on {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.perm-table-toggle.off {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
    color: var(--text-muted);
    opacity: 0.85;
}

[data-theme="dark"] .perm-table-toggle.off {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.perm-table-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.perm-table-toggle.on:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: #10b981;
}

.perm-table-toggle.off:hover {
    background: rgba(148, 163, 184, 0.22);
    border-color: #94a3b8;
    opacity: 1;
}

/* The Mini Switch Slider */
.perm-mini-switch {
    width: 24px;
    height: 14px;
    border-radius: 14px;
    position: relative;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.perm-table-toggle.on .perm-mini-switch {
    background: #10b981;
}

.perm-table-toggle.off .perm-mini-switch {
    background: #cbd5e1;
}

[data-theme="dark"] .perm-table-toggle.off .perm-mini-switch {
    background: #475569;
}

.perm-mini-knob {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    position: absolute;
    top: 2px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.perm-table-toggle.on .perm-mini-knob {
    left: 2px;
    transform: translateX(10px);
}

.perm-table-toggle.off .perm-mini-knob {
    left: 2px;
    transform: translateX(0);
}

.perm-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 4px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}