﻿.dashboard-page {
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    padding-bottom: 48px;
    color: #0f172a;
}

/* HEADER */

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.dashboard-heading {
    min-width: 0;
}

.brand-line {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .15em;
}

.brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, .10);
}

.dashboard-heading h1 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(30px, 3vw, 44px);
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: -.045em;
}

.dashboard-heading p {
    max-width: 680px;
    margin: 12px 0 0;
    color: #64748b;
    font-size: 15px;
    line-height: 1.7;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 13px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 850;
    white-space: nowrap;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

    .action-btn:hover {
        transform: translateY(-2px);
    }

.primary-action {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 14px 28px rgba(37, 99, 235, .25);
}

.secondary-action {
    color: #334155;
    background: #fff;
    border-color: #dbe4ef;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

/* LOADING AND ERROR */

.dashboard-loading,
.dashboard-error {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 120px;
    padding: 25px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .07);
}

    .dashboard-loading strong,
    .dashboard-error strong {
        display: block;
        margin-bottom: 5px;
        color: #0f172a;
        font-size: 16px;
    }

    .dashboard-loading span,
    .dashboard-error p {
        margin: 0;
        color: #64748b;
        font-size: 14px;
    }

.loader-ring {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: dashboard-spin .85s linear infinite;
}

@keyframes dashboard-spin {
    to {
        transform: rotate(360deg);
    }
}

.dashboard-error {
    border-color: #fecaca;
    background: #fffafa;
}

.error-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: #dc2626;
    font-size: 22px;
    font-weight: 900;
}

.retry-btn {
    min-height: 42px;
    margin-left: auto;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: #dc2626;
    font-weight: 800;
    cursor: pointer;
}

/* KPI CARDS */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    display: block;
    min-width: 0;
    padding: 21px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    color: inherit;
    background: #fff;
    text-decoration: none;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .065);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

    .stat-card::before {
        content: "";
        position: absolute;
        top: -65px;
        right: -50px;
        width: 145px;
        height: 145px;
        border-radius: 50%;
        opacity: .12;
    }

.companies-card::before {
    background: #2563eb;
}

.licenses-card::before {
    background: #d97706;
}

.pending-card::before {
    background: #7c3aed;
}

.devices-card::before {
    background: #059669;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: #cbd5e1;
    box-shadow: 0 22px 44px rgba(15, 23, 42, .11);
}

.stat-card-top,
.stat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-icon {
    display: grid;
    width: 45px;
    height: 45px;
    place-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    font-size: 21px;
}

.stat-state {
    position: relative;
    z-index: 1;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
}

    .stat-state.positive {
        color: #047857;
        background: #d1fae5;
    }

    .stat-state.warning {
        color: #92400e;
        background: #fef3c7;
    }

    .stat-state.critical {
        color: #b91c1c;
        background: #fee2e2;
    }

.stat-value {
    margin-top: 25px;
    color: #0f172a;
    font-size: 37px;
    line-height: 1;
    font-weight: 950;
    letter-spacing: -.055em;
}

.stat-title {
    margin-top: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 850;
}

.stat-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
}

.stat-arrow {
    color: #2563eb;
    font-size: 18px;
}

/* SYSTEM HEALTH */

.health-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 22px;
    padding: 19px 22px;
    border: 1px solid #dbe4ef;
    border-radius: 18px;
    background: radial-gradient(circle at right, rgba(37, 99, 235, .08), transparent 34%), #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
}

.health-main {
    display: flex;
    align-items: center;
    gap: 13px;
}

.health-icon {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    place-items: center;
    border-radius: 13px;
    color: #047857;
    background: #d1fae5;
    font-size: 20px;
    font-weight: 950;
}

.health-label {
    display: block;
    margin-bottom: 3px;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.health-main strong {
    color: #0f172a;
    font-size: 14px;
}

.health-items {
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-item {
    min-width: 140px;
    padding: 8px 15px;
    border-left: 1px solid #e2e8f0;
}

    .health-item span {
        display: block;
        color: #64748b;
        font-size: 11px;
    }

    .health-item strong {
        display: block;
        margin-top: 2px;
        color: #0f172a;
        font-size: 18px;
    }

.danger-text {
    color: #dc2626 !important;
}

.warning-text {
    color: #d97706 !important;
}

/* CONTENT PANELS */

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
    gap: 20px;
}

.dashboard-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .065);
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 23px;
    border-bottom: 1px solid #edf2f7;
}

.panel-kicker {
    display: block;
    margin-bottom: 5px;
    color: #2563eb;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: .13em;
}

