/* assets/css/views/mobile_sales.css */

.mobile-sales-view {
    max-width: 100%;
    margin: 0;
    padding: 60px 40px 40px 40px; /* Balanced larger margins */
    color: var(--text-primary);
    min-height: 100vh;
}



.view-content {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 30px;
    width: 100%;
}

.primary-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}



.view-header {
    width: 100%;
    margin-bottom: 2rem;
    position: relative;
    z-index: 10;
}

.view-header.simple-header {
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1.5rem;
    min-height: 50px;
}

.view-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    /* Ensure visibility */
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="neon"] .view-header h1 {
    font-family: 'Cyberpunk', sans-serif !important;
    color: #fcee09 !important;
    text-shadow: 1px 1px 0 var(--info), -1px -1px 0 var(--secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 2.2rem;
    animation: none !important;
    white-space: nowrap;
    flex: 1;
}

.header-stats {
    display: flex;
    gap: 1rem;
}

.stat-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.stat-pill i {
    color: var(--primary-color);
}

.stat-pill strong {
    font-weight: 700;
    color: var(--text-primary);
}

.alltime-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.25rem;
    opacity: 0.7;
}

/* Glass / Panel Styles */
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .panel {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="neon"] .panel {
    background: var(--bg-panel);
    border: 1px solid transparent;
    box-shadow: inset 0 0 0 1px var(--border-panel), inset 0 0 20px rgba(0, 243, 255, 0.05);
    border-radius: 4px;
    clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%);
}

.panel-header {
    height: 70px !important;
    padding: 0 1.5rem !important;
    border-bottom: 1px solid var(--border-color);
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

[data-theme="neon"] .panel-header {
    background: rgba(0, 243, 255, 0.05);
    border-bottom: 1px solid var(--hud-line);
    height: 60px !important;
}

.panel-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

[data-theme="neon"] .panel-header h3 {
    color: var(--info);
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-body {
    padding: 1.5rem;
    flex: 1;
}

.main-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 380px 1fr; /* Fixed width for form, flexible for history */
    align-items: stretch; /* Panels will have identical height */
    gap: 24px;
    margin: 0;
}

.main-grid .panel {
    min-width: 320px;
    display: flex;
    flex-direction: column;
    /* Each panel controls its own height via align-self */
}

.main-grid .form-panel {
    flex: 1 1 350px;
}

.main-grid .list-panel {
    flex: 1;
}

.left-panel-form {
    min-width: 380px;
    height: calc(100vh - 140px);
    min-height: 600px; 
    display: flex;
    flex-direction: column;
}

.right-panel-history {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.right-panel-history.panel {
    height: calc(100vh - 140px); /* Fixed height so it scrolls when overflowing */
    min-height: 600px; 
    display: flex;
    flex-direction: column;
}

.right-panel-history .panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Form Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modern-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.modern-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Date Input Styling */
input[type="date"].modern-input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    background-image: none;
    /* Remove default icon if possible or custom style it */
    cursor: pointer;
}

input[type="date"].modern-input::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: 0.2s;
}

input[type="date"].modern-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modern-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.toggle-switch {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.25rem;
    display: flex;
    gap: 0.25rem;
}

