/* AikoBot dashboard — one stylesheet for every page. */

:root {
  color-scheme: dark;
  --bg: #0e0d15;
  --bg-raised: #14121d;
  --surface: #1a1825;
  --surface-2: #221f30;
  --surface-3: #2b2740;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f4f2fb;
  --muted: #a9a5bd;
  --subtle: #7d7992;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-text: #c4b5fd;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --success: #4ade80;
  --success-bg: #14532d;
  --danger: #f87171;
  --danger-strong: #dc2626;
  --danger-bg: #450a0a;
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.1);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --header-height: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80rem 40rem at 50% -10rem, rgba(124, 92, 224, 0.16), transparent);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p { margin: 0; }
code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 0.88em;
}
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: -60px;
  left: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
}
.skip-link:focus { top: 10px; }

/* ---------- Header ---------- */

.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  height: 62px;
  min-height: 62px;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--border);
  background: rgba(14, 13, 21, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}
.app-brand:hover { text-decoration: none; }
.app-brand img { width: 36px; height: 36px; border-radius: 50%; }
.app-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.app-brand small { color: var(--subtle); font-size: 0.72rem; font-weight: 500; }

.app-nav { display: flex; flex: 1; align-items: center; gap: 4px; }
.app-nav-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
}
.app-nav-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.app-nav-link.is-active { background: var(--accent-soft); color: var(--text); }

.app-header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.app-user-menu, .app-mobile-menu { position: relative; }
.app-user-menu summary, .app-mobile-menu summary { list-style: none; cursor: pointer; }
.app-user-menu summary::-webkit-details-marker,
.app-mobile-menu summary::-webkit-details-marker { display: none; }

.app-user-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}
.app-user-menu summary:hover { border-color: var(--border-strong); }
.app-user-menu summary img { width: 30px; height: 30px; border-radius: 50%; }
.app-user-menu summary .fa { color: var(--subtle); font-size: 0.75rem; }
.app-user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-user-dropdown, .app-mobile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop-in 0.14s ease-out;
}
.app-user-dropdown a, .app-mobile-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.93rem;
}
.app-user-dropdown a:hover, .app-mobile-dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.app-user-dropdown .fa { width: 16px; color: var(--subtle); text-align: center; }
.app-user-dropdown hr, .app-mobile-dropdown hr { width: 100%; margin: 4px 0; border: 0; border-top: 1px solid var(--border); }

.app-mobile-menu { display: none; }
.app-mobile-menu summary {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .app-nav { display: none; }
  .app-mobile-menu { display: block; }
  .app-user-name { display: none; }
}

@media (max-width: 520px) {
  .app-header { height: 56px; min-height: 56px; gap: 8px; padding: 0 12px; }
  .app-brand small { display: none; }
  .app-brand img { width: 32px; height: 32px; }
  .btn.app-invite span { display: none; }
  .btn.app-invite { width: 40px; padding: 0; }
  .app-user-menu summary { padding: 3px; }
  .app-user-menu summary .fa { display: none; }
}

/* ---------- Buttons ---------- */

.btn, .button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover, .button:hover { background: var(--accent-strong); text-decoration: none; }
.btn:active, .button:active { transform: translateY(1px); }
.btn-secondary { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { border-color: var(--border); background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--danger-strong); }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-ghost { border-color: rgba(248, 113, 113, 0.35); background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(248, 113, 113, 0.1); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }

/* ---------- Layout ---------- */

.page {
  width: min(1180px, 100% - 32px);
  flex: 1;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 44px) 0 64px;
}
.page-narrow { width: min(820px, 100% - 32px); }

.page-heading { display: grid; gap: 6px; margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.page-heading > p:last-child { max-width: 640px; color: var(--muted); }
.page-heading-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }

