﻿/* Dashboard (Home.razor and the dashboard cards/panels modules contribute). Global so module
   components get it too; every rule is scoped under .crm-dashboard so it can't leak elsewhere. */

.crm-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.crm-dashboard .crm-dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 1.4rem;
    background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.13), transparent 24rem), #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.5rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.055);
}

.crm-dashboard .crm-dashboard-hero__eyebrow {
    color: #4f46e5;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.crm-dashboard .crm-dashboard-hero h1 {
    margin: 0.25rem 0 0;
    color: #0f172a;
    font-size: clamp(1.75rem, 2.4vw, 2.45rem);
    font-weight: 850;
    letter-spacing: -0.045em;
}

.crm-dashboard .crm-dashboard-hero p {
    max-width: 44rem;
    margin: 0.45rem 0 0;
    color: #64748b;
    font-size: 0.98rem;
}

.crm-dashboard .crm-dashboard-hero__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.crm-dashboard .crm-btn {
    height: 2.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

    .crm-dashboard .crm-btn:hover {
        transform: translateY(-1px);
        text-decoration: none;
    }

    .crm-dashboard .crm-btn .material-symbols-outlined {
        font-size: 1.25rem;
    }

.crm-dashboard .crm-btn--primary {
    color: #ffffff;
    background: linear-gradient(135deg, #4f46e5, #2563eb);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
}

    .crm-dashboard .crm-btn--primary:hover {
        color: #ffffff;
        box-shadow: 0 18px 40px rgba(37, 99, 235, 0.34);
    }

.crm-dashboard .crm-btn--secondary {
    color: #334155;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

    .crm-dashboard .crm-btn--secondary:hover {
        color: #0f172a;
        background: #f8fafc;
    }

.crm-dashboard .crm-loading-panel,
.crm-dashboard .crm-dashboard-alert {
    min-height: 8rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.5rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.055);
}

    .crm-dashboard .crm-loading-panel strong,
    .crm-dashboard .crm-loading-panel span,
    .crm-dashboard .crm-dashboard-alert strong,
    .crm-dashboard .crm-dashboard-alert span {
        display: block;
    }

    .crm-dashboard .crm-loading-panel strong,
    .crm-dashboard .crm-dashboard-alert strong {
        color: #0f172a;
        font-size: 1rem;
    }

    .crm-dashboard .crm-loading-panel span,
    .crm-dashboard .crm-dashboard-alert span {
        margin-top: 0.2rem;
        color: #64748b;
        font-size: 0.9rem;
    }

.crm-dashboard .crm-dashboard-alert {
    min-height: auto;
    color: #b91c1c;
    background: #fff7f7;
    border-color: rgba(239, 68, 68, 0.2);
}

    .crm-dashboard .crm-dashboard-alert > .material-symbols-outlined {
        font-size: 1.6rem;
    }

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

.crm-dashboard .crm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.crm-dashboard .crm-panel {
    min-width: 0;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1.35rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.055);
    overflow: hidden;
}

.crm-dashboard .crm-panel--wide {
    grid-column: span 1;
}

.crm-dashboard .crm-panel__header {
    min-height: 4.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

    .crm-dashboard .crm-panel__header h2 {
        margin: 0;
        color: #0f172a;
        font-size: 1.05rem;
        font-weight: 850;
        letter-spacing: -0.025em;
    }

    .crm-dashboard .crm-panel__header p {
        margin: 0.25rem 0 0;
        color: #64748b;
        font-size: 0.86rem;
    }

.crm-dashboard .crm-panel__link {
    color: #4f46e5;
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

    .crm-dashboard .crm-panel__link:hover {
        color: #3730a3;
        text-decoration: none;
    }

.crm-dashboard .crm-ticket-list,
.crm-dashboard .crm-opportunity-list {
    display: flex;
    flex-direction: column;
}

.crm-dashboard .crm-ticket-row,
.crm-dashboard .crm-opportunity-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    padding: 0.95rem 1.25rem;
    color: #334155;
    text-decoration: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    transition: background-color 150ms ease;
}

    .crm-dashboard .crm-ticket-row:last-child,
    .crm-dashboard .crm-opportunity-row:last-child {
        border-bottom: 0;
    }

    .crm-dashboard .crm-ticket-row:hover,
    .crm-dashboard .crm-opportunity-row:hover {
        color: #334155;
        text-decoration: none;
        background: #f8fafc;
    }

.crm-dashboard .crm-ticket-row__priority {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    display: grid;
    place-items: center;
    border-radius: 0.85rem;
}

    .crm-dashboard .crm-ticket-row__priority .material-symbols-outlined {
        font-size: 1.3rem;
    }

.crm-dashboard .crm-ticket-row__priority--urgent {
    color: #b91c1c;
    background: #fee2e2;
}

.crm-dashboard .crm-ticket-row__priority--high {
    color: #c2410c;
    background: #ffedd5;
}

.crm-dashboard .crm-ticket-row__priority--normal {
    color: #2563eb;
    background: #dbeafe;
}

.crm-dashboard .crm-ticket-row__priority--low {
    color: #64748b;
    background: #f1f5f9;
}

.crm-dashboard .crm-ticket-row__main,
.crm-dashboard .crm-opportunity-row__main {
    min-width: 0;
    flex: 1 1 auto;
}

.crm-dashboard .crm-ticket-row__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

    .crm-dashboard .crm-ticket-row__title strong,
    .crm-dashboard .crm-opportunity-row__main strong {
        min-width: 0;
        color: #0f172a;
        font-size: 0.9rem;
        font-weight: 850;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.crm-dashboard .crm-ticket-row__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 650;
}

.crm-dashboard .crm-ticket-row__separator {
    color: #cbd5e1;
}

.crm-dashboard .crm-ticket-row__due,
.crm-dashboard .crm-opportunity-row__close,
.crm-dashboard .crm-opportunity-row__value {
    flex: 0 0 auto;
    text-align: right;
}

    .crm-dashboard .crm-ticket-row__due span,
    .crm-dashboard .crm-ticket-row__due strong,
    .crm-dashboard .crm-opportunity-row__close span,
    .crm-dashboard .crm-opportunity-row__close strong,
    .crm-dashboard .crm-opportunity-row__value span,
    .crm-dashboard .crm-opportunity-row__value strong {
        display: block;
    }

    .crm-dashboard .crm-ticket-row__due span,
    .crm-dashboard .crm-opportunity-row__close span,
    .crm-dashboard .crm-opportunity-row__value span {
        color: #94a3b8;
        font-size: 0.7rem;
        font-weight: 750;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .crm-dashboard .crm-ticket-row__due strong,
    .crm-dashboard .crm-opportunity-row__close strong,
    .crm-dashboard .crm-opportunity-row__value strong {
        margin-top: 0.18rem;
        color: #334155;
        font-size: 0.8rem;
        font-weight: 800;
    }

.crm-dashboard .crm-ticket-row__arrow {
    flex: 0 0 auto;
    color: #cbd5e1;
}

.crm-dashboard .crm-text-danger {
    color: #dc2626 !important;
}

.crm-dashboard .crm-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.6rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 850;
    white-space: nowrap;
}

.crm-dashboard .crm-status-pill--danger {
    color: #b91c1c;
    background: #fee2e2;
}

.crm-dashboard .crm-action-list {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
}

    .crm-dashboard .crm-action-list a {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        padding: 0.85rem;
        color: #0f172a;
        text-decoration: none;
        border-radius: 1rem;
        background: #f8fafc;
        border: 1px solid transparent;
        transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
    }

        .crm-dashboard .crm-action-list a:hover {
            color: #0f172a;
            text-decoration: none;
            background: #ffffff;
            border-color: rgba(99, 102, 241, 0.22);
            transform: translateX(2px);
        }

        .crm-dashboard .crm-action-list a > .material-symbols-outlined {
            width: 2.45rem;
            height: 2.45rem;
            display: grid;
            place-items: center;
            color: #4f46e5;
            background: #eef2ff;
            border-radius: 0.85rem;
            font-size: 1.35rem;
        }

    .crm-dashboard .crm-action-list strong,
    .crm-dashboard .crm-action-list small {
        display: block;
    }

    .crm-dashboard .crm-action-list strong {
        font-size: 0.9rem;
        font-weight: 850;
    }

    .crm-dashboard .crm-action-list small {
        margin-top: 0.15rem;
        color: #64748b;
        font-size: 0.78rem;
        font-weight: 650;
    }

.crm-dashboard .crm-opportunity-row__main span {
    display: block;
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 650;
}

.crm-dashboard .crm-opportunity-row__stage {
    flex: 0 0 auto;
}

    .crm-dashboard .crm-opportunity-row__stage span {
        display: inline-flex;
        align-items: center;
        min-height: 1.75rem;
        padding: 0.25rem 0.65rem;
        color: #4338ca;
        background: #eef2ff;
        border-radius: 999px;
        font-size: 0.72rem;
        font-weight: 800;
        white-space: nowrap;
    }

.crm-dashboard .crm-opportunity-row__value {
    min-width: 5rem;
}

    .crm-dashboard .crm-opportunity-row__value strong {
        color: #0f172a;
        font-size: 0.9rem;
    }

.crm-dashboard .crm-workload-list {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem;
}

.crm-dashboard .crm-workload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem;
    border-radius: 0.9rem;
}

    .crm-dashboard .crm-workload-item:hover {
        background: #f8fafc;
    }

    .crm-dashboard .crm-workload-item > div {
        display: flex;
        align-items: center;
        gap: 0.65rem;
    }

    .crm-dashboard .crm-workload-item strong {
        color: #334155;
        font-size: 0.86rem;
        font-weight: 800;
    }

    .crm-dashboard .crm-workload-item > span {
        min-width: 2rem;
        color: #0f172a;
        font-size: 1rem;
        font-weight: 850;
        text-align: right;
    }

.crm-dashboard .crm-workload-dot {
    width: 0.65rem;
    height: 0.65rem;
    flex: 0 0 0.65rem;
    border-radius: 999px;
}

.crm-dashboard .crm-workload-dot--new {
    background: #3b82f6;
}

.crm-dashboard .crm-workload-dot--progress {
    background: #8b5cf6;
}

.crm-dashboard .crm-workload-dot--waiting {
    background: #f59e0b;
}

.crm-dashboard .crm-workload-dot--invoice {
    background: #10b981;
}


.crm-dashboard .crm-team-workload {
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem;
}

.crm-dashboard .crm-team-workload__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 1rem;
    transition: background-color 150ms ease;
}

    .crm-dashboard .crm-team-workload__item:hover {
        background: #f8fafc;
    }