.toggle-switch button {
    border: none;
    background: transparent;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.toggle-switch button.active {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

[data-theme="dark"] .toggle-switch button.active ,
[data-theme="neon"] .toggle-switch button.active  {
    background: #374151;
    /* Dark mode active bg */
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.with-icon {
    padding-left: 2.75rem;
}

.hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Plan Selector */
.plan-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plan-card {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: var(--bg-card);
}

.plan-card:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.plan-card.active {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.plan-card input {
    display: none;
    /* Hide native radio button */
}

.plan-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.plan-name {
    font-weight: 600;
    color: var(--text-primary);
}

.check-icon {
    color: var(--primary-color);
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.plan-card.active .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* Buttons */
.btn-primary-gradient {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    /* Fallback */
    background: linear-gradient(135deg, var(--primary-color, #3b82f6), var(--primary-dark, #2563eb));
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Isolate submit button full width */
.left-panel-form .btn-primary-gradient {
    width: 100%;
}

.btn-primary-gradient:hover {

    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
}

.alert-box {
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.alert-box.error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-box.success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Lists */
/* Compact Table Styles */
.compact-table {
    border-collapse: collapse !important;
    width: 100% !important;
}

.compact-table td {
    height: 32px !important;
    padding: 0 15px;
    box-sizing: border-box !important;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    line-height: 1.2;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px !important;
}

.compact-table tr:last-child td {
    border-bottom: none;
}

.compact-table tr:hover {
    background-color: var(--bg-hover);
}

.mobile-sales-view .compact-table th {
    height: 32px !important;
    padding: 0 15px !important;
    box-sizing: border-box !important;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: left;
    vertical-align: middle;
}

.compact-table .text-end {
    text-align: right;
}

/* Specific Column Widths */
.mobile-sales-view .compact-table .col-date,
.mobile-sales-view .compact-table .col-date .text-muted,
.mobile-sales-view .compact-table .col-id,
.mobile-sales-view .compact-table .status-badge {
    font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace !important;
    font-size: 0.8rem !important;
    letter-spacing: -0.02em !important;
}

.mobile-sales-view .compact-table .col-date {
    width: 12%;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.mobile-sales-view .compact-table .col-advisor {
    width: 33%;
    font-weight: 500;
    font-size: 11px !important;
}

.mobile-sales-view .compact-table .col-plan {
    width: 25%;
    font-weight: 600;
}

.mobile-sales-view .compact-table .col-id {
    width: 15%;
    color: var(--text-muted);
}

.mobile-sales-view .compact-table .col-actions {
    width: 15%;
    text-align: right;
}

/* Sidebar Table Column Widths */
.mobile-sales-view .sidebar-table .col-name {
    width: auto !important;
}

.mobile-sales-view .sidebar-table .col-stat {
    width: 40px !important; /* Slightly narrower to fit all columns */
}

/* Status Wrapper */
.status-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-height: 24px !important;
}

/* Status Badge */
.status-badge {
    padding: 2px 8px !important;
    font-size: 0.65rem !important;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    vertical-align: middle;
    min-width: 80px !important;
    text-align: center;
    white-space: nowrap;
}

/* Small Buttons */
/* Status Colors */
.status-pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.status-validated {
    background-color: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.status-retracted {
    background-color: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Small Box Buttons */
.btn-icon.sm {
    width: 24px;
    height: 24px;
    font-size: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    /* Square box styling */
    opacity: 0.8;
    margin: 0;
    padding: 0;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    /* Ensure centering */
    align-items: center;
    justify-content: center;
}

.btn-icon.sm:hover {
    opacity: 1;
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

/* Coordinator Redesign */
.coordinator-section {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.coordinator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.team-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}

.coordinator-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    padding-bottom: 0 !important;
}

.empty-state-coord {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-coord i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    opacity: 0.5;
}

/* Clean Table */
.clean-table {
    width: 100%;
    border-collapse: collapse;
}

.clean-table th {
    background: var(--bg-body-secondary);
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.clean-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.clean-table tr:last-child td {
    border-bottom: none;
}

.advisor-info {
    display: flex;
    flex-direction: column;
}

.advisor-name {
    font-weight: 600;
}

.advisor-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.plan-pill {
    background: var(--bg-hover);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.action-group {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-action {
    width: 24px !important;
    height: 24px !important;
    border-radius: 6px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem !important;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.btn-action.check {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.btn-action.check:hover {
    background: #d1fae5;
}

.btn-action.cross {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-action.cross:hover {
    background: #fee2e2;
}

/* Scrollable Sales Lists - High Specificity */
.mobile-sales-view .history-table-container {
    flex: 1 !important;
    max-height: none !important;
    overflow-y: auto !important;
    display: block !important;
    min-height: 0;
}

.mobile-sales-view .table-responsive {
    max-height: none !important; /* Allow panel to stretch */
    overflow-y: auto !important;
    display: block !important;
}

/* History Panel Body - remove padding to match sidebar exactly */
.mobile-sales-view .panel-body:has(.history-table-container),
.mobile-sales-view .panel-body.p-0 {
    padding: 0 !important;
    padding-bottom: 0 !important;
}

.mobile-sales-view .history-table-container {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
    border: none !important;
    border-radius: 0 !important;
    position: relative;
}

/* Sticky Header for Tables inside scrollable containers - High Specificity */
.mobile-sales-view .history-table-container thead th,
.mobile-sales-view .table-responsive thead th,
.mobile-sales-view .history-table-container .modern-table thead th,
.mobile-sales-view .table-responsive .clean-table thead th {
    position: sticky !important;
    top: 0 !important;
    /* Force absolute opaque background to mask scrolling content, respecting dark mode */
    background: var(--bg-card) !important;
    z-index: 10000 !important;
    border-bottom: 1px solid var(--border-color) !important;
    vertical-align: middle;
    /* Stabilization against scroll jitter */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform, top;
}

/* Fix for modern table in history */
.mobile-sales-view .history-table-container .modern-table {
    margin: 0;
    border: none;
    width: 100%;
}

/* Custom Scrollbar for Webkit */
.mobile-sales-view .history-table-container::-webkit-scrollbar,
.mobile-sales-view .table-responsive::-webkit-scrollbar {
    width: 6px;
}

.mobile-sales-view .history-table-container::-webkit-scrollbar-track,
.mobile-sales-view .table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-sales-view .history-table-container::-webkit-scrollbar-thumb,
.mobile-sales-view .table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 20px;
}

.mobile-sales-view .history-table-container::-webkit-scrollbar-thumb:hover,
.mobile-sales-view .table-responsive::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-dark);
}

/* Scroll Hint Styles */
.scroll-hint {
    flex-shrink: 0;
    padding: 10px 15px !important;
    margin-bottom: 0 !important;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(var(--primary-rgb), 0.05);
    /* Slightly darker for visibility */
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.scroll-hint i {
    font-size: 1rem;
    color: var(--primary-color);
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
}

/* ==========================================================================
   IMPORT MODAL (Ported from Hub Management)
   ========================================================================== */

.import-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.import-modal {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.import-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.import-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: var(--bg-body-secondary);
    color: var(--text-primary);
}

/* Step Indicator */
.import-steps {
    display: flex;
    padding: 16px 24px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body-secondary);
}

.import-steps .step {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.import-steps .step.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.import-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.import-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    background: var(--bg-body-secondary);
}

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg-body-secondary);
    padding: 4px;
    border-radius: 8px;
    width: fit-content;
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* CSV Textarea */
.csv-textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    background: var(--bg-card);
    color: var(--text-primary);
    min-height: 200px;
}

.csv-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* File Input */
.file-input {
    display: block;
    width: 100%;
    padding: 24px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-body-secondary);
    cursor: pointer;
    text-align: center;
}

.file-selected {
    margin-top: 12px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 500;
}

/* Mapping Section */
.mapping-section h4 {
    font-size: 1rem;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.mapping-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-body-secondary);
    border-radius: 8px;
}

.mapping-name {
    font-weight: 600;
    min-width: 150px;
    color: var(--text-primary);
}

.mapping-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.mapping-select.is-invalid {
    border-color: var(--danger-color, #ef4444);
    background: rgba(239, 68, 68, 0.05);
}

/* Results Summary */
.results-summary {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 24px;
}

.result-stat {
    text-align: center;
    padding: 24px 40px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.result-stat.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-stat.success i,
.result-stat.success .stat-number {
    color: #10b981;
}

.result-stat.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.result-stat.warning i,
.result-stat.warning .stat-number {
    color: #d97706;
}

.result-stat i {
    font-size: 2rem;
}

.result-stat .stat-number {
    font-size: 2.5rem;
    font-weight: 800;
}

/* Spinner */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Sidebar (Aside) - tightly scoped to mobile sales to not break global dashboard */
.mobile-sales-view .dashboard-sidebar-right {
    flex: 0 0 400px !important;
    width: 400px !important;
    max-width: 400px !important;
    min-width: 400px !important;
    margin-right: 0 !important; /* Reclaim space on the right edge */
    display: flex;
    flex-direction: column; /* Stack panels vertically */
    gap: 24px; /* Space between multiple panels */
    align-items: stretch;
    align-self: flex-start; /* Shrink to content height, don't stretch */
    margin-top: 0;
}

.sidebar-panel .panel-body {
    padding: 0;
    overflow-y: auto;
    overflow-x: auto; /* Allow horizontal scroll if needed */
}

/* Sidebar panel override: allow table to use full width without clipping */
.sidebar-panel {
    height: auto; /* Fit content, not 100% of parent */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
    overflow: visible !important;
}

/* Sidebar Table Specifics */
.sidebar-table {
    width: 100%;
    border-collapse: collapse;
}

.sidebar-table th {
    white-space: nowrap; /* Prevent header text from wrapping */
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-table td {
    padding: 4px;
}

.sidebar-table .col-name {
    width: auto;
    min-width: 70px;
    max-width: 100px;
    font-size: 12px;
}

.sidebar-table .col-stat {
    width: 45px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.sidebar-table .col-total {
    width: 40px;
    padding-right: 6px !important;
    text-align: right;
}

.sidebar-table .text-center {
    text-align: center;
}

.sidebar-table .mini-pill {
    display: inline-block;
    margin: 0 auto;
}

.col-stat {
    width: 38px;
    text-align: center;
}

/* Optimized Sidebar Cell alignment */
.sidebar-table td {
    vertical-align: middle;
}

.user-name-cell {
    overflow: hidden;
    line-height: 1;
}

.user-name {
    font-weight: 500;
    font-size: 11px !important;
    line-height: 1.2;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 180px; /* Much more room for names */
}

/* Clean up removed grid parts */
.user-name-cell {
    line-height: 1;
}

.mini-pill {
    width: 34px;
    padding: 1px 0;
    text-align: center;
    border-radius: 4px;
    font-size: 11px !important;
    font-weight: 700;
}

.mini-pill.f5g {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border: 1px solid rgba(13, 110, 253, 0.2);
}

.mini-pill.sf {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
    border: 1px solid rgba(25, 135, 84, 0.2);
}

.mini-pill.mig {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.mini-pill.f5gmax {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.plan-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    border: 1px solid transparent;
    white-space: nowrap;
}

.plan-badge.f5g {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border-color: rgba(13, 110, 253, 0.2);
}

.plan-badge.sf {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
    border-color: rgba(25, 135, 84, 0.2);
}

.plan-badge.mig {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
}

.plan-badge.f5gmax {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.2);
}

.total-count {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
    border: 1px solid var(--border-color);
    min-width: 28px;
    text-align: center;
}

.detail-pill {
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.detail-pill.f5g,
.plan-pill.f5g {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border-color: rgba(13, 110, 253, 0.2);
}

.detail-pill.sf,
.plan-pill.sf {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
    border-color: rgba(25, 135, 84, 0.2);
}

.detail-pill.mig,
.plan-pill.mig {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
}

/* Coordinator Section (Footer) */
footer.coordinator-section {
    width: 100%;
    margin-top: 1.5rem;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .view-content {
        flex-direction: column !important;
        gap: 15px;
    }

    .dashboard-sidebar-right {
        order: 2;
        width: 100% !important;
        flex: 0 0 auto !important;
        margin-top: 10px;
    }

    .primary-content {
        order: 1;
        width: 100% !important;
    }

    .main-grid {
        flex-direction: column;
    }

    .main-grid .panel {
        min-width: 0 !important;
        width: 100% !important;
    }

    .left-panel-form {
        max-width: 100% !important;
        flex: 0 0 auto !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    [data-theme="neon"] .view-header h1 {
        font-size: 1.4rem !important;
        letter-spacing: 1px;
        white-space: normal;
    }
}

@media (max-width: 576px) {

    .panel-header,
    .panel-body {
        padding: 1rem !important;
    }

    /* History Table Mobile Fix */
    .mobile-sales-view .history-table-container {
        margin: 0 -1rem;
        width: calc(100% + 2rem);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-sales-view .modern-table {
        min-width: 500px;
        font-size: 0.8rem;
    }

    .team-header-row,
    .team-stat-item {
        grid-template-columns: 100px 1fr 35px;
        padding: 8px 10px;
    }
}

/* ===================== STATISTICS TAB ===================== */

/* Tabs */
.ms-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ms-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    padding: 3px;
}

[data-theme="neon"] .ms-tabs {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--hud-line);
}

.ms-view-toggle {
    margin-left: 4px;
}

.ms-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ms-tab:hover {
    color: var(--text-primary, #1e293b);
    background: rgba(0, 0, 0, 0.04);
}

.ms-tab.active {
    background: var(--bg-card);
    color: var(--text-primary, #1e293b);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ms-tab i {
    font-size: 15px;
}

.ms-filters-group {
    display: flex;
    gap: 8px;
}

.custom-select-container {
    position: relative;
    display: inline-flex;
    z-index: 1000;
}

.custom-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    transition: all 0.2s ease;
    min-width: 110px;
    justify-content: space-between;
}

.custom-select-btn:hover {
    color: var(--text-primary, #1e293b);
    background: rgba(0, 0, 0, 0.08);
}

.custom-select-btn.dropdown-open {
    background: var(--bg-card);
    color: var(--text-primary, #1e293b);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-select-btn i {
    transition: transform 0.2s ease;
    font-size: 16px;
    color: inherit;
}

.custom-select-btn.dropdown-open i {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 140px;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 6px;
    max-height: 250px;
    overflow-y: auto;
    animation: dropdownFade 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-select-option {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.custom-select-option:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.custom-select-option.active {
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.15);
    color: var(--primary);
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
}

/* Dark mode support */
[data-theme="dark"] .custom-select-btn ,
[data-theme="neon"] .custom-select-btn  {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
}

[data-theme="dark"] .custom-select-btn:hover ,
[data-theme="neon"] .custom-select-btn:hover  {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-theme="dark"] .custom-select-btn.dropdown-open ,
[data-theme="neon"] .custom-select-btn.dropdown-open  {
    background: var(--bg-card);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="neon"] .custom-select-btn.dropdown-open {
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px var(--primary-light);
}

[data-theme="dark"] .custom-select-dropdown ,
[data-theme="neon"] .custom-select-dropdown  {
    background: var(--bg-modal);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

[data-theme="neon"] .custom-select-dropdown {
    border: 1px solid var(--hud-line);
}

[data-theme="dark"] .custom-select-option ,
[data-theme="neon"] .custom-select-option  {
    color: #94a3b8;
}

[data-theme="dark"] .custom-select-option:hover ,
[data-theme="neon"] .custom-select-option:hover  {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

[data-theme="dark"] .custom-select-option.active ,
[data-theme="neon"] .custom-select-option.active  {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* N-1 Badge */
.n1-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    cursor: default;
}

.n1-tooltip {
    position: absolute;
    bottom: -140%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.n1-badge:hover .n1-tooltip {
    opacity: 1;
    visibility: visible;
}

[data-theme="dark"] .n1-tooltip ,
[data-theme="neon"] .n1-tooltip  {
    background: #f8fafc;
    color: #0f172a;
}

/* Trendline Toggle inside Chart */
.chart-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header-flex h4 {
    margin-bottom: 0;
}

.trendline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.trendline-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary, #1e293b);
}

.trendline-toggle.active {
    background: var(--warning-light, rgba(245, 158, 11, 0.15));
    color: var(--warning, #d97706);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .trendline-toggle ,
[data-theme="neon"] .trendline-toggle  {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

[data-theme="dark"] .trendline-toggle:hover ,
[data-theme="neon"] .trendline-toggle:hover  {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

[data-theme="dark"] .trendline-toggle.active ,
[data-theme="neon"] .trendline-toggle.active  {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.4);
}

.n1-badge.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.n1-badge.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.n1-badge.neutral {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.2);
    font-weight: 500;
}

.n1-badge i {
    font-size: 14px;
}

.n1-badge small {
    opacity: 0.7;
    font-weight: 400;
}

/* Stats Layout */
.stats-view {
    width: 100%;
}

.stats-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.stats-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.stats-main {
    flex: 1;
    min-width: 0;
}

.stats-filter-panel {
    position: sticky;
    top: 80px;
}

.stats-panel-header {
    padding: 14px 16px 10px 16px;
    border-bottom: none;
}

.stats-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.stats-sidebar-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 16px 16px 16px;
    border-bottom: 1px solid var(--border-color);
}

.btn-pill-small {
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-pill-small:hover {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.btn-pill-small:active {
    transform: translateY(0);
    background: var(--bg-hover);
}

/* Dark mode support */
[data-theme="dark"] .btn-pill-small ,
[data-theme="neon"] .btn-pill-small  {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

[data-theme="dark"] .btn-pill-small:hover ,
[data-theme="neon"] .btn-pill-small:hover  {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

.stats-filter-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Period selector bar (prominent, above KPIs) */
.stats-period-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stats-period-bar i {
    color: var(--text-secondary, #64748b);
    font-size: 18px;
}

.stats-period-bar .modern-select {
    font-size: 13px;
    padding: 6px 10px;
    min-width: 100px;
}

.btn-micro {
    padding: 3px 8px;
    font-size: 11px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    transition: all 0.2s;
}

.btn-micro:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
    color: var(--text-primary, #1e293b);
}

.stats-period-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.stats-period-filter .modern-select {
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
}

/* Advisor checkboxes */
.advisor-filter-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.advisor-checkbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin: 1px 0;
    width: 100%;
    box-sizing: border-box;
}

.advisor-name-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.advisor-checkbox:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateX(2px);
}

.advisor-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.advisor-filter-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
}

.advisor-check-icon {
    font-size: 16px;
    color: var(--text-secondary, #94a3b8);
    flex-shrink: 0;
}

.advisor-check-icon .ri-checkbox-fill {
    color: #f59e0b;
}

/* KPI Row */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="neon"] .kpi-card {
    background: rgba(181, 55, 255, 0.05);
    border: 1px solid transparent;
    box-shadow: inset 0 0 0 1px var(--hud-line);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: all 0.2s ease;
}

[data-theme="neon"] .kpi-card:hover {
    box-shadow: 0 0 15px rgba(181, 55, 255, 0.1), inset 0 0 0 2px var(--secondary);
    transform: translateY(-2px);
}

[data-theme="neon"] .kpi-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary);
    text-shadow: var(--glow-primary);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    flex-shrink: 0;
}

.kpi-icon.challenge {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.kpi-icon.quality {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    line-height: 1.2;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    margin-top: 2px;
}

.kpi-sublabel {
    font-size: 11px;
    color: var(--text-secondary, #94a3b8);
    opacity: 0.7;
    margin-top: 3px;
    line-height: 1.3;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chart-card.chart-wide {
    grid-column: 1 / -1;
}

.chart-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card h4 i {
    color: var(--text-secondary, #64748b);
}

.chart-container {
    position: relative;
    height: 280px;
}

/* Loading / Empty */
.stats-loading,
.stats-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary, #64748b);
    text-align: center;
}

.stats-loading i,
.stats-empty i {
    font-size: 36px;
    opacity: 0.4;
}

.stats-loading .spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================== DARK MODE ===================== */
[data-theme="dark"] .ms-tabs ,
[data-theme="neon"] .ms-tabs  {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .ms-tab ,
[data-theme="neon"] .ms-tab  {
    color: #94a3b8;
}

[data-theme="dark"] .ms-tab:hover ,
[data-theme="neon"] .ms-tab:hover  {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .ms-tab.active ,
[data-theme="neon"] .ms-tab.active  {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .n1-badge.positive ,
[data-theme="neon"] .n1-badge.positive  {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .n1-badge.negative ,
[data-theme="neon"] .n1-badge.negative  {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

[data-theme="dark"] .n1-badge.neutral ,
[data-theme="neon"] .n1-badge.neutral  {
    background: rgba(142, 142, 178, 0.15);
    color: #94a3b8;
    border-color: rgba(142, 142, 178, 0.25);
}

[data-theme="neon"] .n1-badge {
    border-radius: 2px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

[data-theme="dark"] .kpi-card,
[data-theme="neon"] .kpi-card,
[data-theme="dark"] .chart-card ,
[data-theme="neon"] .chart-card  {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="neon"] .chart-card {
    background: var(--bg-panel);
    border: 1px solid transparent;
    box-shadow: inset 0 0 0 1px var(--hud-line);
    border-radius: 2px;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    transition: all 0.2s ease;
}

[data-theme="neon"] .chart-card:hover {
    box-shadow: 0 0 15px rgba(252, 238, 9, 0.1), inset 0 0 0 2px var(--primary);
}

[data-theme="dark"] .kpi-value ,
[data-theme="neon"] .kpi-value  {
    color: #f1f5f9;
}

[data-theme="dark"] .kpi-label ,
[data-theme="neon"] .kpi-label  {
    color: #94a3b8;
}

[data-theme="dark"] .chart-card h4 ,
[data-theme="neon"] .chart-card h4  {
    color: #e2e8f0;
}

[data-theme="dark"] .advisor-checkbox:hover ,
[data-theme="neon"] .advisor-checkbox:hover  {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .advisor-filter-name ,
[data-theme="neon"] .advisor-filter-name  {
    color: #e2e8f0;
}

[data-theme="dark"] .btn-micro ,
[data-theme="neon"] .btn-micro  {
    border-color: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

[data-theme="dark"] .btn-micro:hover ,
[data-theme="neon"] .btn-micro:hover  {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

[data-theme="dark"] .stats-period-bar ,
[data-theme="neon"] .stats-period-bar  {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    .stats-layout {
        flex-direction: column;
    }

    .stats-sidebar {
        width: 100%;
    }

    .kpi-row {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .ms-tabs {
        gap: 2px;
    }

    .ms-tab {
        padding: 6px 10px;
        font-size: 12px;
    }
}