* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 16px system-ui, sans-serif;
    background: #f6f7f9;
    color: #202124;
}

header,
main {
    max-width: 1050px;
    margin: auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 16px;
}

h1 {
    margin: 0;
    font-size: 1.6rem;
}

main {
    padding: 0 16px 40px;
}

section,
.login-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.metric-card {
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.metric-card small {
    color: #666;
}

.primary,
.secondary,
button {
    border: 0;
    border-radius: 9px;
    padding: 9px 13px;
    cursor: pointer;
}

.primary,
button {
    background: #2563eb;
    color: white;
}

.secondary {
    background: #e9eef8;
    color: #202124;
    text-decoration: none;
}

.segmented,
.toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 10px 0;
}

.segmented button {
    background: #e9eef8;
    color: #222;
}

.segmented button.active {
    background: #2563eb;
    color: #fff;
}

.toggles label {
    border: 1px solid #ddd;
    border-radius: 9px;
    padding: 7px 10px;
}

.chart-wrap {
    height: 360px;
    margin: 12px 0;
}

.chart-wrap canvas {
    width: 100%;
    height: 100%;
}

.table-wrap {
    overflow: auto;
}

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

th,
td {
    text-align: left;
    border-bottom: 1px solid #eee;
    padding: 8px;
}

.del {
    background: #eee;
    color: #900;
}

.logout {
    color: #444;
}

dialog {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 60px #0004;
    max-width: 430px;
    width: calc(100% - 30px);
}

dialog form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 5px;
}

input,
select,
textarea {
    font: inherit;
    padding: 9px;
    border: 1px solid #bbb;
    border-radius: 8px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-card {
    width: min(380px, calc(100% - 30px));
    display: grid;
    gap: 14px;
}

.error {
    color: #b00020;
}

@media (max-width: 600px) {
    .chart-wrap {
        height: 280px;
    }

    th:nth-child(4),
    td:nth-child(4),
    th:nth-child(5),
    td:nth-child(5) {
        display: none;
    }
}

