:root {
  --bg: #0f1419;
  --card: #1a222c;
  --text: #e7eef7;
  --muted: #93a4b8;
  --line: #2b3645;
  --accent: #3d8bfd;
  --ok: #1f6f4a;
  --err: #8b2e2e;
  --danger: #c44;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3d, var(--bg));
  color: var(--text);
  min-height: 100vh;
}
a { color: #8ec5ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.25);
}
.brand { font-weight: 700; color: var(--text); }
.userbox { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; }
.wrap { max-width: 1100px; margin: 24px auto; padding: 0 16px 48px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
h1, h2 { margin-top: 0; }
.muted { color: var(--muted); }
.btn {
  display: inline-block;
  width: fit-content;
  border: 1px solid var(--line);
  background: #243041;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.linkish {
  background: none; border: none; color: #8ec5ff; cursor: pointer; padding: 0;
}
.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.flash.ok { background: rgba(31,111,74,.35); }
.flash.err { background: rgba(139,46,46,.35); }
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  align-items: end;
}
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #101820;
  color: var(--text);
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 1rem;
  height: 1rem;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  color: var(--text);
}
th.sortable-th:hover { color: #fff; }
th.sortable-th::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 11px;
  font-weight: 400;
}
th.sortable-th.sort-desc::after {
  content: " ↓";
  opacity: 1;
  color: var(--accent);
}
th.sortable-th.sort-asc::after {
  content: " ↑";
  opacity: 1;
  color: var(--accent);
}
.tag {
  display: inline-block;
  background: #243041;
  border-radius: 999px;
  padding: 2px 8px;
  margin: 1px;
  font-size: 12px;
}
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.meta dt { font-size: 12px; color: var(--muted); }
.meta dd { margin: 2px 0 0; }
.stack { display: grid; gap: 12px; max-width: 520px; }
label.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
fieldset legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.danger-zone { border-color: #623; }
.inline { display: inline; }