.crm-dashboard .crm-team-workload__item--warning {
    background: #fff7ed;
}

    .crm-dashboard .crm-team-workload__item--warning:hover {
        background: #ffedd5;
    }

.crm-dashboard .crm-team-workload__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

    .crm-dashboard .crm-team-workload__user > span {
        width: 2.5rem;
        height: 2.5rem;
        flex: 0 0 2.5rem;
        display: grid;
        place-items: center;
        color: #4338ca;
        background: #eef2ff;
        border-radius: 0.85rem;
        font-size: 0.75rem;
        font-weight: 850;
    }

.crm-dashboard .crm-team-workload__item--warning .crm-team-workload__user > span {
    color: #c2410c;
    background: #ffedd5;
}

.crm-dashboard .crm-team-workload__user strong,
.crm-dashboard .crm-team-workload__user small {
    display: block;
}

.crm-dashboard .crm-team-workload__user strong {
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 850;
}

.crm-dashboard .crm-team-workload__user small {
    margin-top: 0.15rem;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 650;
}

.crm-dashboard .crm-team-workload__count {
    min-width: 2.25rem;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 850;
    text-align: right;
}

.crm-dashboard .crm-empty-state {
    min-height: 9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.crm-dashboard .crm-empty-state--compact {
    min-height: 9rem;
}

.crm-dashboard .crm-empty-state > .material-symbols-outlined {
    margin-bottom: 0.65rem;
    color: #94a3b8;
    font-size: 2rem;
}

.crm-dashboard .crm-empty-state strong {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 850;
}

.crm-dashboard .crm-empty-state p {
    margin: 0.3rem 0 0;
    color: #64748b;
    font-size: 0.88rem;
}



.crm-dashboard .crm-panel--full {
    grid-column: 1 / -1;
}

.crm-dashboard .crm-admin-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 1rem 1.25rem 0;
    padding: 0.85rem 1rem;
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 1rem;
    font-size: 0.82rem;
    font-weight: 700;
}

    .crm-dashboard .crm-admin-warning .material-symbols-outlined {
        flex: 0 0 auto;
        font-size: 1.2rem;
    }

