:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #18202f;
    --muted: #667085;
    --line: #d9deea;
    --primary: #3057d5;
    --primary-dark: #203d9a;
    --danger: #b42318;
    --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a { color: inherit; }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header, .admin-header {
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}
.header-inner, .admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
}
.admin-header { padding: 16px 24px; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav a, .nav-form button {
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
}
.nav-form { margin: 0; }
.nav-form button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}
.nav a:hover, .nav a.active, .nav-form button:hover { color: var(--primary); background: #edf1ff; }
.content, .admin-main { padding: 56px 0; }
.content h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.04; margin: 0 0 20px; }
.content h2 { font-size: 30px; margin-top: 40px; }
.content p { max-width: 760px; }
.content .lead { font-size: 20px; color: var(--muted); }
.grid, .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin: 28px 0;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .06);
}
.card h2, .card h3 { margin-top: 0; }
.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: var(--primary-dark); }
.button.secondary { background: #eef2f7; color: var(--text); }
.button.small { padding: 6px 10px; font-size: 14px; }
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 0;
    color: var(--muted);
}
.admin-body { background: #f3f5f9; }
.admin-main h1 { margin-top: 0; }
.notice {
    padding: 14px 16px;
    background: #ecfdf3;
    border: 1px solid #abefc6;
    border-radius: 14px;
    margin-bottom: 18px;
}
.notice.warning {
    background: #fffaeb;
    border-color: #fedf89;
}
.form {
    display: grid;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}
.form.narrow { max-width: 460px; }
label { display: grid; gap: 6px; font-weight: 700; }
input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafc; }
.toolbar { margin: 0 0 18px; display: flex; gap: 12px; align-items: center; }
.muted { color: var(--muted); }
code { background: #eef2f7; border-radius: 8px; padding: 2px 6px; }

@media (max-width: 760px) {
    .header-inner, .admin-header, .footer-inner { align-items: flex-start; flex-direction: column; }
    .content, .admin-main { padding: 32px 0; }
}
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
.checkbox {
    display: flex;
    grid-template-columns: none;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
.checkbox input { width: auto; }
.hidden-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.actions-cell form { margin: 0; }
.button.danger, button.button.danger { background: var(--danger); }
.admin-nav { max-width: 980px; justify-content: flex-end; }
.admin-nav a { font-size: 14px; }
@media print {
    .site-header, .site-footer, .admin-header, .button { display: none !important; }
    body { background: #fff; color: #000; }
    .content, .admin-main { padding: 0; }
}
