/**
 * CRM Dashboard styles.
 * Plain CSS (Filament panel CSS does not compile Tailwind from this Blade view).
 */

.crm-dash {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Never let icon SVGs explode (Filament @svg has no default size). */
.crm-dash svg {
    width: 1.15rem !important;
    height: 1.15rem !important;
    max-width: 1.5rem !important;
    max-height: 1.5rem !important;
    flex-shrink: 0;
}

.crm-dash__hero {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
    padding: 1.35rem 1.5rem;
    color: #f8fafc;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0f766e 100%);
    box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.4);
}

.crm-dash__hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.crm-dash__hero-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.crm-dash__hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    max-width: 2.75rem;
    max-height: 2.75rem;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
}

.crm-dash__hero-icon svg {
    width: 1.35rem !important;
    height: 1.35rem !important;
}

.crm-dash__hero-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: #fff;
}

.crm-dash__hero-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: rgba(226, 232, 240, 0.88);
    line-height: 1.4;
}

.crm-dash__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.crm-dash__action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: #0f172a;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: background 0.15s ease, transform 0.15s ease;
}

.crm-dash__action:hover {
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
    transform: translateY(-1px);
}

.crm-dash__action svg {
    width: 0.95rem !important;
    height: 0.95rem !important;
}

.crm-dash__hero-metrics {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 1.15rem;
}