.eyebrow, .page-eyebrow {
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Cards & sections ---------- */

.card {
  min-width: 0;
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.card-header { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.card-header > div { flex: 1 1 200px; min-width: 0; }
.card-header h2 { font-size: 1.15rem; }
.card-header p { margin-top: 4px; color: var(--muted); font-size: 0.93rem; }
.card-header .card-header-action { margin-left: auto; }
.card-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 1.1rem;
}
.card-icon.is-danger { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.card-icon.is-warning { background: var(--warning-bg); color: var(--warning); }
.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.88rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}
.empty-state .fa { margin-bottom: 6px; color: var(--accent-text); font-size: 1.8rem; }
.empty-state h2, .empty-state h3 { color: var(--text); font-size: 1.1rem; }

/* ---------- Forms ---------- */

.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field + .field { margin-top: 18px; }
.field label, .label { color: var(--text); font-size: 0.93rem; font-weight: 600; }
.hint { color: var(--subtle); font-size: 0.85rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.field-row .field + .field { margin-top: 0; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming into fields */
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
select {
  padding-right: 36px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath stroke='%23a9a5bd' stroke-width='1.6' d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
}
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

fieldset.field { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset.field legend { margin-bottom: 6px; padding: 0; }
.input-short { max-width: 140px; }
.mt-sm { margin-top: 10px; }
.mb-md { margin-bottom: 20px; }
.char-count { justify-self: end; color: var(--subtle); font-size: 0.8rem; }

/* Toggle rows for on/off settings */
.toggle-list { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-raised);
}
.toggle-row + .toggle-row, .toggle-row + .toggle-extra, .toggle-extra + .toggle-row { border-top: 1px solid var(--border); }
.toggle-row > div { flex: 1; min-width: 0; }
.toggle-row strong { display: block; font-size: 0.97rem; }
.toggle-row p { margin-top: 3px; color: var(--muted); font-size: 0.88rem; }
.toggle-row .badge { margin-left: 6px; vertical-align: 1px; }
.toggle-extra { display: grid; gap: 16px; padding: 16px 18px 18px; background: rgba(0, 0, 0, 0.18); }

.switch { position: relative; display: inline-block; flex-shrink: 0; width: 46px; height: 26px; margin-top: 2px; }
.switch input { position: absolute; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background-color 0.18s;
}
.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 0.18s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Segmented radio choice */
.choice-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: grid;
  height: 100%;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.choice small { color: var(--subtle); font-size: 0.78rem; font-weight: 400; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.form-actions {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  color: var(--subtle);
  font-size: 0.88rem;
}

/* ---------- Alerts / toasts ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 13px 16px;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.93rem;
  transition: opacity 0.24s, transform 0.24s;
}
.alert .fa { margin-top: 3px; }
.alert p { flex: 1; }
.alert-success, .toast-success { border-color: rgba(74, 222, 128, 0.35); background: #14532d; color: #dcfce7; }
.alert-error, .toast-error { border-color: rgba(248, 113, 113, 0.4); background: var(--danger-bg); color: #fee2e2; }
.alert-warning { border-color: rgba(251, 191, 36, 0.3); background: var(--warning-bg); color: #fef3c7; }
.alert-close {
  margin: -4px -6px -4px 0;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.7;
}
.alert-close:hover { opacity: 1; }
.toast-leaving { opacity: 0; transform: translateY(-6px); }

/* ---------- Badges ---------- */

.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before, .status-pill::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.badge.no-dot::before { display: none; }
.badge-on, .status-enabled { background: rgba(74, 222, 128, 0.12); color: var(--success); }
.badge-off, .status-disabled { background: var(--surface-3); color: var(--subtle); }
.badge-danger { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Server picker ---------- */

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.server-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 26px 18px 18px;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.server-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.server-card h2 { width: 100%; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.server-card .btn { width: 100%; margin-top: 4px; }
.server-icon {
  display: grid;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 22px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
  object-fit: cover;
}

/* ---------- Guild shell (sidebar + content) ---------- */

.guild-shell {
  display: grid;
  width: min(1240px, 100% - 32px);
  flex: 1;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
  margin: 0 auto;
  padding: 28px 0 64px;
}
.guild-sidebar { position: sticky; top: calc(var(--header-height) + 20px); display: grid; gap: 14px; }
.guild-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.guild-switch:hover { border-color: var(--border-strong); text-decoration: none; }
.guild-switch .server-icon { width: 38px; height: 38px; border-radius: 12px; font-size: 0.9rem; }
.guild-switch span { display: grid; min-width: 0; line-height: 1.25; }
.guild-switch strong { overflow: hidden; font-size: 0.93rem; text-overflow: ellipsis; white-space: nowrap; }
.guild-switch small { color: var(--subtle); font-size: 0.78rem; }
.guild-nav { display: grid; gap: 2px; }
.guild-nav-label { margin: 8px 10px 4px; color: var(--subtle); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.guild-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
}
.guild-nav a .fa { width: 18px; color: var(--subtle); text-align: center; }
.guild-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.guild-nav a.is-active { background: var(--accent-soft); color: var(--text); }
.guild-nav a.is-active .fa { color: var(--accent-text); }
.guild-main { min-width: 0; }

@media (max-width: 900px) {
  .guild-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 16px; }
  .guild-sidebar { position: static; gap: 10px; }
  .guild-nav-label { display: none; }
  .guild-nav {
    display: flex;
    margin: 0 -16px;
    padding: 0 16px 4px;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
  }
  .guild-nav::-webkit-scrollbar { display: none; }
  .guild-nav a {
    flex-shrink: 0;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    scroll-snap-align: start;
    white-space: nowrap;
  }
  .guild-nav a.is-active { border-color: var(--accent); }
}

/* ---------- Overview ---------- */

.overview-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.overview-heading .server-icon { width: 76px; height: 76px; border-radius: 24px; font-size: 1.6rem; }
.overview-heading h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); overflow-wrap: anywhere; }
.overview-heading p:last-child { color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 40%), 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.stat-card > div { min-width: 0; }
.stat-label { color: var(--subtle); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; }
.stat-value { overflow: hidden; font-size: 1.25rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.stat-note { color: var(--subtle); font-size: 0.8rem; }

.protection-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.protection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-size: 0.93rem;
  font-weight: 600;
}

.link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  transition: border-color 0.15s, background-color 0.15s;
}
.link-card:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.link-card > span:nth-child(2) { display: grid; flex: 1; min-width: 0; }
.link-card strong { font-size: 0.97rem; }
.link-card small { color: var(--muted); font-size: 0.85rem; }
.link-card .fa-angle-right { color: var(--subtle); font-size: 1.2rem; }

.danger-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  border-color: rgba(248, 113, 113, 0.25);
}
.danger-zone h2 { color: var(--danger); font-size: 1.05rem; }
.danger-zone p { max-width: 560px; margin-top: 4px; color: var(--muted); font-size: 0.93rem; }

/* ---------- Moderation cases ---------- */

.case-list { display: grid; gap: 10px; }
.case-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.case-number { color: var(--subtle); font-family: var(--mono); font-size: 0.88rem; font-weight: 700; }
.case-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.case-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; color: var(--muted); font-size: 0.85rem; }
.case-meta span { overflow-wrap: anywhere; }
.case-reason { margin-top: 6px; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .case-item { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .case-item form .btn { width: 100%; }
}

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form .field { flex: 1 1 200px; }

.variables { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.variable { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-raised); font-size: 0.86rem; }
.variable code { display: inline-block; margin-bottom: 2px; }
.variable span { display: block; color: var(--muted); }

/* ---------- Bot appearance / profile media ---------- */

.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .media-grid { grid-template-columns: 1fr; } }
.media-card { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.media-card h3 { font-size: 1rem; }
.media-card p { color: var(--muted); font-size: 0.88rem; }
.media-preview {
  display: grid;
  height: 140px;
  overflow: hidden;
  place-items: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  color: var(--subtle);
  font-size: 0.88rem;
}
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview.is-avatar img { width: 104px; height: 104px; border: 4px solid var(--bg-raised); border-radius: 50%; }
.media-actions { display: grid; gap: 10px; }
.media-actions .btn { width: 100%; }

.note {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.88rem;
}
.note .fa { margin-top: 3px; color: var(--accent-text); }
.note strong { color: var(--text); }
.note.is-warning { border-color: rgba(251, 191, 36, 0.3); background: var(--warning-bg); }
.note.is-warning .fa { color: var(--warning); }

/* ---------- Profile ---------- */

.profile-card { padding: 0; overflow: hidden; }
.profile-banner { position: relative; height: clamp(120px, 24vw, 200px); background: linear-gradient(120deg, #4c1d95, #7c3aed 45%, #db2777); }
.profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-banner-label {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.76rem;
}
.profile-identity { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 18px; padding: 0 clamp(18px, 3vw, 28px); margin-top: -48px; }
.profile-avatar { width: 112px; height: 112px; flex-shrink: 0; border: 5px solid var(--surface); border-radius: 50%; background: var(--surface); object-fit: cover; }
.profile-identity-details { display: grid; gap: 4px; min-width: 0; padding-bottom: 6px; transform: translateY(48px); }
.profile-identity-details h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.profile-handle { color: var(--muted); }
.profile-id { color: var(--subtle); font-size: 0.85rem; }
.profile-public-link { width: fit-content; font-size: 0.86rem; }
.profile-role-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.profile-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.profile-role-owner { border-color: rgba(251, 191, 36, 0.4); color: var(--warning); }
.profile-role-support { border-color: rgba(96, 165, 250, 0.4); color: #93c5fd; }
.profile-role-member { color: var(--muted); }
.profile-body { display: grid; gap: 24px; padding: clamp(18px, 3vw, 28px); padding-top: calc(clamp(18px, 3vw, 28px) + 48px); }
@media (max-width: 560px) {
  .profile-identity { flex-direction: column; align-items: flex-start; gap: 8px; }
  .profile-identity-details { transform: none; }
  .profile-body { padding-top: clamp(18px, 3vw, 28px); }
}

.user-directory { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.user-directory-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.user-directory-card:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.user-directory-card > img { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; object-fit: cover; }
.user-directory-details { display: grid; min-width: 0; flex: 1; }
.user-directory-details strong, .user-directory-details span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-directory-details span { color: var(--muted); font-size: 0.88rem; }
.user-directory-card > .fa { color: var(--subtle); }
.user-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.user-pagination > span { color: var(--muted); font-size: 0.9rem; }
.public-profile-card { padding: 0; overflow: hidden; }
.public-profile-banner { height: clamp(120px, 24vw, 200px); background: linear-gradient(120deg, #4c1d95, #7c3aed 45%, #db2777); }
.public-profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.public-profile-identity { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 18px; margin: -48px clamp(18px, 3vw, 28px) 0; }
.public-profile-avatar { width: 112px; height: 112px; flex-shrink: 0; border: 5px solid var(--surface); border-radius: 50%; background: var(--surface); object-fit: cover; }
.public-profile-identity > div { min-width: 0; padding-bottom: 8px; }
.public-profile-identity h1 { font-size: 1.5rem; overflow-wrap: anywhere; }
.public-profile-identity p, .public-profile-empty, .public-profile-notice { color: var(--muted); }
.public-profile-body { display: grid; gap: 18px; padding: 24px clamp(18px, 3vw, 28px); }
.public-profile-body h2 { margin-bottom: 8px; font-size: 1rem; }
.public-profile-bio { white-space: pre-wrap; overflow-wrap: anywhere; }
.public-profile-body .profile-id { margin: 0; }
.public-profile-notice { margin-top: 12px; font-size: 0.85rem; text-align: center; }
@media (max-width: 560px) {
  .public-profile-identity { align-items: flex-start; flex-direction: column; gap: 8px; }
  .public-profile-identity > div { padding: 0; }
}

/* ---------- Developer panel ---------- */

.panel-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.panel-stat { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel-stat .fa { color: var(--accent-text); }
.panel-stat .stat-value { margin-top: 6px; }
.panel-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .panel-layout { grid-template-columns: minmax(0, 1fr); } }
.bug-list { display: grid; gap: 10px; }
.bug-item { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.bug-item header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--subtle); font-size: 0.82rem; }
.bug-item p { overflow-wrap: anywhere; white-space: pre-wrap; }
.server-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.server-table th { padding: 0 8px 8px; color: var(--subtle); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; }
.server-table td { padding: 9px 8px; border-top: 1px solid var(--border); }
.server-table td:last-child, .server-table th:last-child { text-align: right; }
.server-table .server-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.server-table .server-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-table .server-icon { width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; font-size: 0.7rem; }
.table-wrap { overflow-x: auto; }
.system-list { display: grid; gap: 0; margin: 0; }
.system-list div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.system-list div:first-child { border-top: 0; }
.system-list dt { color: var(--muted); }
.system-list dd { margin: 0; font-family: var(--mono); font-size: 0.85rem; }

/* ---------- Landing page ---------- */

.hero { position: relative; padding: clamp(56px, 11vw, 120px) 0 clamp(48px, 8vw, 80px); text-align: center; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid rgba(196, 181, 253, 0.2);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: var(--accent-text);
  font-size: 0.82rem;
  font-weight: 600;
}
.hero-avatar { display: block; width: 92px; height: 92px; margin: 0 auto 22px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.15), 0 20px 60px rgba(124, 58, 237, 0.4); }
.hero h1 { max-width: 820px; margin: 22px auto 16px; font-size: clamp(2.3rem, 7vw, 4.6rem); font-weight: 800; letter-spacing: -0.045em; line-height: 1.04; }
.hero h1 span { background: linear-gradient(100deg, #c4b5fd 10%, #f0abfc 90%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-copy { max-width: 600px; margin: 0 auto; color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.15rem); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 36px; margin-top: 40px; color: var(--muted); font-size: 0.93rem; }
.hero-stats strong { display: block; color: var(--text); font-size: 1.5rem; }

.section-heading { max-width: 640px; margin: 0 auto 28px; text-align: center; }
.section-heading h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.section-heading p { margin-top: 8px; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature-card { padding: 22px; }
.feature-card h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.feature-card p { color: var(--muted); font-size: 0.93rem; }
.feature-card.is-highlight { border-color: rgba(139, 92, 246, 0.35); background: linear-gradient(160deg, rgba(139, 92, 246, 0.14), var(--surface) 60%); }
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 56px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, rgba(124, 92, 224, 0.18), var(--surface) 70%);
}
.cta h2 { font-size: 1.3rem; }
.cta p { margin-top: 4px; color: var(--muted); }
@media (max-width: 560px) { .cta .btn, .hero-actions .btn { width: 100%; } }

/* ---------- Legal / prose ---------- */

.prose { color: var(--muted); }
.prose h2 { margin: 32px 0 10px; color: var(--text); font-size: 1.15rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }

/* ---------- Error page ---------- */

.error-page { display: grid; flex: 1; place-items: center; padding: 60px 16px; text-align: center; }
.error-code { color: var(--accent-text); font-family: var(--mono); font-size: clamp(3rem, 12vw, 6rem); font-weight: 800; line-height: 1; }
.error-page h1 { margin: 12px 0 8px; font-size: 1.6rem; }
.error-page p { color: var(--muted); }
.error-page .hero-actions { margin-top: 24px; }

/* ---------- Footer & misc ---------- */

.app-footer {
  padding: 22px 16px calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.86rem;
  text-align: center;
}
.app-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 8px; }
.app-footer a { color: var(--muted); }
.cookie-settings-form { display: flex; justify-content: center; margin: -8px 0 16px; }
.cookie-banner {
  position: fixed;
  z-index: 80;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
  left: clamp(12px, 3vw, 28px);
  display: flex;
  max-width: 960px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-inline: auto;
  padding: 18px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cookie-banner-copy { display: grid; gap: 5px; }
.cookie-banner-copy h2 { font-size: 1rem; }
.cookie-banner-copy p { color: var(--muted); font-size: 0.88rem; }
.cookie-banner-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 8px; }
.cookie-banner-actions form { margin: 0; }
@media (max-width: 680px) {
  .cookie-banner { align-items: stretch; flex-direction: column; gap: 12px; padding: 16px; }
  .cookie-banner-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cookie-banner-actions .btn { width: 100%; }
}

.back-to-top {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateY(8px);
}
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat-card .card-icon { width: 36px; height: 36px; font-size: 0.95rem; }
  .stat-value { font-size: 1.1rem; }
  .overview-heading { gap: 14px; }
  .overview-heading .server-icon { width: 56px; height: 56px; border-radius: 18px; font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
