:root {
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --bg-soft: #111111;
  --line: rgba(255,255,255,0.18);
  --line-strong: rgba(255,255,255,0.28);
  --text: #ffffff;
  --muted: #9a9a9a;
  --accent: #ffffff;
  --accent-2: #e5e5e5;
  --danger: #ff3b30;
  --ok: #ffffff;
  --warn: #ffffff;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0,0,0,0.8);
  --font: "Outfit", system-ui, -apple-system, sans-serif;
  --display: "Syne", "Outfit", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: #000000;
  display: flex;
  min-height: 100vh;
}

a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
a:hover { opacity: 0.85; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #111;
  border: 1px solid var(--line);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  color: var(--text);
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  padding: 1.5rem 1.1rem;
  background: #050505;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800;
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--line-strong);
}
.brand strong { display: block; font-family: var(--display); letter-spacing: -0.02em; color: #fff; }
.brand small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.68rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.sidebar nav a {
  color: var(--muted);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
  color: #000;
  background: #ffffff;
  border-color: #fff;
}
.logout { color: var(--muted); font-size: 0.92rem; padding: 0.5rem 0.9rem; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.logout:hover { background: #111; color: #fff; border-color: var(--line-strong); }

main.with-sidebar {
  flex: 1;
  padding: 1.75rem 2rem 2.5rem;
  max-width: 1200px;
  background: #000;
}
main.auth { flex: 1; display: grid; place-items: center; padding: 2rem; background: #000; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0.7;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
  color: #fff;
}
h2 { margin: 0; font-size: 1.1rem; color: #fff; }

.bot-chip, .tag {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #0a0a0a;
  color: var(--text);
  font-size: 0.85rem;
}
.bot-chip.warn { border-color: #fff; color: #fff; background: #111; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.dot.live { background: #fff; box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}
.stats article {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.stats article:hover { border-color: var(--line-strong); }
.stats span { color: var(--muted); font-size: 0.85rem; }
.stats strong {
  display: block; margin-top: 0.35rem;
  font-family: var(--display); font-size: 1.8rem; color: #fff;
}

.panel {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.3rem;
  margin-bottom: 1.15rem;
}
.panel:hover { border-color: var(--line-strong); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.8rem;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; }
td { color: var(--text); }
tr:hover td { background: #0f0f0f; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}
.form-grid.tight { margin-top: 1rem; }
.span-2 { grid-column: span 2; }
label {
  display: flex; flex-direction: column; gap: 0.4rem;
  font-size: 0.86rem; color: var(--muted); font-weight: 600;
}
label.check {
  flex-direction: row; align-items: center; gap: 0.55rem;
  margin-top: 1.55rem;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #000;
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 2px #fff;
  background: #0a0a0a;
}
input::placeholder, textarea::placeholder { color: #666; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.actions { display: flex; gap: 0.6rem; align-items: center; }
.search { display: flex; gap: 0.5rem; }

.btn {
  border: 1px solid var(--line-strong);
  background: #000;
  color: var(--text);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: #fff; color: #000; border-color: #fff; }
.btn.primary {
  background: #ffffff;
  color: #000000;
  border-color: #fff;
}
.btn.primary:hover { background: #e5e5e5; border-color: #e5e5e5; }
.btn.danger { color: #fff; border-color: #fff; background: #000; }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; margin-top: 0.75rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.user-list, .plan-list { display: flex; flex-direction: column; gap: 0.7rem; }
.user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0a0a;
  padding: 0.85rem 1rem;
}
.user-card:hover { border-color: var(--line-strong); }
.user-card.banned { border-color: var(--danger); }
.user-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.user-card summary::-webkit-details-marker { display: none; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag.soft { background: #000; border-color: var(--line); }
.tag.danger { color: #fff; border-color: var(--danger); background: #1a0000; }
.muted { color: var(--muted); margin-left: 0.5rem; }
.empty { color: var(--muted); margin: 0.4rem 0; }

.flashes { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #0a0a0a;
  color: var(--text); font-weight: 600;
}
.flash.success { border-color: #fff; background: #fff; color: #000; }
.flash.error { border-color: var(--danger); background: #1a0000; color: #fff; }

.login-shell { width: min(440px, 100%); }
.login-panel {
  background: #0a0a0a;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 2rem 1.7rem;
}
.login-panel h1 { margin-bottom: 0.35rem; color: #fff; }
.login-panel .sub { color: var(--muted); margin: 0 0 1.4rem; }
.ui-pills { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.2rem 0 0.6rem; }

.panel-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}
.settings-form { display: flex; flex-direction: column; gap: 0; }
.settings-fields { display: flex; flex-direction: column; gap: 1rem; }
.settings-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.field-full { display: flex; flex-direction: column; gap: 0.4rem; }
.field-hint { font-size: 0.78rem; color: var(--muted); }
.secret-field {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}
.secret-field input { flex: 1; min-width: 0; }
.icon-btn {
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  background: #000;
  color: var(--text);
  border-radius: 10px;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 4.2rem;
}
.icon-btn:hover { background: #fff; color: #000; border-color: #fff; }

.notice {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0a0a;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.notice.warn { border-color: #fff; color: #fff; background: #111; }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.meta-row strong { color: var(--text); font-weight: 700; }

.switch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0a0a0a;
}
.switch-card.is-disabled { opacity: 0.72; }
.switch-copy { min-width: 0; }
.switch-copy strong { display: block; color: var(--text); font-size: 0.95rem; }
.switch-copy p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-ui {
  display: block;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #000;
  border: 1px solid var(--line-strong);
  position: relative;
  transition: 0.18s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  top: 3px;
  left: 4px;
  background: var(--muted);
  transition: 0.18s ease;
}
.switch input:checked + .switch-ui {
  background: #ffffff;
  border-color: #fff;
}
.switch input:checked + .switch-ui::after {
  transform: translateX(20px);
  background: #000;
}
.switch input:disabled + .switch-ui { cursor: not-allowed; opacity: 0.7; }
.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.2rem 0 1.2rem;
}

.docs .empty { margin-bottom: 0.85rem; }
.code-block {
  position: relative;
  margin: 0 0 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #000;
  overflow: auto;
}
.code-block pre {
  margin: 0;
  padding: 1rem 5.5rem 1rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.code-block .icon-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}
.docs table tr.is-allowed td:first-child { color: var(--text); }

@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  label.check { margin-top: 0.2rem; }
  main.with-sidebar { padding: 1.2rem; }
  .settings-two { grid-template-columns: 1fr; }
  .switch-card { flex-wrap: wrap; }
}
