/* ============================================================================
   DASHBOARD COMPACT & PROFESSIONAL DESIGN
   ============================================================================ */

/* Compact Stats Grid - Standardized */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    align-items: stretch;
}

.stats-grid:first-child {
    margin-top: 0;
}

/* Force equal height for stat cards in same row */
.stats-grid > .stat-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Compact Stat Cards - Standardized Height */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    border: 1px solid #f1f5f9;
    min-height: 100px;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: #e2e8f0;
}

/* Compact Stat Icon */
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

/* Compact Stat Content */
.stat-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 72px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 11px;
}

.trend-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 10px;
}

.trend-value {
    font-weight: 600;
    color: #334155;
    font-size: 11px;
}

.trend-period {
    color: #94a3b8;
    font-size: 10px;
}

/* Enhanced KPI Cards - More Compact */
.enhanced-kpi {
    position: relative;
}

.enhanced-kpi .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

.enhanced-kpi .stat-value {
    font-size: 22px;
}

.enhanced-kpi .stat-label {
    font-size: 10px;
}

/* Compact Dashboard Charts Grid - Standardized */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 0;
    align-items: stretch;
}

.dashboard-charts-grid:first-child {
    margin-top: 0;
}

/* Force equal height for cards in same row - STANDARDIZED */
.dashboard-charts-grid > .card {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 420px; /* Standardized minimum height for all cards */
}

