:root {
  color-scheme: dark;
  --bg: #12141a;
  --panel: #1c2030;
  --text: #eef1f6;
  --muted: #9aa3b5;
  --line: #2d3344;
  --accent: #3d7eff;
  --ok: #1f7a45;
  --err: #8d2b2b;
  --shadow: none;
  --font: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1b1e27;
  --muted: #5c667a;
  --line: #d5dbe6;
  --ok: #d8f3e3;
  --err: #f8d4d4;
}
html[data-theme="structure"] {
  color-scheme: dark;
  --bg: #000;
  --panel: #000;
  --text: #fff;
  --muted: #c8c8c8;
  --line: #fff;
  --accent: #fff;
  --ok: #000;
  --err: #000;
  --font: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
}
a { color: var(--accent); }
button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
}
button, .nav a, .subnav a { cursor: pointer; }
button { background: var(--accent); color: #fff; border: 0; }
html[data-theme="structure"] button { background: #fff; color: #000; border: 1px solid #fff; }
.top, .nav, main { padding: 0.75rem 1rem; }
.top { display: flex; gap: 0.75rem; align-items: center; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; }
.nav, .subnav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.nav a, .subnav a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}
.nav a[aria-current="page"], .subnav a[aria-current="page"] { background: var(--accent); color: #fff; }
html[data-theme="structure"] .nav a[aria-current="page"] { background: #fff; color: #000; }
main { max-width: 1100px; }
.card, .tile, .stats article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  margin: 0.8rem 0;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.7rem; }
label { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.4rem 0; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.flash { padding: 0.6rem 0.8rem; border-radius: 8px; }
.flash.ok { background: var(--ok); }
.flash.err { background: var(--err); }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.7rem; }
.tile img, .tile video { width: 100%; height: 140px; object-fit: cover; background: #000; }
.feed { list-style: none; padding: 0; }
.feed li { border-bottom: 1px solid var(--line); padding: 0.6rem 0; }
.login-body { min-height: 100vh; display: grid; place-items: center; }
.login { width: min(420px, calc(100% - 2rem)); }
.pager { display: flex; gap: 0.8rem; align-items: center; }
@media (max-width: 720px) {
  button, .nav a, .subnav a, input, select, textarea { min-height: 44px; }
  .filters:not([open]) form, .filters:not([open]) > :not(summary) { display: none; }
  table.cards thead { display: none; }
  table.cards tr { display: block; border: 1px solid var(--line); border-radius: 12px; margin: 0.6rem 0; padding: 0.4rem; }
  table.cards td { display: flex; justify-content: space-between; gap: 0.8rem; border: 0; }
  table.cards td::before { content: attr(data-label); color: var(--muted); }
  .top form { margin-left: auto; }
}
