:root {
    color-scheme: light;
    --ink: #222;
    --muted: #667085;
    --line: #d8dee6;
    --panel: #fff;
    --bg: #f5f7fa;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

a {
    color: var(--accent-dark);
}

.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 64px;
    padding: 12px 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nav a {
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
}

.nav-user {
    display: inline-flex;
    align-items: center;
    padding: 8px 4px;
    color: var(--muted);
    font-size: 13px;
}

.nav a.active,
.nav a:hover {
    background: #e7f5f2;
    color: var(--accent-dark);
}

.page {
    width: min(1280px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

h2 {
    margin: 0 0 14px;
    font-size: 19px;
}

.subtle {
    color: var(--muted);
    margin: 0;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 18px;
}

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

.field {
    grid-column: span 3;
}

.field.wide {
    grid-column: span 6;
}

.field.full {
    grid-column: 1 / -1;
}

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

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}

input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin-right: 6px;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 14px;
}

.actions input,
.actions select {
    width: auto;
    min-width: 150px;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 14px;
    color: #fff;
    background: var(--accent);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary {
    color: var(--accent-dark);
    background: #fff;
}

.button.danger,
button.danger {
    border-color: var(--danger);
    background: var(--danger);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    font-size: 13px;
}

.number {
    text-align: right;
}

.notice {
    padding: 12px 14px;
    border: 1px solid #9ed8cf;
    border-radius: 8px;
    background: #effbf8;
    margin-bottom: 16px;
}

.error {
    border-color: #f0a7a0;
    background: #fff1f0;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tabs a {
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    text-decoration: none;
}

.tabs a.active {
    border-color: var(--accent);
    color: var(--accent-dark);
    background: #e7f5f2;
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    width: 100%;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    margin: 0 auto;
}

.login-card h1 {
    margin-bottom: 18px;
}

.login-card .field,
.login-card .field.full {
    width: 100%;
    grid-column: auto;
    margin-bottom: 14px;
}

.login-card .actions {
    justify-content: space-between;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.stat strong {
    display: block;
    font-size: 24px;
    margin-top: 4px;
}

.inline-form {
    display: inline;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
    background: rgb(15 23 42 / 0.46);
    overflow-y: auto;
    z-index: 20;
}

.modal.open {
    display: flex;
}

.modal-panel {
    width: min(980px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 24px 60px rgb(15 23 42 / 0.24);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-head h2 {
    margin: 0;
}

.icon-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    border-color: var(--line);
    color: var(--ink);
    background: #fff;
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 900px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .field,
    .field.wide {
        grid-column: 1 / -1;
    }

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

@media (max-width: 560px) {
    .page {
        width: min(100% - 20px, 1280px);
    }

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

    .modal {
        padding: 12px;
    }
}
