:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --border: #d8dee4;
  --primary: #1a73e8;
  --primary-text: #ffffff;
  --danger: #c62828;
  --ok-bg: #e7f5ea;
  --ok-text: #1b5e20;
  --code-bg: #f1f3f5;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e23;
    --text: #e6edf3;
    --muted: #9aa5b1;
    --border: #2f363d;
    --primary: #4c8df6;
    --ok-bg: #16301c;
    --ok-text: #a5d6a7;
    --code-bg: #22272e;
    --danger: #ef5350;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--primary); }
header.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header.top .inner, main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}
header.top .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
header.top .brand { font-weight: 700; text-decoration: none; color: var(--text); }
header.top form { margin: 0; }
main { padding-top: 24px; padding-bottom: 64px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 16px 0 20px;
}
.tabs a {
  padding: 8px 14px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active { color: var(--text); border-color: var(--primary); font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
label.inline { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 10px 0; }
.hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
textarea { min-height: 90px; resize: vertical; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
button, .button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--primary); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 400; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.flash { background: var(--ok-bg); color: var(--ok-text); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.error { background: #fdecea; color: #b71c1c; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre { background: var(--code-bg); padding: 12px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--code-bg); }
.badge.on { background: var(--ok-bg); color: var(--ok-text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.login { max-width: 360px; margin: 10vh auto; }
.pagination { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.inline-form { display: inline; }
details.edit summary { cursor: pointer; color: var(--primary); }
.cat-row { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
