:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface2: #222633;
  --border: #2a3040;
  --text: #e8eaef;
  --muted: #8b919d;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #ed4245;
  --success: #3ba55d;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

body {
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(88, 101, 242, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(59, 165, 93, 0.06), transparent);
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.brand-icon {
  font-size: 2.25rem;
  line-height: 1;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand .muted {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.login-card {
  max-width: 420px;
  margin: 4vh auto;
}

.login-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.alert-error {
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid rgba(237, 66, 69, 0.35);
  color: #ff8a8c;
}

.fine-print {
  font-size: 0.78rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-discord {
  width: 100%;
  margin-top: 0.5rem;
  background: var(--accent);
  color: #fff;
}

.btn-discord:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface2);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--accent);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field.grow {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .field.grow {
    grid-column: span 1;
  }
}

.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field label.invisible {
  visibility: hidden;
}

.field.align-end {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

input,
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

input:focus,
select:focus {
  outline: 2px solid rgba(88, 101, 242, 0.45);
  outline-offset: 1px;
}

.meta-bar {
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface2);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.col-actions {
  white-space: nowrap;
  width: 1%;
}

.col-actions .btn + .btn {
  margin-top: 0.35rem;
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.82em;
}

.tag-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 220px;
}

.tag-list li {
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.section-intro {
  margin: 0 0 1rem;
}

.open-groups {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.open-category-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.open-category-count {
  font-weight: 500;
  font-size: 0.88rem;
}
