/* VexBot website + dashboard styles. One file shared by the landing page
   (index.html) and the control panel (app.html). */

:root {
  --bg: #0a0b0e;
  --bg-raised: #0f1014;
  --surface: #14151a;
  --surface-2: #1a1c22;
  --surface-3: #22242c;
  --border: #23262e;
  --border-strong: #30333d;
  --text: #f3f4f6;
  --text-2: #b7bbc5;
  --muted: #7f8490;

  --accent: #8b5cf6;
  --accent-hover: #9d74f8;
  --accent-text: #b9a3ff;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-glow: rgba(139, 92, 246, 0.35);
  --green: #22c55e;
  --green-text: #4ade80;
  --green-soft: rgba(34, 197, 94, 0.13);
  --red: #ef4444;
  --red-text: #f87171;
  --red-soft: rgba(239, 68, 68, 0.13);
  --amber: #f59e0b;
  --amber-text: #fbbf24;
  --amber-soft: rgba(245, 158, 11, 0.13);
  --blue: #3b82f6;
  --blue-text: #60a5fa;
  --blue-soft: rgba(59, 130, 246, 0.14);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: var(--accent-glow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon.inline-icon { display: inline-block; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: #2a2d36; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px -6px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red-soft); color: var(--red-text); }
.btn-danger:hover { background: rgba(239, 68, 68, .22); }
.btn-success { background: var(--green-soft); color: var(--green-text); }
.btn-success:hover { background: rgba(34, 197, 94, .22); }
.btn-tint { background: var(--accent-soft); color: var(--accent-text); }
.btn-tint:hover { background: rgba(139, 92, 246, .24); }
.btn-amber { background: var(--amber-soft); color: var(--amber-text); }
.btn-amber:hover { background: rgba(245, 158, 11, .22); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 15px; border-radius: var(--radius); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .spinner { width: 16px; height: 16px; }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form controls ---------- */
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 13px;
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8490' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select option, .select optgroup { background: var(--surface-2); color: var(--text); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: 7px; }
.field + .field { margin-top: 14px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; min-width: 0; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
.char-count { font-size: 12px; color: var(--muted); text-align: right; }

.segmented { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented button {
  flex: 1 1 auto; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer;
}
.segmented button:hover { background: var(--surface-2); color: var(--text); }
.segmented button.active { background: var(--accent); color: #fff; }
.segmented button.active.off { background: var(--red); }

.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding: 2px; }
.check-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.check-item:hover { border-color: var(--border-strong); }
.check-item input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.check-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check-item.log-event { justify-content: space-between; gap: 12px; padding: 10px 12px; }
.check-item.log-event > span:first-child { white-space: normal; overflow: visible; }

/* ---------- Cards, badges, lists ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; min-width: 0; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.card-title .icon-bubble { width: 34px; height: 34px; }
.stack { display: grid; gap: 16px; align-content: start; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-wide { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: 0; }

.icon-bubble { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.tone-green { background: var(--green-soft); color: var(--green-text); }
.tone-red { background: var(--red-soft); color: var(--red-text); }
.tone-amber { background: var(--amber-soft); color: var(--amber-text); }
.tone-blue { background: var(--blue-soft); color: var(--blue-text); }
.tone-gray { background: var(--surface-3); color: var(--text-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-soft); color: var(--green-text); }
.badge-red { background: var(--red-soft); color: var(--red-text); }
.badge-amber { background: var(--amber-soft); color: var(--amber-text); }
.badge-blue { background: var(--blue-soft); color: var(--blue-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

.stat { padding: 18px 20px; }
.stat .stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.list-item, button.list-item { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; cursor: pointer; border-radius: 12px; padding-left: 10px; padding-right: 10px; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
.list-item.selected { background: var(--accent-soft); }

.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.avatar-sm { width: 26px; height: 26px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 84px; height: 84px; }
.avatar-fallback { display: grid; place-items: center; font-weight: 700; color: var(--text-2); font-size: 14px; }
.guild-icon { border-radius: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 6px 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
}
.chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.chip button:hover { background: var(--red-soft); color: var(--red-text); }
.chip .role-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip.custom { border-color: rgba(139, 92, 246, .45); }
.blurred .word-text { filter: blur(5px); user-select: none; }

.spoiler { display: inline; padding: 1px 6px; border: 0; border-radius: 6px; background: var(--surface-3); color: transparent; text-shadow: 0 0 8px rgba(255, 255, 255, .6); cursor: pointer; font: inherit; text-align: left; word-break: break-word; }
.spoiler.revealed { color: var(--text-2); text-shadow: none; cursor: text; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty .icon-bubble { width: 48px; height: 48px; border-radius: 16px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 14px; }
.notice > .icon { margin-top: 2px; }
.notice-amber { background: var(--amber-soft); border-color: rgba(245, 158, 11, .25); color: #fde3a7; }
.notice-amber > .icon { color: var(--amber-text); }
.notice-red { background: var(--red-soft); border-color: rgba(239, 68, 68, .25); color: #fecaca; }
.notice-blue { background: var(--blue-soft); border-color: rgba(59, 130, 246, .25); color: #cfe0ff; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.tabs button { flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.active { background: var(--surface-3); color: var(--text); }
.tabs .count { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Switch */
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

/* ---------- Toasts & modals ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 14px; animation: toast-in .2s ease-out;
}
.toast .icon { margin-top: 2px; }
.toast-success .icon { color: var(--green-text); }
.toast-error .icon { color: var(--red-text); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 8, .72); backdrop-filter: blur(4px); animation: fade-in .15s; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal .modal-body { color: var(--text-2); }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Member picker ---------- */
.picker { position: relative; }
.picker-menu {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 290px; overflow: auto; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
}
.picker-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.picker-option:hover, .picker-option.active { background: var(--surface-3); }
.picker-option .sub { color: var(--muted); font-size: 12.5px; }
.picker-selected { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 8px 6px 8px; background: var(--bg-raised); border: 1px solid var(--accent); border-radius: var(--radius-sm); }
.picker-selected .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* ---------- Audit rows ---------- */
.audit-row { display: flex; gap: 13px; padding: 14px 4px; border-top: 1px solid var(--border); }
.audit-row:first-child { border-top: 0; }
.audit-row .icon-bubble { width: 36px; height: 36px; border-radius: 11px; }
.audit-row .grow { flex: 1; min-width: 0; }
.audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.audit-label { font-weight: 600; }
.audit-details { color: var(--text-2); font-size: 14px; margin-top: 2px; word-break: break-word; }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.audit-meta a:hover { color: var(--text); text-decoration: underline; }
.audit-time { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.audit-row.clickable { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; transition: background .15s; }
.audit-row.clickable:hover { background: var(--surface-2); }
.audit-open { align-self: center; color: var(--muted); }

/* Audit entry detail pop-up */
.modal-wide { width: min(600px, 100%); }
.detail-loading { display: grid; place-items: center; padding: 40px; }
.detail-head { display: flex; align-items: flex-start; gap: 14px; }
.detail-head .grow { flex: 1; min-width: 0; }
.detail-head h3 { margin: 6px 0 2px; }
.detail-summary { color: var(--text-2); margin-top: 16px; word-break: break-word; }
.detail-grid { display: grid; grid-template-columns: 112px minmax(0, 1fr); margin: 16px 0 0; }
.detail-grid dt, .detail-grid dd { padding: 12px 0; border-top: 1px solid var(--border); }
.detail-grid dt { padding-right: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.detail-grid dd { margin: 0; min-width: 0; word-break: break-word; }
.detail-reason { white-space: pre-wrap; }
.detail-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; color: var(--accent-text); }
.detail-link:hover { text-decoration: underline; }
.detail-person { display: flex; align-items: center; gap: 12px; }
.detail-person .grow { flex: 1; min-width: 0; }
.detail-person-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.detail-person .bot-tag { margin-left: 4px; padding: 1px 6px; border-radius: 5px; background: #5865f2; color: #fff; font-size: 10.5px; font-weight: 600; vertical-align: 2px; }
.detail-role { padding: 2px 9px; font-size: 12px; }
.detail-reason-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-reason-row .btn { flex: none; margin-top: -4px; }
.detail-edit { display: grid; gap: 8px; }
.detail-edit .textarea { min-height: 0; }
.detail-notes { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-notes-title { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 10px; }
.detail-note { padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.detail-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.detail-note-head .link-btn { margin-left: auto; }
.detail-note-text { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.detail-notes .detail-edit { margin-top: 10px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.link-btn:hover { color: var(--red-text); text-decoration: underline; }
.audit-notes-count { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); }
@media (max-width: 560px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid dt { padding-bottom: 0; }
  .detail-grid dd { padding-top: 4px; border-top: 0; }
}

/* ---------- Ticket conversation ---------- */
.conversation { display: grid; gap: 4px; max-height: 60vh; overflow: auto; padding: 4px 6px 4px 0; }
.msg { display: flex; gap: 12px; padding: 8px 6px; border-radius: 12px; }
.msg:hover { background: var(--bg-raised); }
.msg .grow { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; }
.msg-time { font-size: 12px; color: var(--muted); }
.msg-content { white-space: pre-wrap; word-break: break-word; color: var(--text-2); }
.msg-embed { margin-top: 6px; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg-raised); font-size: 14px; }
.msg-embed .embed-title { font-weight: 600; }
.msg-embed .embed-field { margin-top: 6px; }
.msg-embed .embed-field b { display: block; font-size: 12.5px; color: var(--text-2); }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.msg-attachments img { max-width: 240px; max-height: 180px; border-radius: 10px; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; padding: 16px 14px;
  background: var(--bg-raised); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.brand img { width: 32px; height: 32px; }
.sidebar .brand { padding: 4px 8px; }
.guild-switch {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left;
}
.guild-switch:hover { border-color: var(--border-strong); background: var(--surface-2); }
.guild-switch .grow { flex: 1; min-width: 0; }
.guild-switch .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-switch .sub { font-size: 12px; color: var(--muted); }
.nav-group { display: grid; gap: 2px; }
.nav-group-title { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 11px; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active .icon { color: var(--accent-text); }
.nav-item .badge { margin-left: auto; height: 20px; font-size: 11px; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.sidebar-footer .grow { flex: 1; min-width: 0; }
.sidebar-footer .name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 32px 64px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header h1 { font-size: 26px; font-weight: 600; }
.page-header p { color: var(--muted); margin-top: 6px; max-width: 640px; }
.cmd { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }

.sidebar-backdrop { display: none; }

/* Server picker & login */
.plain-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 20px 24px; }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.user-pill .name { font-weight: 600; font-size: 14px; padding-right: 4px; }
.picker-page { max-width: 1180px; margin: 0 auto; padding: 24px 24px 80px; }
.picker-page h1 { font-size: clamp(26px, 4vw, 36px); }
.guild-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 28px; }
.guild-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .15s, transform .15s; }
.guild-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.guild-card .head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.guild-card .name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card.reordering { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .15s, box-shadow .15s; }
.guild-card.reordering:hover { transform: none; border-color: var(--border-strong); }
.guild-card.reordering .head { gap: 12px; }
.guild-card.dragging { position: relative; z-index: 5; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); cursor: grabbing; }
.drag-handle { display: grid; place-items: center; width: 40px; height: 48px; flex: none; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); cursor: grab; touch-action: none; }
.drag-handle:hover { color: var(--text); background: var(--surface-3); }
.guild-card.dragging .drag-handle { cursor: grabbing; color: var(--accent-text); border-color: var(--accent); }
body.is-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.order-num { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 14px; }
.guild-card.add { justify-content: center; align-items: center; text-align: center; border-style: dashed; color: var(--muted); min-height: 170px; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); text-align: center; padding: 36px 30px; }
.login-card .brand { justify-content: center; font-size: 24px; margin-bottom: 20px; }
.login-card .brand img { width: 44px; height: 44px; }

/* Members page layout */
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.back-link { display: none; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 14px; font-weight: 500; }
.back-link:hover { color: var(--text); }
.split.split-aside { grid-template-columns: minmax(0, 1fr) 340px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; cursor: pointer; }
.toggle-row > span:first-child { flex: 1; min-width: 0; }
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .grow { flex: 1; min-width: 200px; }
.profile-head h2 { font-size: 22px; }
.action-block { padding: 16px; border-radius: var(--radius); background: var(--bg-raised); border: 1px solid var(--border); }
.action-block h4 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.meme-box { display: grid; place-items: center; min-height: 160px; border-radius: var(--radius); background: var(--bg-raised); border: 1px dashed var(--border-strong); overflow: hidden; }
.meme-box img, .meme-box video { max-height: 360px; width: auto; }

/* ---------- Landing page ---------- */
.landing { overflow-x: hidden; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-nav { position: sticky; top: 0; z-index: 50; background: rgba(10, 11, 14, .72); backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-nav.scrolled { border-bottom-color: var(--border); }
.site-nav .container { display: flex; align-items: center; gap: 28px; height: 72px; }
.site-nav .links { display: flex; gap: 6px; }
.site-nav .links a { padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.site-nav .links a:hover { color: var(--text); background: var(--surface); }
.site-nav .nav-cta { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.hero { position: relative; padding: 96px 0 72px; text-align: center; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: -120px; width: 1100px; height: 700px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(139, 92, 246, .28), rgba(99, 102, 241, .10) 45%, transparent 75%);
  pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; z-index: -1; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(20, 21, 26, .7); color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(127, 132, 144, .2); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.hero h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 700; letter-spacing: -0.035em; margin: 26px auto 0; max-width: 900px; line-height: 1.04; }
.gradient-text { background: linear-gradient(100deg, #c4b5fd 0%, #8b5cf6 45%, #6366f1 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(16px, 2.1vw, 19px); color: var(--text-2); max-width: 640px; margin: 22px auto 0; }
.hero .actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 36px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; max-width: 860px; margin: 64px auto 0; border-radius: var(--radius-lg); overflow: hidden; background: var(--border); border: 1px solid var(--border); }
.hero-stats > div { padding: 22px 16px; background: var(--surface); }
.hero-stats .num { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-stats .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

.section { padding: 88px 0; overflow: hidden; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 52px; }
.section-head h2 { font-size: clamp(28px, 4.2vw, 44px); font-weight: 700; letter-spacing: -0.03em; }
.section-head p { color: var(--text-2); margin-top: 14px; font-size: 17px; }
.kicker { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 12px; }

.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 64px; align-items: center; padding: 44px 0; }
.feature.reverse .feature-text { order: 2; }
.feature h3 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; letter-spacing: -0.025em; }
.feature p { color: var(--text-2); font-size: 17px; margin-top: 16px; }
.feature ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; color: var(--text-2); }
.feature li { display: flex; gap: 10px; align-items: flex-start; }
.feature li .icon { color: var(--accent-text); margin-top: 3px; }
.feature .btn { margin-top: 28px; }
.mock { position: relative; padding: 26px; border-radius: var(--radius-xl); background: linear-gradient(180deg, #16171d, #111216); border: 1px solid var(--border); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7); }
.mock::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; background: radial-gradient(60% 50% at 70% 0%, var(--accent-glow), transparent 70%); filter: blur(30px); opacity: .55; }
.mock-msg { display: flex; gap: 12px; padding: 12px; border-radius: 14px; }
.mock-msg + .mock-msg { margin-top: 6px; }
.mock-msg .who { font-weight: 600; font-size: 14.5px; }
.mock-msg .who .bot-tag { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: #5865f2; color: #fff; font-size: 10.5px; vertical-align: 2px; }
.mock-msg .txt { color: var(--text-2); font-size: 14.5px; margin-top: 2px; }
.mock-blocked { background: var(--red-soft); border: 1px solid rgba(239, 68, 68, .25); }
.mock-blocked .txt s { color: var(--red-text); }
.mock-embed { margin-top: 8px; padding: 12px 14px; border-radius: 10px; background: var(--bg-raised); border-left: 3px solid var(--amber); font-size: 14px; }
.mock-embed.red { border-left-color: var(--red); }
.mock-embed .t { font-weight: 600; color: var(--text); }
.mock-embed .f { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mock-embed .f b { display: block; font-size: 12px; color: var(--text); }
.mock-embed .f span { color: var(--text-2); font-size: 13px; }
.mock-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.mock-row + .mock-row { margin-top: 10px; }
.mock-row .grow { flex: 1; min-width: 0; }
.mock-row .t { font-weight: 600; font-size: 14.5px; }
.mock-row .s { color: var(--muted); font-size: 13px; }
.mock-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; }
img.mock-avatar { border-radius: 0; object-fit: contain; }

.command-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.command-group h4 { font-size: 15px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.command { display: grid; gap: 3px; padding: 11px 0; border-top: 1px solid var(--border); }
.command:first-of-type { border-top: 0; }
.command code { font-family: var(--mono); font-size: 13.5px; color: var(--accent-text); }
.command span { color: var(--muted); font-size: 13.5px; }

.cta-box { position: relative; overflow: hidden; text-align: center; padding: 72px 24px; border-radius: var(--radius-xl); background: linear-gradient(135deg, #1b1630, #121218 55%); border: 1px solid #2b2540; }
.cta-box::before { content: ""; position: absolute; left: 50%; top: -60%; width: 700px; height: 500px; transform: translateX(-50%); background: radial-gradient(closest-side, var(--accent-glow), transparent); pointer-events: none; }
.cta-box h2 { position: relative; font-size: clamp(28px, 4.2vw, 44px); font-weight: 700; letter-spacing: -0.03em; }
.cta-box p { position: relative; color: var(--text-2); margin-top: 12px; font-size: 17px; }
.cta-box .actions { position: relative; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 30px; }

.site-footer { border-top: 1px solid var(--border); margin-top: 96px; padding: 56px 0 40px; }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr repeat(2, minmax(0, 1fr)); gap: 32px; }
.site-footer h5 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--text); text-transform: uppercase; letter-spacing: .07em; }
.site-footer .links { display: grid; gap: 9px; color: var(--muted); font-size: 14.5px; }
.site-footer .links a:hover { color: var(--text); }
.site-footer .small { color: var(--muted); font-size: 13.5px; margin-top: 12px; max-width: 360px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* ---------- Home page animations ---------- */
.hero-intro .container > * { animation: hero-in .8s cubic-bezier(.2, .8, .2, 1) both; }
.hero-intro .container > :nth-child(2) { animation-delay: .08s; }
.hero-intro .container > :nth-child(3) { animation-delay: .16s; }
.hero-intro .container > :nth-child(4) { animation-delay: .24s; }
.hero-intro .container > :nth-child(5) { animation-delay: .34s; }
@keyframes hero-in { from { opacity: 0; translate: 0 22px; } }

/* landing.js adds .reveal to sections below the fold, then .in as they're scrolled to. */
.reveal { opacity: 0; translate: var(--reveal-x, 0px) var(--reveal-y, 32px); scale: var(--reveal-scale, 1); transition: opacity .7s ease, translate .8s cubic-bezier(.2, .8, .2, 1), scale .8s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--reveal-delay, 0s); }
.reveal.in { opacity: 1; translate: none; scale: none; }
.reveal-left { --reveal-x: -56px; --reveal-y: 0px; }
.reveal-right { --reveal-x: 56px; --reveal-y: 0px; }
.reveal-zoom { --reveal-y: 0px; --reveal-scale: .92; }
.mock.reveal > * { opacity: 0; translate: 0 14px; transition: opacity .5s ease, translate .6s cubic-bezier(.2, .8, .2, 1); transition-delay: var(--reveal-child-delay, 0s); }
.mock.reveal.in > * { opacity: 1; translate: none; }
@media (max-width: 900px) {
  .reveal-left, .reveal-right { --reveal-x: 0px; --reveal-y: 32px; }
}

/* ---------- Ban appeals ---------- */
.appeal-page { padding: 56px 0 24px; min-height: calc(100vh - 220px); }
.appeal-container { max-width: 760px; }
.appeal-intro { text-align: center; margin-bottom: 32px; }
.appeal-intro h1 { font-size: clamp(32px, 5.5vw, 48px); font-weight: 700; letter-spacing: -0.03em; }
.appeal-intro .lead { color: var(--text-2); max-width: 560px; margin: 14px auto 0; font-size: 17px; }
.appeal-loading { display: grid; place-items: center; padding: 48px; }
.appeal-card { padding: 24px; scroll-margin-top: 88px; }
.appeal-login { text-align: center; padding: 40px 28px; }
.appeal-login .icon-bubble { margin: 0 auto 14px; }
.appeal-login h2 { font-size: 22px; }
.appeal-login p { max-width: 460px; margin: 10px auto 22px; }
.appeal-highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 20px 60px -30px var(--accent-glow); }
.appeal-server-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.appeal-server-head .grow { flex: 1; min-width: 180px; }
.appeal-server-head h2 { font-size: 19px; }
.appeal-body { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.appeal-count { text-align: right; margin-top: 4px; }
.appeal-result { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 14px; }
.appeal-result > .icon { flex: none; margin-top: 2px; }
.appeal-result p { color: var(--text-2); margin-top: 2px; font-size: 14px; }
.appeal-accepted { background: var(--green-soft); color: var(--green-text); }
.appeal-pending { background: var(--amber-soft); color: var(--amber-text); }
.appeal-denied { background: var(--red-soft); color: var(--red-text); }
.appeal-message { padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.appeal-message p { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.appeal-answer { white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; }
.appeal-yours summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.appeal-who { font-size: 14px; }
.appeal-footer { margin-top: 48px; padding: 28px 0; }
.appeal-footer .small { max-width: none; margin: 0; text-align: center; }
.appeal-facts { margin: 0; }
@media (max-width: 560px) {
  .appeal-who { display: none; }
  .appeal-card { padding: 18px; }
}

/* ---------- 404 page ---------- */
.not-found { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 48px 0 72px; }
.not-found-robot { width: 96px; height: 96px; margin: 0 auto; animation: not-found-zoom .7s cubic-bezier(.34, 1.56, .64, 1) both, not-found-bob 3s ease-in-out .7s infinite; }
.not-found-code { font-family: var(--font-display); font-size: clamp(88px, 18vw, 160px); font-weight: 700; line-height: 1; letter-spacing: -0.04em; margin-top: 18px; animation: not-found-zoom .7s cubic-bezier(.34, 1.56, .64, 1) .12s both; }
.not-found h1, .not-found .lead, .not-found .actions { animation: not-found-rise .6s ease-out .3s both; }
.not-found .lead { animation-delay: .38s; }
.not-found .actions { animation-delay: .46s; }
.not-found h1 { font-size: clamp(26px, 4.5vw, 40px); margin-top: 18px; }
/* Zoom/rise use `scale`/`translate` so they don't fight over `transform`. */
@keyframes not-found-zoom { from { opacity: 0; scale: .3; } }
@keyframes not-found-rise { from { opacity: 0; translate: 0 14px; } }
@keyframes not-found-bob { 50% { translate: 0 -8px; } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.split-aside { grid-template-columns: 1fr; }
  /* Phones/tablets: a picked member replaces the list (with a link back). */
  .split.has-selection .members-list { display: none; }
  .split.has-selection .back-link { display: inline-flex; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 70; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(4, 5, 8, .6); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; padding: 10px 16px; background: rgba(10, 11, 14, .85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
  .topbar .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { padding: 22px 16px 56px; }
  .grid-2, .grid-3, .grid-wide { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: 32px; padding: 28px 0; }
  .feature.reverse .feature-text { order: 0; }
  .command-groups { grid-template-columns: 1fr; }
  .site-nav .links { display: none; }
  .hero { padding-top: 64px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  .site-footer .cols > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .card { padding: 18px; }
  .container, .plain-header, .picker-page { padding-left: 16px; padding-right: 16px; }
  .site-nav .nav-cta .btn-ghost { display: none; }
  .audit-time { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .not-found *, .hero-intro .container > * { animation: none !important; }
}
