:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9dee7;
    --primary: #126c6f;
    --primary-dark: #0d5154;
    --danger: #b42318;
    --success: #157347;
    --warning-bg: #fff7da;
    --success-bg: #e8f6ee;
    --error-bg: #fde8e7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

nav a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
}

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

.section,
.auth-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 20px;
}

.auth-panel {
    width: min(420px, 100%);
    margin: 70px auto;
}

h1,
h2 {
    margin: 0 0 18px;
}

h1 {
    font-size: 1.55rem;
}

h2 {
    font-size: 1.15rem;
}

.form {
    display: grid;
    gap: 14px;
}

.report-form {
    grid-template-columns: minmax(0, 720px);
    align-items: start;
}

.wide {
    grid-column: span 1;
}

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

label {
    display: grid;
    gap: 6px;
    font-weight: 650;
}

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

textarea {
    resize: vertical;
}

.checkbox {
    grid-template-columns: 18px 1fr;
    align-items: center;
    font-weight: 600;
}

.checkbox input {
    width: 18px;
    height: 18px;
}

.actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 12px;
    font: inherit;
    font-weight: 700;
    color: var(--text);
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    min-height: 38px;
}

.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.small {
    min-height: 32px;
    padding: 6px 9px;
    font-size: .9rem;
}

.button.subtle {
    background: #eef2f6;
}

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

.button.success {
    color: white;
    background: var(--success);
    border-color: var(--success);
}

.inline-form,
.row-actions form {
    display: inline-flex;
    margin: 0;
}

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

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

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

th {
    color: var(--muted);
    font-size: .86rem;
    text-transform: uppercase;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 24px;
}

.pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 8px;
    font-weight: 700;
    font-size: .85rem;
}

.pill.yes {
    background: var(--warning-bg);
    color: #8a5a00;
}

.pill.no {
    background: #eef2f6;
    color: var(--muted);
}

.flash {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
}

.flash.success {
    background: var(--success-bg);
}

.flash.error {
    background: var(--error-bg);
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 20px;
}

.hash {
    max-width: 260px;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
}

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

    .page {
        width: min(100% - 20px, 1180px);
        margin-top: 12px;
    }

    .section,
    .auth-panel {
        padding: 16px;
    }

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

    .wide {
        grid-column: span 1;
    }
}
