:root {
    color-scheme: light;
    --ink: #18181b;
    --muted: #71717a;
    --line: #e4e4e7;
    --surface: #ffffff;
    --background: #f5f5f4;
    --primary: #18181b;
    --primary-dark: #000000;
    --accent: #f4f4f5;
    --danger: #b42318;
    --shadow: 0 18px 50px rgba(24, 24, 27, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: linear-gradient(145deg, #fafaf9 0%, var(--background) 52%, #e7e5e4 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.site-header {
    color: #ffffff;
    background: rgba(9, 9, 11, 0.97);
    border-bottom: 3px solid #a8a29e;
}

.header-inner {
    width: min(1120px, calc(100% - 32px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
}

.brand:hover {
    color: #ffffff;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #18181b;
    background: #fafaf9;
    border-radius: 11px;
    font-size: 0.75rem;
}

.main-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
}

.main-nav a,
.nav-button {
    color: #e7e5e4;
    font-size: 0.92rem;
}

.nav-form {
    margin: 0;
}

.nav-button {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.nav-button:hover {
    color: #ffffff;
    background: transparent;
    transform: none;
    text-decoration: underline;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 42px auto;
}

.content-card {
    padding: clamp(24px, 4vw, 46px);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(228, 228, 231, 0.95);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

h1,
h2,
h3 {
    line-height: 1.2;
    letter-spacing: -0.025em;
}

h1 {
    margin-top: 0;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h2 {
    margin-top: 2rem;
    font-size: 1.35rem;
}

p {
    max-width: 78ch;
}

form:not(.nav-form) {
    max-width: 760px;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    color: var(--ink);
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 9px;
    font: inherit;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(24, 24, 27, 0.16);
    border-color: var(--primary);
}

textarea[readonly],
pre {
    color: #f5f5f4;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 10px;
    font-family: "Cascadia Code", Consolas, monospace;
}

pre {
    padding: 16px;
    overflow-x: auto;
}

.helptext {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.86rem;
}

.errorlist {
    padding-left: 20px;
    color: var(--danger);
    font-weight: 650;
}

button,
input[type="submit"],
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 4px 8px 4px 0;
    padding: 10px 16px;
    color: #ffffff;
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: 9px;
    box-shadow: 0 5px 14px rgba(24, 24, 27, 0.18);
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    transition: 150ms ease;
}

button:hover,
input[type="submit"]:hover,
.button-link:hover {
    color: #ffffff;
    background: var(--primary-dark);
    transform: translateY(-1px);
    text-decoration: none;
}

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

.action-bar {
    margin: 18px 0 24px;
}

.button-link {
    margin: 0;
}

.button-link--secondary {
    color: #27272a;
    background: #f4f4f5;
    border-color: #d4d4d8;
    box-shadow: none;
}

.button-link--secondary:hover {
    color: #18181b;
    background: #e4e4e7;
}

.button-link--danger {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
    box-shadow: none;
}

.button-link--danger:hover {
    color: #ffffff;
    background: #991b1b;
}

.button-link--small,
.table-actions button {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
}

.table-actions form {
    margin: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #52525b;
    font-size: 0.9rem;
}

.back-link::before {
    content: "←";
}

table {
    display: block;
    width: 100%;
    margin: 20px 0;
    overflow-x: auto;
    border-collapse: collapse;
    white-space: nowrap;
}

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

th {
    color: #3f3f46;
    background: #f4f4f5;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #fafafa;
}

td a + a {
    margin-left: 12px;
}

.messages {
    margin-bottom: 18px;
}

.message {
    max-width: none;
    margin: 8px 0;
    padding: 12px 16px;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-weight: 650;
}

.message.error {
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fecaca;
}

.site-footer {
    padding: 0 16px 30px;
    color: var(--muted);
    text-align: center;
    font-size: 0.85rem;
}

@media (max-width: 760px) {
    .header-inner {
        padding: 14px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .main-nav {
        width: 100%;
    }

    .page-shell {
        width: min(100% - 20px, 1120px);
        margin: 20px auto;
    }

    .content-card {
        padding: 22px 16px;
        border-radius: 14px;
    }

    button,
    input[type="submit"],
    .button-link {
        min-height: 44px;
    }

    .action-bar,
    .table-actions {
        align-items: stretch;
    }
}