@media (min-width: 640px) {
    .crm-dash__hero-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.crm-dash__metric {
    padding: 0.75rem 0.9rem;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.crm-dash__metric-label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(203, 213, 225, 0.9);
}

.crm-dash__metric-value {
    margin: 0.3rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.2;
}

.crm-dash__metric-hint {
    margin: 0.2rem 0 0;
    font-size: 0.7rem;
    color: rgba(203, 213, 225, 0.75);
}

.crm-dash__kpi-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .crm-dash__kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .crm-dash__kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.crm-dash__kpi {
    position: relative;
    display: block;
    overflow: hidden;
    text-decoration: none;
    padding: 1rem 1.1rem 1rem 1.25rem;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.crm-dash__kpi:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -10px rgba(15, 23, 42, 0.16);
}

.dark .crm-dash__kpi {
    background: #111827;
    border-color: #1f2937;
}

.crm-dash__kpi-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.crm-dash__kpi-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.crm-dash__kpi-label {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}

.dark .crm-dash__kpi-label {
    color: #94a3b8;
}

.crm-dash__kpi-value {
    margin: 0.35rem 0 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #0f172a;
}

.dark .crm-dash__kpi-value {
    color: #f8fafc;
}

.crm-dash__kpi-desc {
    margin: 0.4rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

.crm-dash__kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
    max-width: 2.25rem;
    max-height: 2.25rem;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 0.6rem;
}

.crm-dash__kpi--primary .crm-dash__kpi-accent { background: #2563eb; }
.crm-dash__kpi--primary .crm-dash__kpi-icon { background: #dbeafe; color: #2563eb; }
.dark .crm-dash__kpi--primary .crm-dash__kpi-icon { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }

.crm-dash__kpi--warning .crm-dash__kpi-accent { background: #d97706; }
.crm-dash__kpi--warning .crm-dash__kpi-icon { background: #fef3c7; color: #d97706; }
.dark .crm-dash__kpi--warning .crm-dash__kpi-icon { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }

.crm-dash__kpi--success .crm-dash__kpi-accent { background: #16a34a; }
.crm-dash__kpi--success .crm-dash__kpi-icon { background: #dcfce7; color: #16a34a; }
.dark .crm-dash__kpi--success .crm-dash__kpi-icon { background: rgba(22, 163, 74, 0.2); color: #4ade80; }

.crm-dash__kpi--danger .crm-dash__kpi-accent { background: #dc2626; }
.crm-dash__kpi--danger .crm-dash__kpi-icon { background: #fee2e2; color: #dc2626; }
.dark .crm-dash__kpi--danger .crm-dash__kpi-icon { background: rgba(220, 38, 38, 0.2); color: #f87171; }

.crm-dash__kpi--info .crm-dash__kpi-accent { background: #0891b2; }
.crm-dash__kpi--info .crm-dash__kpi-icon { background: #cffafe; color: #0891b2; }
.dark .crm-dash__kpi--info .crm-dash__kpi-icon { background: rgba(8, 145, 178, 0.2); color: #22d3ee; }

.crm-dash__grid-2 {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 1024px) {
    .crm-dash__grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.crm-dash__panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.dark .crm-dash__panel {
    background: #111827;
    border-color: #1f2937;
}

.crm-dash__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.dark .crm-dash__panel-head {
    border-bottom-color: #1f2937;
}

.crm-dash__panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.crm-dash__panel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    min-width: 1.85rem;
    min-height: 1.85rem;
    max-width: 1.85rem;
    max-height: 1.85rem;
    overflow: hidden;
    border-radius: 0.45rem;
    flex-shrink: 0;
}

.crm-dash__panel-icon--primary { background: #dbeafe; color: #2563eb; }
.crm-dash__panel-icon--warning { background: #fef3c7; color: #d97706; }
.crm-dash__panel-icon--danger { background: #fee2e2; color: #dc2626; }
.crm-dash__panel-icon--info { background: #cffafe; color: #0891b2; }
.crm-dash__panel-icon--success { background: #dcfce7; color: #16a34a; }

.dark .crm-dash__panel-icon--primary { background: rgba(37, 99, 235, 0.2); color: #60a5fa; }
.dark .crm-dash__panel-icon--warning { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }
.dark .crm-dash__panel-icon--danger { background: rgba(220, 38, 38, 0.2); color: #f87171; }
.dark .crm-dash__panel-icon--info { background: rgba(8, 145, 178, 0.2); color: #22d3ee; }
.dark .crm-dash__panel-icon--success { background: rgba(22, 163, 74, 0.2); color: #4ade80; }

.crm-dash__panel-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.dark .crm-dash__panel-title {
    color: #f8fafc;
}

.crm-dash__panel-desc {
    margin: 0.1rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
}

.crm-dash__link {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
}

.crm-dash__link:hover {
    text-decoration: underline;
}

.dark .crm-dash__link {
    color: #60a5fa;
}

.crm-dash__panel-body {
    padding: 1rem;
}

.crm-dash__panel-body--flush {
    padding: 0;
}

.crm-dash__stages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.crm-dash__stage-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
}

.crm-dash__stage-label {
    font-weight: 600;
    color: #334155;
}

.dark .crm-dash__stage-label {
    color: #e2e8f0;
}

.crm-dash__stage-count {
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
}

.crm-dash__stage-track {
    height: 0.4rem;
    border-radius: 9999px;
    background: #f1f5f9;
    overflow: hidden;
}

.dark .crm-dash__stage-track {
    background: rgba(255, 255, 255, 0.08);
}

.crm-dash__stage-fill {
    height: 100%;
    border-radius: 9999px;
}

.crm-dash__stage-fill--gray { background: #94a3b8; }
.crm-dash__stage-fill--info { background: #0ea5e9; }
.crm-dash__stage-fill--warning { background: #f59e0b; }
.crm-dash__stage-fill--primary { background: #3b82f6; }
.crm-dash__stage-fill--success { background: #22c55e; }
.crm-dash__stage-fill--danger { background: #ef4444; }

.crm-dash__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.crm-dash__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
}

.crm-dash__row:last-child {
    border-bottom: none;
}

.crm-dash__row:hover {
    background: #f8fafc;
    text-decoration: none;
}

.dark .crm-dash__row {
    border-bottom-color: #1f2937;
}

.dark .crm-dash__row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.crm-dash__row-left {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.crm-dash__row-main {
    min-width: 0;
    flex: 1;
}

.crm-dash__row-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .crm-dash__row-title {
    color: #f1f5f9;
}

.crm-dash__row-meta {
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-dash__empty {
    padding: 1.75rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: #94a3b8;
}

.crm-dash__badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.12rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.crm-dash__badge--gray { background: #f1f5f9; color: #475569; }
.crm-dash__badge--info { background: #e0f2fe; color: #0369a1; }
.crm-dash__badge--warning { background: #fef3c7; color: #b45309; }
.crm-dash__badge--primary { background: #dbeafe; color: #1d4ed8; }
.crm-dash__badge--success { background: #dcfce7; color: #15803d; }
.crm-dash__badge--danger { background: #fee2e2; color: #b91c1c; }

.dark .crm-dash__badge--gray { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.dark .crm-dash__badge--info { background: rgba(14, 165, 233, 0.18); color: #7dd3fc; }
.dark .crm-dash__badge--warning { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.dark .crm-dash__badge--primary { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.dark .crm-dash__badge--success { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.dark .crm-dash__badge--danger { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.crm-dash__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    min-width: 1.85rem;
    flex-shrink: 0;
    border-radius: 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #334155;
    margin-right: 0.6rem;
}

.dark .crm-dash__avatar {
    background: #1f2937;
    color: #e2e8f0;
}
