:root {
    color-scheme: light;
    --bg: #f7f8fb;
    --surface: #ffffff;
    --ink: #1d2430;
    --muted: #5f6b7a;
    --line: #d9e0ea;
    --brand: #b2172f;
    --brand-dark: #871125;
    --focus: #265fbb;
    --ok: #126a3a;
    --bad: #9f1d20;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

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

.intro {
    margin-bottom: 28px;
}

.site-header {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: flex-start;
    margin-bottom: 28px;
}

.site-header a {
    display: inline-flex;
}

.site-header img {
    display: block;
    width: min(150px, 32vw);
    height: auto;
}

.site-header .intro {
    margin-bottom: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1,
h2 {
    margin: 0 0 12px;
    line-height: 1.15;
}

h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
}

h2 {
    font-size: 1.4rem;
}

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

.form-panel,
.table-shell,
.login-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 16px 38px rgba(20, 31, 48, 0.08);
}

.hint {
    font-size: 0.95rem;
}

form {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

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

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

label span {
    color: var(--ink);
}

.required-star {
    color: var(--brand);
}

input,
select,
button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    font: inherit;
}

input,
select {
    border: 1px solid var(--line);
    padding: 11px 12px;
    color: var(--ink);
    background: #fff;
}

input:focus,
select:focus {
    outline: 3px solid rgba(38, 95, 187, 0.22);
    border-color: var(--focus);
}

button {
    border: 0;
    padding: 12px 18px;
    color: #fff;
    background: var(--brand);
    font-weight: 700;
    cursor: pointer;
}

button:hover,
button:focus {
    background: var(--brand-dark);
}

button.secondary {
    color: var(--brand);
    background: #fff;
    border: 1px solid var(--brand);
}

.checkbox {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: start;
    font-weight: 400;
}

.checkbox input {
    width: 20px;
    min-height: 20px;
    margin-top: 2px;
}

em,
.block-error {
    color: var(--bad);
    font-style: normal;
    font-weight: 700;
    font-size: 0.92rem;
}

.notice {
    margin-top: 18px;
    border-radius: 8px;
    padding: 14px 16px;
    font-weight: 700;
}

.notice.success {
    color: var(--ok);
    background: #e8f5ee;
}

.notice.error {
    color: var(--bad);
    background: #fdebed;
}

.hp {
    position: absolute;
    left: -9999px;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-toolbar form {
    margin: 0;
}

.admin-search {
    margin-bottom: 18px;
}

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

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

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

th {
    color: #fff;
    background: #243142;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.filter-row th {
    background: #eef3f8;
    cursor: default;
    padding: 8px;
}

.filter-row input,
.filter-row select {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 0.92rem;
}

tbody tr:hover {
    background: #f3f6fa;
}

td[data-field] {
    cursor: cell;
}

td.editing {
    padding: 6px;
}

td.editing input,
td.editing select {
    min-height: 38px;
}

td.saving {
    opacity: 0.55;
}

td.save-error {
    outline: 2px solid var(--bad);
}

.actions-head,
.row-actions {
    text-align: right;
    white-space: nowrap;
}

.delete-row {
    width: auto;
    min-height: 36px;
    padding: 7px 10px;
    color: var(--bad);
    background: #fff;
    border: 1px solid var(--bad);
    font-size: 0.92rem;
}

.delete-row:hover,
.delete-row:focus {
    color: #fff;
    background: var(--bad);
}

.delete-row:disabled {
    opacity: 0.6;
    cursor: wait;
}

a {
    color: var(--focus);
}

@media (max-width: 720px) {
    .page {
        width: min(100% - 24px, 1080px);
        padding: 28px 0;
    }

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

    .form-panel,
    .table-shell,
    .login-panel {
        padding: 20px;
    }

    .admin-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
}
