* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #1f2933;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: #1f6feb;
}

.app-header {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d9e2ec;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 20px max(24px, calc((100vw - 1180px) / 2));
}

.app-header h1,
.login-card h1 {
    font-size: 24px;
    margin: 0;
}

.app-header p {
    color: #52606d;
    margin: 4px 0 0;
}

.container {
    margin: 0 auto;
    max-width: 1180px;
    padding: 24px;
}

.panel,
.login-card {
    background: #ffffff;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    margin-bottom: 24px;
    padding: 24px;
}

.panel h2,
.login-card h2 {
    font-size: 20px;
    margin: 0 0 18px;
}

.login-page {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    margin: 0 auto;
    max-width: 420px;
    width: 100%;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select {
    background: #ffffff;
    border: 1px solid #bcccdc;
    border-radius: 6px;
    color: #1f2933;
    font: inherit;
    min-height: 42px;
    padding: 8px 10px;
    width: 100%;
}

form > label {
    margin-top: 14px;
}

.form-grid,
.filters {
    align-items: end;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.filters {
    grid-template-columns: minmax(220px, 1fr) minmax(260px, 1fr) auto;
    margin-bottom: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
}

.button {
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 700;
    min-height: 42px;
    padding: 10px 14px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.button-primary {
    background: #1976d2;
    color: #ffffff;
}

.button-secondary {
    background: #e4e7eb;
    color: #1f2933;
}

.button-danger {
    background: #c62828;
    color: #ffffff;
}

.alert {
    border-radius: 6px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert-error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #8a1c1c;
}

.alert-success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
}

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

table {
    border-collapse: collapse;
    min-width: 900px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid #d9e2ec;
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f0f4f8;
    font-size: 14px;
}

td form {
    margin: 0;
}

.empty {
    color: #52606d;
    text-align: center;
}

.modal-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, 0.58);
    display: none;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 1000;
}

.modal-backdrop.is-visible {
    display: flex;
}

.modal {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
    max-width: 420px;
    padding: 28px;
    text-align: center;
    width: 100%;
}

.modal h2 {
    font-size: 20px;
    margin: 14px 0 8px;
}

.modal p {
    color: #52606d;
    margin: 0;
}

.modal-danger {
    text-align: left;
}

.modal-danger h2 {
    color: #8a1c1c;
    margin-top: 0;
}

.confirm-check {
    align-items: flex-start;
    background: #fff5f5;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    font-weight: 700;
    margin: 18px 0;
    padding: 12px;
}

.confirm-check input {
    flex: 0 0 auto;
    margin-top: 3px;
    min-height: auto;
    width: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.spinner {
    animation: spin 0.9s linear infinite;
    border: 4px solid #d9e2ec;
    border-top-color: #1976d2;
    border-radius: 50%;
    height: 42px;
    margin: 0 auto;
    width: 42px;
}

button:disabled {
    cursor: wait;
    opacity: 0.75;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 820px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid,
    .filters {
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }
}
