:root {
  color-scheme: light dark;
  --fg: #1b1b1b;
  --muted: #666;
  --line: #dedede;
  --bg: #fff;
  --accent: #1f5fd6;
  --on-accent: #fff;
  --ok: #1e7a3c;
  --warn: #a35a00;
  --off: #a12020;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e6e6;
    --muted: #9b9b9b;
    --line: #333;
    --bg: #161616;
    --accent: #7aa7ff;
    --on-accent: #0c1830;
    --ok: #5fc27e;
    --warn: #e3a54d;
    --off: #f07d7d;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}
header, main, footer { max-width: 48rem; margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-top: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line);
}
header form { margin: 0; }
.brand { font-weight: 600; color: inherit; text-decoration: none; margin-right: auto; }
.who { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
main { padding-top: 1rem; padding-bottom: 2rem; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding-bottom: 2rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: .5rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
a { color: var(--accent); }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.card h2 { margin: 0; overflow-wrap: anywhere; }
.card p { margin: .5rem 0 0; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .75rem 0; }
dt { color: var(--muted); }
dd { margin: 0; }

.status { font-weight: 600; }
.status.active { color: var(--ok); }
.status.suspended { color: var(--warn); }
.status.disabled { color: var(--off); }
.error { color: var(--off); }
.hint, small { color: var(--muted); font-size: .9rem; }

.stack { display: flex; flex-direction: column; gap: .75rem; max-width: 26rem; }
.stack p { margin: 0; }
label { display: flex; flex-direction: column; gap: .25rem; }
label.check, label.option { flex-direction: row; align-items: center; gap: .6rem; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: inherit;
}
button, .button {
  display: inline-block; align-self: flex-start;
  padding: .55rem 1.1rem; border: 0; border-radius: 6px;
  background: var(--accent); color: var(--on-accent);
  text-decoration: none; cursor: pointer;
}
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
fieldset {
  display: flex; flex-direction: column; gap: .6rem;
  margin: 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 8px;
}

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters select, .filters input:not([type=checkbox]) { width: auto; flex: 1 1 10rem; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }

/* Админка: заголовок с кнопкой справа и ссылка назад к списку. */
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.head h1 { margin: 0; }
.back { margin: 0 0 .25rem; font-size: .9rem; }
