:root {
    color-scheme: light;
    --ink: #18202a;
    --muted: #607080;
    --line: #d8dee5;
    --bg: #f5f7f9;
    --panel: #ffffff;
    --accent: #167a76;
    --accent-dark: #0e5c59;
    --danger: #b42318;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 64px;
    padding: 0 32px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); }
nav { display: flex; gap: 18px; flex-wrap: wrap; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 32px auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
h1, h2 { margin: 0 0 12px; line-height: 1.2; }
p { color: var(--muted); }

.panel, .auth-panel, .table-wrap, .notice, .flash {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 22px;
}
.auth-panel { max-width: 440px; margin: 60px auto; }
.flash, .notice { border-color: #9ac9c6; background: #eef8f7; }
.error { color: var(--danger); }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 26px; }
.stats article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.stats strong { display: block; font-size: 28px; }
.stats span { color: var(--muted); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
label { display: grid; gap: 7px; font-weight: 600; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; }
input, textarea, select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.button.secondary { background: #2f3b46; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 14px; }
code { background: #edf1f4; border-radius: 5px; padding: 2px 5px; word-break: break-all; }

.cards, .media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}
.item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.item strong, .item span { display: block; }
.item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; margin-bottom: 10px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { max-width: 260px; }
.details { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; }
.details dt { color: var(--muted); font-weight: 700; }
.details dd { margin: 0; }
.compact { margin-top: 16px; padding: 0; overflow: hidden; }

@media (max-width: 720px) {
    .topbar, .page-head { align-items: stretch; flex-direction: column; }
    .topbar { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .details { grid-template-columns: 1fr; }
}