.dashboard-charts-grid > .card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Compact Card - Standardized Height */
.card {
    background: white;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f5f9;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* All cards in dashboard-charts-grid must have same height */
.dashboard-charts-grid > .card {
    min-height: 420px;
}

/* Force equal heights for grid items inside cards */
.card-body > [style*="display: grid"] > * {
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

/* Ensure grid items stretch to fill available space */
.card-body > [style*="display: grid"] {
    align-items: stretch;
}

/* Cards with charts */
.card:has(canvas) {
    min-height: 420px;
}

.card:has(canvas) .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card:has(canvas) canvas {
    flex: 1;
    min-height: 200px;
}

/* Cards with scrollable lists */
.card:has([style*="overflow-y: auto"]) {
    min-height: 420px;
}

.card:has([style*="overflow-y: auto"]) [style*="overflow-y: auto"] {
    flex: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.card-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    font-size: 14px;
    color: #64748b;
}

.card-body {
    font-size: 12px;
    line-height: 1.5;
}

.card-body > *:last-child {
    margin-bottom: 0;
}

/* Compact Buttons */
.btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f9;
}

/* Compact Integrity Cards */
.integrity-card {
    padding: 14px;
}

.integrity-card .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

/* Compact Pattern Cards */
.pattern-card {
    padding: 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.pattern-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Compact Grid Items - Override inline styles - Standardized */
[style*="grid-template-columns"] {
    gap: 10px !important;
    align-items: stretch !important;
}

/* Standardize all grid items to have equal heights */
[style*="grid-template-columns"] > * {
    height: 100%;
    display: flex;
    flex-direction: column;
}

[style*="padding: 15px"] {
    padding: 10px !important;
}

[style*="padding: 20px"] {
    padding: 12px !important;
}

[style*="padding: 24px"] {
    padding: 14px !important;
}

[style*="margin-top: 20px"] {
    margin-top: 10px !important;
}

[style*="margin-bottom: 20px"] {
    margin-bottom: 10px !important;
}

[style*="margin-bottom: 24px"] {
    margin-bottom: 12px !important;
}

[style*="gap: 15px"] {
    gap: 10px !important;
}

[style*="gap: 20px"] {
    gap: 12px !important;
}

/* Standardize grid column sizes */
[style*="minmax(150px"] {
    minmax(140px, 1fr) !important;
}

[style*="minmax(180px"] {
    minmax(160px, 1fr) !important;
}

[style*="minmax(200px"] {
    minmax(180px, 1fr) !important;
}

[style*="minmax(300px"] {
    minmax(280px, 1fr) !important;
}

/* Compact Font Sizes in Cards */
.card-body h4 {
    font-size: 11px;
    margin: 0 0 6px 0;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body [style*="font-size: 32px"] {
    font-size: 22px !important;
    line-height: 1.2;
}

.card-body [style*="font-size: 28px"] {
    font-size: 18px !important;
    line-height: 1.2;
}

.card-body [style*="font-size: 24px"] {
    font-size: 16px !important;
    line-height: 1.2;
}

.card-body [style*="font-size: 20px"] {
    font-size: 14px !important;
}

/* Compact Lists */
.investigation-case-item,
.fraud-alert-item {
    padding: 10px !important;
    margin-bottom: 8px !important;
    font-size: 12px;
}

/* Compact Charts */
canvas {
    max-height: 220px !important;
}

.chart-container {
    height: 220px;
    position: relative;
}

/* Compact Select Controls */
.select {
    padding: 5px 10px;
    font-size: 11px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
}

/* Compact Badges */
.badge {
    padding: 3px 8px;
    font-size: 10px;
    border-radius: 4px;
    font-weight: 600;
}

/* Compact Empty States */
.empty-state {
    padding: 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}

/* Compact Loading Spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Responsive Adjustments - Moved to Mobile Responsive Design section below */

/* Professional Color Refinements */
.stat-icon.blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stat-icon.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.stat-icon.teal { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.stat-icon.cyan { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.stat-icon.indigo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }

/* Compact Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.quick-action-btn {
    padding: 8px 10px;
    font-size: 11px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    flex-direction: column;
}

.quick-action-btn i {
    font-size: 14px;
}

.quick-action-btn span {
    font-size: 10px;
}

/* Compact Recent Activity */
.recent-activity-feed {
    font-size: 11px;
}

.activity-item {
    padding: 8px;
    margin-bottom: 6px;
    font-size: 11px;
}

/* Compact Financial Summary */
.financial-grid {
    gap: 10px !important;
}

.financial-item {
    padding: 10px;
}

.financial-item .label {
    font-size: 10px;
}

.financial-item .value {
    font-size: 18px;
}

/* Professional Spacing Utilities */
.compact-spacing {
    margin: 0 !important;
    padding: 0 !important;
}

.compact-padding {
    padding: 12px !important;
}

.compact-margin {
    margin: 8px !important;
}

/* Additional Compact Optimizations */
.card-body > div[style*="display: grid"] {
    gap: 10px !important;
}

.card-body > div[style*="text-align: center"] {
    padding: 10px !important;
}

/* Compact Worker Status Grid */
.workers-status-grid {
    gap: 6px !important;
    font-size: 10px !important;
    margin-top: 6px !important;
}

.worker-item {
    padding: 4px 6px;
    font-size: 9px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.worker-item i {
    font-size: 10px;
}

/* System Health Grid */
.system-health-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 6px;
    font-size: 10px;
}

.health-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.health-item i {
    font-size: 11px;
    color: #64748b;
}

/* Compact Badge Sizes */
.badge {
    padding: 2px 6px;
    font-size: 9px;
    border-radius: 3px;
}

.nav-badge {
    padding: 2px 6px;
    font-size: 9px;
}

/* Compact Top Bar */
.top-bar {
    padding: 12px 20px;
}

.top-bar h1 {
    font-size: 20px;
}

.top-bar p {
    font-size: 12px;
}

/* Compact Page Header */
.page-header {
    margin-bottom: 16px;
    padding-bottom: 10px;
}

.page-header h2 {
    font-size: 18px;
}

.page-header p {
    font-size: 12px;
}

/* Compact Integrity Overview Items */
.integrity-overview-grid {
    gap: 10px !important;
    padding: 10px !important;
}

.integrity-item {
    padding: 10px;
}

.integrity-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
}

.integrity-label {
    font-size: 10px;
    margin-bottom: 4px;
}

.integrity-value {
    font-size: 14px;
    margin-bottom: 2px;
}

.integrity-detail {
    font-size: 10px;
}

/* Compact Recent Fraud Alerts */
.recent-fraud-alerts {
    font-size: 11px;
}

.fraud-alert-item {
    padding: 8px !important;
    margin-bottom: 6px !important;
    font-size: 11px;
    border-radius: 4px;
}

.fraud-alert-header {
    margin-bottom: 4px;
}

.fraud-alert-message {
    font-size: 10px;
    margin-bottom: 4px;
}

.fraud-alert-time {
    font-size: 9px;
}

/* Compact Scrollable Areas */
[style*="overflow-y: auto"] {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 6px;
}

[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* CRM dashboard widgets */
.crm-workers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.crm-worker-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crm-worker-card.is-running {
    border-left: 3px solid #10b981;
}

.crm-worker-card.is-stopped {
    border-left: 3px solid #dc2626;
}

.crm-worker-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.crm-worker-card__name {
    font-weight: 700;
    font-size: 0.875rem;
    color: #1e293b;
}

.crm-worker-card__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.crm-worker-card.is-running .crm-worker-card__dot { background: #10b981; }
.crm-worker-card.is-stopped .crm-worker-card__dot { background: #dc2626; }

.crm-worker-card__desc {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.45;
    margin-bottom: 8px;
}

.crm-worker-card__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.72rem;
    color: #475569;
}

.crm-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    margin-bottom: 8px;
}

.crm-recent-item__main {
    min-width: 0;
}

.crm-recent-item__main strong {
    display: block;
    font-size: 0.8125rem;
    color: #1e293b;
}

.crm-recent-item__sub {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: capitalize;
}

.crm-badge-warn { background: #fef3c7; color: #92400e; }
.crm-badge-danger { background: #fee2e2; color: #991b1b; }
.crm-badge-muted { background: #f1f5f9; color: #475569; }

.crm-ops-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.crm-ops-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}

.crm-ops-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 6px;
}

.crm-ops-label i {
    margin-right: 4px;
}

.crm-ops-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.crm-ops-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.crm-ops-live__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
}

.crm-ops-live__dot--pulse {
    animation: crm-ops-pulse 1s ease-in-out infinite;
}

.crm-ops-live__dot--syncing {
    background: #f59e0b;
}

@keyframes crm-ops-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.items-list .help-text,
.notifications-list .help-text {
    padding: 12px;
    font-size: 0.8125rem;
    color: #64748b;
    text-align: center;
}
