* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #172033;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 255px;
    background: #101d35;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 20px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 25px;
}

.brand-logo {
    background: white;
    color: #101d35;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.brand-title {
    font-weight: 700;
    font-size: 17px;
}

.brand-subtitle {
    font-size: 11px;
    color: #9aa7be;
    margin-top: 3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section {
    color: #718099;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 22px 12px 8px;
}

.nav-item {
    color: #bbc5d6;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover,
.nav-item.active {
    background: #213456;
    color: white;
}

.connections {
    margin-top: 30px;
    border-top: 1px solid #2a3953;
    padding-top: 16px;
}

.connection {
    font-size: 11px;
    color: #c6cedc;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px;
}

.connection span:last-child {
    margin-left: auto;
    color: #7fd7a6;
}

.connection.warning span:last-child {
    color: #ffc75a;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #29c87c;
    border-radius: 50%;
}

.connection.warning .status-dot {
    background: #ffc75a;
}

.main-content {
    margin-left: 255px;
    width: calc(100% - 255px);
    padding: 26px 30px 40px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.topbar h1 {
    margin: 0;
    font-size: 26px;
}

.topbar p {
    margin: 6px 0 0;
    color: #758095;
    font-size: 13px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search {
    width: 310px;
    padding: 11px 14px;
    border: 1px solid #dce2eb;
    border-radius: 8px;
    background: white;
    outline: none;
}

.notification {
    border: 1px solid #dce2eb;
    background: white;
    border-radius: 8px;
    height: 40px;
    width: 42px;
    cursor: pointer;
}

.user-profile {
    display: flex;
    gap: 9px;
    align-items: center;
}

.user-profile small {
    display: block;
    color: #8490a3;
    margin-top: 2px;
}

.avatar {
    width: 38px;
    height: 38px;
    background: #1b3765;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.kpi-card {
    background: white;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    padding: 17px;
}

.kpi-card.highlighted {
    border-left: 4px solid #355ea8;
}

.kpi-label {
    color: #748095;
    font-size: 12px;
}

.kpi-value {
    font-weight: 700;
    font-size: 21px;
    margin: 9px 0;
}

.kpi-footer {
    font-size: 11px;
    color: #8893a4;
}

.danger {
    color: #d14747;
}

.warning-text {
    color: #d98715;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    background: white;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    padding: 18px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
}

.panel-header p {
    margin: 5px 0 0;
    font-size: 11px;
    color: #8b96a7;
}

.small-button {
    border: 1px solid #d7deea;
    background: white;
    padding: 7px 11px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
}

.chart-area {
    height: 240px;
}

.donut-area {
    height: 240px;
    display: flex;
    justify-content: center;
}

.action-panel {
    margin-bottom: 18px;
}

.action-count {
    background: #fff1df;
    color: #c4770c;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 11px;
}

.action-row {
    border-top: 1px solid #edf0f4;
    padding: 13px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-row:first-child {
    border-top: 0;
}

.action-row strong {
    display: block;
    font-size: 13px;
}

.action-row span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #7f8a9d;
}

.action-row.urgent {
    border-left: 3px solid #d64a4a;
    padding-left: 12px;
}

.action-buttons {
    display: flex;
    gap: 7px;
}

.action-buttons button {
    background: #1d4174;
    color: white;
    border: 0;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 11px;
    cursor: pointer;
}

.action-buttons .outline {
    background: white;
    color: #435067;
    border: 1px solid #d7dce5;
}

.table-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 10px;
    color: #8a96a8;
    padding: 10px 8px;
    border-bottom: 1px solid #e7ebf0;
}

td {
    font-size: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid #eef1f5;
}

.badge {
    font-size: 10px;
    padding: 5px 8px;
    border-radius: 12px;
}

.badge.overdue {
    background: #fdeaea;
    color: #c43d3d;
}

.badge.pending {
    background: #fff2dd;
    color: #bd7910;
}

.badge.paid {
    background: #e4f7ed;
    color: #238653;
}

.weekly-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.weekly-grid div {
    background: #f7f9fc;
    border-radius: 8px;
    padding: 14px;
}

.weekly-grid span {
    font-size: 11px;
    color: #7d899c;
    display: block;
}

.weekly-grid strong {
    display: block;
    margin-top: 7px;
    font-size: 20px;
}

footer {
    color: #9aa3b2;
    text-align: center;
    font-size: 11px;
    padding-top: 25px;
}

@media (max-width: 1250px) {

    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .dashboard-grid .large {
        grid-column: span 2;
    }

    .weekly-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 850px) {

    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
    }

    .top-actions {
        width: 100%;
    }

    .search {
        flex: 1;
    }

    .kpi-grid,
    .dashboard-grid,
    .table-grid,
    .weekly-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid .large {
        grid-column: auto;
    }
}