.crm-dashboard .crm-admin-system-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    padding: 1rem 1.25rem;
}


.crm-dashboard .crm-admin-system-grid--single {
    grid-template-columns: minmax(18rem, 26rem);
}

.crm-dashboard .crm-admin-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0 1.25rem 1.25rem;
}

    .crm-dashboard .crm-admin-actions a {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 2.35rem;
        padding: 0.45rem 0.75rem;
        color: #475569;
        background: #ffffff;
        border: 1px solid rgba(148, 163, 184, 0.25);
        border-radius: 0.8rem;
        font-size: 0.78rem;
        font-weight: 800;
        text-decoration: none;
    }

        .crm-dashboard .crm-admin-actions a:hover {
            color: #4f46e5;
            border-color: rgba(99, 102, 241, 0.3);
            text-decoration: none;
        }

    .crm-dashboard .crm-admin-actions .material-symbols-outlined {
        font-size: 1.1rem;
    }

@media (max-width: 1199.98px) {
    .crm-dashboard .crm-admin-system-grid {
        grid-template-columns: 1fr;
    }

    .crm-dashboard .crm-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-dashboard .crm-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .crm-dashboard .crm-admin-system-grid {
        padding: 0.85rem;
    }

    .crm-dashboard .crm-admin-actions {
        align-items: stretch;
        flex-direction: column;
        padding: 0 0.85rem 0.85rem;
    }

        .crm-dashboard .crm-admin-actions a {
            justify-content: center;
        }

    .crm-dashboard {
        gap: 1rem;
    }

    .crm-dashboard .crm-dashboard-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 1.1rem;
    }

    .crm-dashboard .crm-dashboard-hero__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .crm-dashboard .crm-btn {
        justify-content: center;
        width: 100%;
    }

    .crm-dashboard .crm-stat-grid {
        grid-template-columns: 1fr;
    }

    .crm-dashboard .crm-panel__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-dashboard .crm-ticket-row,
    .crm-dashboard .crm-opportunity-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .crm-dashboard .crm-ticket-row__main,
    .crm-dashboard .crm-opportunity-row__main {
        min-width: calc(100% - 3.5rem);
    }

    .crm-dashboard .crm-ticket-row__due,
    .crm-dashboard .crm-opportunity-row__close,
    .crm-dashboard .crm-opportunity-row__value {
        margin-left: 3.4rem;
        text-align: left;
    }

    .crm-dashboard .crm-opportunity-row__stage {
        margin-left: 3.4rem;
    }

    .crm-dashboard .crm-ticket-row__arrow {
        display: none;
    }
}

.crm-dashboard .crm-panel--actions .crm-action-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1.25rem;
}

.crm-dashboard .crm-panel--actions .crm-action-list a {
    min-width: 0;
    align-items: flex-start;
}

.crm-dashboard .crm-panel--actions .crm-action-list a > .material-symbols-outlined {
    flex-shrink: 0;
}

.crm-dashboard .crm-ticket-row__meta {
    flex-wrap: wrap;
}

@media (max-width: 1199.98px) {
    .crm-dashboard .crm-panel--actions .crm-action-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .crm-dashboard .crm-panel--actions .crm-action-list {
        grid-template-columns: 1fr;
        padding: 0.85rem;
    }
}
