:root {
  --bg: #f4ede4;
  --bg-accent: #ead7be;
  --panel: rgba(19, 31, 39, 0.97);
  --panel-soft: rgba(255, 248, 238, 0.9);
  --panel-soft-strong: rgba(255, 252, 247, 0.96);
  --ink: #1f1f23;
  --muted: #66636e;
  --line: rgba(20, 20, 20, 0.09);
  --accent: #c8562e;
  --accent-dark: #8f3312;
  --good: #217a52;
  --warn: #c67a14;
  --bad: #b0322a;
  --chip: #f6efe6;
  --shadow: 0 24px 60px rgba(57, 32, 15, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(200, 86, 46, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(33, 122, 82, 0.12), transparent 28%),
    linear-gradient(135deg, var(--bg), #f8f4ee 55%, var(--bg-accent));
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI Variable", "Microsoft YaHei UI", sans-serif;
}

body.locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(14, 20, 24, 0.5);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: min(100%, 460px);
  border-radius: 30px;
  padding: 28px;
  background: rgba(19, 31, 39, 0.96);
  color: #f8ede1;
  box-shadow: var(--shadow);
}

.auth-copy,
.auth-status {
  color: rgba(248, 237, 225, 0.78);
}

.auth-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.page-shell {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

body.locked .page-shell {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.control-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 30px;
  background: var(--panel);
  color: #f8ede1;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-head h1,
.hero-card h2 {
  margin: 0;
  line-height: 1.05;
  font-size: clamp(1.9rem, 2vw, 2.55rem);
}

.panel-copy,
.hero-note,
.status-banner,
.empty-state {
  color: rgba(248, 237, 225, 0.78);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.73rem;
  color: #d4a173;
}

.stack,
.results-panel,
.cluster-list {
  display: grid;
  gap: 18px;
}

.form-section,
.hero-card,
.cluster-card,
.summary-card,
.bulk-actions,
.meta-card {
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.form-section {
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  font-weight: 700;
}

.mini-chip,
.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.mini-chip {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

.mini-chip.good {
  background: rgba(33, 122, 82, 0.2);
  color: #bff5d5;
}

.mini-chip.danger {
  background: rgba(176, 50, 42, 0.22);
  color: #ffd0cb;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label:last-child {
  margin-bottom: 0;
}

label span {
  font-size: 0.9rem;
  color: rgba(248, 237, 225, 0.82);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 11px 12px;
  border-radius: 14px;
  outline: none;
}

option {
  color: var(--ink);
  background: #fffaf4;
}

option:checked {
  color: #fff;
  background: var(--accent-dark);
}

textarea {
  min-height: 82px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(212, 161, 115, 0.9);
  box-shadow: 0 0 0 4px rgba(212, 161, 115, 0.16);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-check input {
  width: auto;
}

.helper-text {
  margin: 0 0 12px;
  color: rgba(248, 237, 225, 0.72);
  font-size: 0.86rem;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions.dual {
  justify-content: stretch;
}

.form-actions.dual button {
  flex: 1 1 0;
}

.primary-button,
.ghost-button,
.action-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-button:hover,
.ghost-button:hover,
.action-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.action-button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.primary-button {
  border-radius: 18px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #d66e42, var(--accent-dark));
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  border-radius: 999px;
  padding: 10px 15px;
  background: rgba(31, 31, 35, 0.06);
  color: var(--ink);
  font-weight: 700;
}

.status-banner {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.hero-card,
.summary-card,
.bulk-actions,
.meta-card,
.cluster-card {
  background: var(--panel-soft);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 24px;
}

.hero-card.compact {
  grid-template-columns: 1fr;
}

.hero-note {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 22px;
  padding: 18px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.summary-grid,
.meta-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.summary-card,
.meta-card {
  padding: 18px;
}

.table-shell {
  display: grid;
  gap: 12px;
}

.summary-card strong {
  display: block;
  font-size: 1.8rem;
  margin-top: 8px;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.fact-list {
  display: grid;
  gap: 10px;
}

.fact-row,
.channel-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.fact-row span,
.channel-row span {
  color: var(--muted);
}

.channel-list {
  display: grid;
  gap: 10px;
}

.empty-inline,
.empty-state {
  color: var(--muted);
}

.empty-inline {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
}

.bulk-actions {
  display: flex;
  gap: 12px;
  padding: 14px;
  flex-wrap: wrap;
}

.hidden {
  display: none;
}

.empty-state {
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.45);
  padding: 28px;
}

.cluster-card {
  padding: 20px;
}

.cluster-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 16px;
}

.cluster-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  background: var(--chip);
}

.chip-good {
  background: rgba(33, 122, 82, 0.12);
  color: var(--good);
}

.badge {
  color: #fff;
}

.badge-ban_sockpuppets {
  background: var(--bad);
}

.badge-no_ban,
.badge-skip {
  background: var(--good);
}

.cluster-actions {
  display: grid;
  gap: 10px;
  min-width: 280px;
}

.cluster-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-button {
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
  color: #fff;
}

.action-button[data-action="ban_sockpuppets"],
.action-button[data-action="recommended"] {
  background: var(--accent);
}

.action-button[data-action="ban_all"] {
  background: var(--bad);
}

.action-button[data-action="ban"] {
  background: var(--bad);
}

.action-button[data-action="skip"] {
  background: var(--good);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
}

.users-table thead th {
  text-align: left;
  font-size: 0.84rem;
  color: var(--muted);
  padding: 12px 10px;
}

.users-table tbody tr {
  border-top: 1px solid var(--line);
}

.users-table tbody td {
  padding: 12px 10px;
  vertical-align: top;
}

.mono {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.tag-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: rgba(31, 31, 35, 0.06);
}

.tag.good {
  background: rgba(33, 122, 82, 0.14);
  color: var(--good);
}

.tag.warn {
  background: rgba(198, 122, 20, 0.15);
  color: var(--warn);
}

.tag.bad {
  background: rgba(176, 50, 42, 0.13);
  color: var(--bad);
}

@media (max-width: 1320px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    max-height: none;
  }

  .hero-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .page-shell {
    padding: 14px;
  }

  .grid-two,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .cluster-actions {
    min-width: 0;
    width: 100%;
  }

  .users-table {
    display: block;
    overflow-x: auto;
  }
}
