:root {
  --bg: #d3d7dc; --surface: #eceef0; --ink: #171e27; --muted: #4a5560;
  --line: #b3bac1; --accent: #1f5f5b; --accent-ink: #ffffff; --danger: #a32b2b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181e; --surface: #1a222a; --ink: #e3e8ec; --muted: #8d99a5;
    --line: #2e3944; --accent: #6fc2ba; --accent-ink: #0d1a19; --danger: #ef8a8a;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
.muted { color: var(--muted); }
code { font-size: .9em; }

.side { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem 1rem;
  background: var(--surface); border-right: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; color: var(--ink);
  text-decoration: none; padding: 0 .5rem; }
.side nav { display: flex; flex-direction: column; gap: .15rem; }
.side nav a { color: var(--ink); text-decoration: none; padding: .45rem .5rem;
  border-left: 3px solid transparent; border-radius: 0 4px 4px 0; }
.side nav a:hover { background: var(--bg); }
.side nav a.active { border-left-color: var(--accent); background: var(--bg); font-weight: 600; }
.signout { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: auto; padding: 1rem .5rem 0; border-top: 1px solid var(--line); }
main { width: 100%; min-width: 0; max-width: 68rem; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

body.has-side { display: grid; grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
body.has-side .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
body.has-side main { margin: 0; }

@media (max-width: 720px) {
  body.has-side { display: block; }
  body.has-side .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; border-right: 0;
    border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .side nav a { border-left: 0; border-bottom: 3px solid transparent; border-radius: 0; }
  .side nav a.active { border-bottom-color: var(--accent); }
  .signout { margin-top: 0; padding: 0; border-top: 0; }
}

.index { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); max-width: 40rem; }
.index a { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem .25rem;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.index a:hover strong { color: var(--accent); }
.index span { color: var(--muted); }

.login { max-width: 22rem; margin: 12vh auto 0; }
.login h1 { font-size: 2.75rem; margin-bottom: .25rem; }

label { display: block; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
label input:not([type=checkbox]), label select { display: block; width: 100%; margin-top: .3rem; }
input, select { font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; padding: .5rem .65rem; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 4px;
  padding: .5rem 1rem; background: var(--accent); color: var(--accent-ink); }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.danger { color: var(--danger); }
.check { display: flex; gap: .5rem; align-items: center; }
.stack { max-width: 22rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1.5rem; }
td .inline-form { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.filters label { margin: 0; }

.notice { padding: .6rem .8rem; border-left: 3px solid var(--accent); background: var(--surface); }
.notice.error { border-color: var(--danger); }
.subnav { display: flex; gap: 1.25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.stats strong { font-size: 1.15rem; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
td.ua { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
tr.k-login_fail td:nth-child(2), tr.k-banned td:nth-child(2) { color: var(--danger); font-weight: 600; }
tr.k-login_ok td:nth-child(2) { color: var(--accent); font-weight: 600; }

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border: 1px solid var(--line); }
.grid form { margin-top: .25rem; font-size: .85rem; }