.panel-header h2,
.section-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 19px;
    font-weight: 900;
    letter-spacing: -.025em;
}

.panel-header p {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2563eb;
    text-decoration: none;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

/* TABLE */

.table-container {
    width: 100%;
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

    .dashboard-table th {
        padding: 13px 17px;
        color: #64748b;
        background: #f8fafc;
        text-align: left;
        font-size: 10px;
        font-weight: 900;
        letter-spacing: .07em;
        text-transform: uppercase;
    }

    .dashboard-table td {
        padding: 15px 17px;
        border-top: 1px solid #f1f5f9;
        color: #334155;
        font-size: 13px;
    }

    .dashboard-table tbody tr {
        transition: background .15s ease;
    }

        .dashboard-table tbody tr:hover {
            background: #fafcff;
        }

.company-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 170px;
}

.company-avatar {
    display: grid;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    place-items: center;
    border-radius: 11px;
    color: #1d4ed8;
    background: #dbeafe;
    font-size: 11px;
    font-weight: 950;
}

.company-cell strong,
.date-cell strong {
    color: #0f172a;
    font-size: 12px;
}

.plan-name {
    color: #475569;
    font-weight: 750;
}

.date-cell span {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 10px;
}

/* BADGES */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.success {
    color: #047857;
    background: #d1fae5;
}

.status-badge.warning {
    color: #92400e;
    background: #fef3c7;
}

.status-badge.danger {
    color: #b91c1c;
    background: #fee2e2;
}

/* DEVICES */

.device-list {
    padding: 7px 17px 17px;
}

.device-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 5px;
    border-bottom: 1px solid #f1f5f9;
    color: inherit;
    text-decoration: none;
}

    .device-row:last-child {
        border-bottom: 0;
    }

    .device-row:hover .device-information strong {
        color: #2563eb;
    }

.device-avatar {
    display: grid;
    width: 41px;
    height: 41px;
    flex: 0 0 41px;
    place-items: center;
    border-radius: 13px;
    background: #eef2ff;
    font-size: 18px;
}

.device-information {
    min-width: 0;
    flex: 1;
}

    .device-information strong,
    .device-information span,
    .device-information small {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .device-information strong {
        color: #0f172a;
        font-size: 12px;
        transition: color .15s ease;
    }

    .device-information span {
        margin-top: 3px;
        color: #64748b;
        font-size: 11px;
    }

    .device-information small {
        margin-top: 3px;
        color: #94a3b8;
        font-size: 9px;
    }

.device-status-block {
    text-align: right;
}

    .device-status-block small {
        display: block;
        margin-top: 5px;
        color: #94a3b8;
        font-size: 9px;
    }

/* EMPTY */

.empty-state {
    display: flex;
    min-height: 190px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 13px;
    place-items: center;
    border-radius: 15px;
    color: #047857;
    background: #d1fae5;
    font-size: 20px;
    font-weight: 950;
}

.empty-state strong {
    color: #0f172a;
    font-size: 14px;
}

.empty-state span {
    max-width: 320px;
    margin-top: 6px;
    color: #94a3b8;
    font-size: 11px;
}

/* QUICK ACTIONS */

.quick-actions-section {
    margin-top: 22px;
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .055);
}

.section-heading {
    margin-bottom: 17px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
}

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 15px;
    color: inherit;
    background: #f8fafc;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

    .quick-action-card:hover {
        transform: translateY(-2px);
        border-color: #bfdbfe;
        background: #f8fbff;
    }

.quick-action-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 6px 15px rgba(15, 23, 42, .07);
    font-size: 18px;
}

.quick-action-card div {
    min-width: 0;
    flex: 1;
}

    .quick-action-card strong,
    .quick-action-card div span {
        display: block;
    }

.quick-action-card strong {
    color: #0f172a;
    font-size: 12px;
}

.quick-action-card div span {
    margin-top: 3px;
    overflow: hidden;
    color: #64748b;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-action-arrow {
    color: #2563eb;
    font-size: 18px;
}

/* RESPONSIVE */

@media (max-width: 1250px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-header {
        flex-direction: column;
    }

    .health-strip {
        align-items: flex-start;
        flex-direction: column;
    }

    .health-items {
        width: 100%;
    }

    .health-item {
        min-width: 0;
        flex: 1;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .dashboard-header {
        margin-bottom: 22px;
    }

    .dashboard-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .health-items {
        align-items: stretch;
        flex-direction: column;
    }

    .health-item {
        padding-left: 0;
        border-top: 1px solid #e2e8f0;
        border-left: 0;
    }

    .panel-header {
        flex-direction: column;
    }

    .device-status-block {
        display: none;
    }
}
