/* ========================================
   Analytics - Quoting Dashboard
   ======================================== */

/* ========================================
   Filter Panel
   ======================================== */
.filter-panel {
    background: #ffffff;
    border: 1px solid #e1e8ef;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.filter-row + .filter-row {
    margin-top: 12px;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-select {
    padding: 7px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease;
    width: 100%;
}

.filter-select:hover {
    border-color: #cbd5e1;
}

.filter-select:focus {
    border-color: #059669;
}

/* ========================================
   Entity Tree Picker
   ======================================== */
.entity-picker {
    position: relative;
}

.entity-picker-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-height: 34px;
}

.entity-picker-display:hover {
    border-color: #cbd5e1;
}

.entity-picker.open .entity-picker-display {
    border-color: #059669;
}

.entity-picker-icon {
    color: #94a3b8;
    font-size: 13px;
    flex-shrink: 0;
}

.entity-picker-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-picker-text.ep-default {
    color: #94a3b8;
}

.entity-picker-clear {
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1;
    flex-shrink: 0;
}

.entity-picker-clear:hover {
    color: #64748b;
}

.entity-picker-chevron {
    color: #94a3b8;
    font-size: 10px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.entity-picker.open .entity-picker-chevron {
    transform: rotate(180deg);
}

.entity-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 340px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    overflow: hidden;
}

.entity-picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.entity-picker-search i {
    color: #94a3b8;
    font-size: 13px;
}

.entity-picker-search input {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: #0f172a;
    width: 100%;
    background: transparent;
}

.entity-picker-tree {
    max-height: 320px;
    overflow-y: auto;
    padding: 6px 0;
}

.entity-tree-node {
    user-select: none;
}

.entity-tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 13px;
    color: #0f172a;
}

.entity-tree-row:hover {
    background: #f8fafc;
}

.entity-tree-row.selected {
    background: #ecfdf5;
    color: #059669;
    font-weight: 600;
}

.entity-tree-row.selected:hover {
    background: #d1fae5;
}

.entity-tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 9px;
    color: #94a3b8;
    transition: transform 0.15s ease;
}

.entity-tree-toggle.expanded {
    transform: rotate(90deg);
}

.entity-tree-toggle.empty {
    visibility: hidden;
}

.entity-tree-icon {
    font-size: 12px;
    color: #64748b;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.entity-tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-tree-badge {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    flex-shrink: 0;
}

.entity-tree-children {
    display: none;
}

.entity-tree-children.expanded {
    display: block;
}

/* Indentation levels */
.entity-tree-row[data-depth="0"] { padding-left: 14px; }
.entity-tree-row[data-depth="1"] { padding-left: 36px; }
.entity-tree-row[data-depth="2"] { padding-left: 58px; }
.entity-tree-row[data-depth="3"] { padding-left: 80px; }
.entity-tree-row[data-depth="4"] { padding-left: 102px; }

.entity-tree-no-results {
    padding: 20px 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.filter-actions {
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
    flex: 0 0 auto;
}

.filter-actions .btn {
    white-space: nowrap;
}

/* ========================================
   Stat Cards
   ======================================== */
.stat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-icon.pending {
    background: #fef3c7;
    color: #f59e0b;
}

.stat-icon.quoted {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.won {
    background: #d1fae5;
    color: #059669;
}

.stat-icon.rate {
    background: #ede9fe;
    color: #7c3aed;
}

.stat-icon.margin {
    background: #fce7f3;
    color: #db2777;
}

.stat-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.stat-trend.up {
    background: #d1fae5;
    color: #059669;
}

.stat-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

/* ========================================
   Leaderboards
   ======================================== */
.leaderboard-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.leaderboard-section-title i {
    color: #64748b;
    font-size: 14px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.leaderboard-card {
    background: #ffffff;
    border: 1px solid #e1e8ef;
    border-radius: 10px;
    overflow: hidden;
}

.leaderboard-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.leaderboard-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leaderboard-title i {
    color: #059669;
    font-size: 13px;
}

.leaderboard-body {
    padding: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s ease;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: #f8fafc;
}

.leaderboard-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #64748b;
}

.leaderboard-rank.gold {
    background: #fef3c7;
    color: #d97706;
}

.leaderboard-rank.silver {
    background: #f1f5f9;
    color: #475569;
}

.leaderboard-rank.bronze {
    background: #ffedd5;
    color: #c2410c;
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-detail {
    font-size: 11px;
    color: #94a3b8;
}

.leaderboard-value {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    flex-shrink: 0;
}

.leaderboard-bar-track {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.leaderboard-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.leaderboard-bar-fill.green {
    background: #059669;
}

.leaderboard-bar-fill.blue {
    background: #2563eb;
}

.leaderboard-bar-fill.purple {
    background: #7c3aed;
}

/* ========================================
   Multi-Select Dropdowns
   ======================================== */
.multi-select {
    position: relative;
}

.multi-select-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease;
    min-height: 34px;
}

.multi-select-display:hover {
    border-color: #cbd5e1;
}

.multi-select.open .multi-select-display {
    border-color: #059669;
}

.multi-select-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-select-text.ms-default {
    color: #64748b;
}

.multi-select-chevron {
    color: #94a3b8;
    font-size: 10px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.multi-select.open .multi-select-chevron {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    overflow: hidden;
}

.multi-select-actions {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.multi-select-action {
    border: none;
    background: none;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.1s ease;
}

.multi-select-action:hover {
    background: #ecfdf5;
}

.multi-select-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}

.multi-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #0f172a;
    transition: background 0.1s ease;
    user-select: none;
}

.multi-select-option:hover {
    background: #f8fafc;
}

.multi-select-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #059669;
    cursor: pointer;
    flex-shrink: 0;
}

.multi-select-option label {
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

