/* ══════════════════════════════════════════════════════════════════
   Orin Bot Dashboard — stylesheet
   Theming via CSS custom properties, switched by [data-theme] on <html>.
   The sky-blue "active tab" glow is intentionally constant across every
   theme — it's the one consistent signature thread of the product.
   ══════════════════════════════════════════════════════════════════ */

/* ── Theme tokens ── */
:root {
  --glow: #38bdf8;
  --glow-soft: rgba(56, 189, 248, 0.35);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 248px;
}

[data-theme="midnight"] {
  --bg: #0b0e14;
  --bg-elevated: #12161f;
  --bg-elevated-2: #1a2030;
  --bg-hover: #1e2534;
  --border: #232a3b;
  --text: #e7ebf3;
  --text-muted: #8b93a7;
  --accent: #6366f1;
  --accent-hover: #7678f5;
  --accent-contrast: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow-color: 0deg 0% 0%;
}
[data-theme="aurora"] {
  --bg: #120f1e;
  --bg-elevated: #1a1530;
  --bg-elevated-2: #241c40;
  --bg-hover: #2b2249;
  --border: #2e2650;
  --text: #ede9f7;
  --text-muted: #a394c4;
  --accent: #a855f7;
  --accent-hover: #bb75fa;
  --accent-contrast: #ffffff;
  --success: #14b8a6;
  --danger: #f43f5e;
  --warning: #fbbf24;
  --shadow-color: 265deg 60% 4%;
}
[data-theme="ember"] {
  --bg: #161311;
  --bg-elevated: #201a16;
  --bg-elevated-2: #2b221c;
  --bg-hover: #332822;
  --border: #382c24;
  --text: #f3ece5;
  --text-muted: #b3a08d;
  --accent: #f97316;
  --accent-hover: #fb923c;
  --accent-contrast: #1a1310;
  --success: #84cc16;
  --danger: #ef4444;
  --warning: #eab308;
  --shadow-color: 20deg 40% 3%;
}
[data-theme="forest"] {
  --bg: #0f1512;
  --bg-elevated: #151d18;
  --bg-elevated-2: #1c2721;
  --bg-hover: #22302a;
  --border: #24332c;
  --text: #e6efe9;
  --text-muted: #8ba599;
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-contrast: #062318;
  --success: #22c55e;
  --danger: #f43f5e;
  --warning: #f59e0b;
  --shadow-color: 150deg 30% 3%;
}
[data-theme="daylight"] {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #eef1f6;
  --bg-hover: #e7ebf2;
  --border: #dde3ec;
  --text: #1a2233;
  --text-muted: #667085;
  --accent: #4f46e5;
  --accent-hover: #6259ea;
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #b45309;
  --shadow-color: 220deg 30% 80%;
}

/* ── Reset / base ── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select { font-family: inherit; }
::selection { background: var(--glow-soft); }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; display: block; }
.muted { color: var(--text-muted); }
code, .server-id { font-family: var(--font-mono); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ── Icons ── */
.icon { display: inline-flex; width: 1em; height: 1em; }
.icon svg { width: 100%; height: 100%; }
.icon--flip { transform: scaleX(-1); }

/* ── Boot loader ── */
.boot-loader { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.boot-loader__ring, .page-loader .boot-loader__ring--sm {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--glow);
  animation: spin 0.8s linear infinite;
}
.boot-loader__ring--sm { width: 28px; height: 28px; }
.page-loader { display: flex; justify-content: center; padding: 60px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 600; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn .icon { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
.btn--accent { background: var(--accent); color: var(--accent-contrast); }
.btn--accent:hover { background: var(--accent-hover); }
.btn--success { background: var(--success); color: #06210f; }
.btn--success:hover { filter: brightness(1.08); }
.btn--danger { background: var(--danger); color: #2b0808; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn--outline:hover { background: var(--bg-hover); }
.btn--outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--outline-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--lg { padding: 13px 22px; font-size: 15px; }
.btn--giant { padding: 20px 40px; font-size: 18px; border-radius: var(--radius-md); box-shadow: 0 12px 30px -10px var(--glow-soft); }
.btn--giant .icon { width: 20px; height: 20px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn .icon { width: 18px; height: 18px; }

/* ── Toasts ── */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 500; display: flex; flex-direction: column; gap: 8px; max-width: min(90vw, 360px); }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  color: var(--text); padding: 12px 14px; border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px -12px hsl(var(--shadow-color) / .6);
  opacity: 0; transform: translateX(20px); transition: opacity .22s ease, transform .22s ease;
  font-size: 13.5px;
}
.toast--show { opacity: 1; transform: translateX(0); }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warn { border-left-color: var(--warning); }

/* ── Cookie banner ── */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; top: 16px; z-index: 400;
  max-width: 560px; margin: 0 auto;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  box-shadow: 0 20px 50px -20px hsl(var(--shadow-color) / .7);
}
.cookie-banner.hidden { display: none; }
.cookie-banner__text { flex: 1; min-width: 220px; font-size: 13.5px; color: var(--text-muted); }
.cookie-banner__text strong { color: var(--text); display: block; margin-bottom: 2px; }

/* ── Theme switcher ── */
.theme-switcher { position: relative; }
.theme-menu {
  position: absolute; top: 46px; right: 0; z-index: 60;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px; min-width: 160px;
  box-shadow: 0 20px 40px -16px hsl(var(--shadow-color) / .7);
  display: none; flex-direction: column; gap: 2px;
}
.theme-menu--open { display: flex; }
.theme-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  background: transparent; border: none; color: var(--text); font-size: 13.5px; cursor: pointer; text-align: left;
}
.theme-option:hover { background: var(--bg-hover); }
.theme-option__swatch { display: flex; gap: 2px; }
.theme-option__swatch span { width: 8px; height: 14px; border-radius: 2px; display: block; }
.theme-option__swatch span:first-child { border-radius: 2px 0 0 2px; }
.theme-option__swatch span:last-child { border-radius: 0 2px 2px 0; }

/* ── Topbar ── */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; gap: 12px; }
.topbar--floating { position: relative; z-index: 10; }
.topbar__left { display: flex; align-items: center; gap: 10px; }
.topbar__right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar__user { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border); }
.topbar__username { font-size: 13.5px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--bg-elevated-2); flex-shrink: 0; }
.avatar--sm { width: 26px; height: 26px; }
.avatar--md { width: 44px; height: 44px; }
.avatar--xl { width: 84px; height: 84px; border: 3px solid var(--bg-elevated); box-shadow: 0 0 0 3px var(--glow-soft); }

/* ── Hero (logged-out home) ── */
.hero { max-width: 720px; margin: 6vh auto 0; padding: 0 24px 60px; text-align: center; }
.hero__logo { width: 84px; height: 84px; margin: 0 auto 20px; filter: drop-shadow(0 8px 20px var(--glow-soft)); }
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--glow); font-size: 12.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 22px;
}
.hero__badge .icon { width: 14px; height: 14px; }
.hero__title { font-size: clamp(34px, 6vw, 56px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; }
.hero__subtitle { font-size: 16px; color: var(--text-muted); line-height: 1.6; max-width: 520px; margin: 0 auto 34px; }
.hero__error { color: var(--danger); font-size: 14px; margin-bottom: 16px; }
.hero__actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ── Welcome (logged-in home) ── */
.welcome { display: flex; align-items: center; gap: 22px; max-width: 960px; margin: 6vh auto 0; padding: 0 24px; }
.welcome__avatar { width: 88px; height: 88px; border-radius: 50%; box-shadow: 0 0 0 4px var(--glow-soft); flex-shrink: 0; }
.welcome__title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -0.01em; margin: 0; }

.server-section { max-width: 960px; margin: 40px auto 60px; padding: 0 24px; }
.server-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.server-section__head h2 { font-size: 18px; margin: 0; }

.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.skeleton-grid { display: contents; }
.skeleton-card { height: 74px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-elevated-2) 50%, var(--bg-elevated) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; grid-column: span 1; }
@keyframes shimmer { to { background-position: -200% 0; } }

.guild-card {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border); transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.guild-card:hover { border-color: var(--glow); box-shadow: 0 0 0 1px var(--glow-soft), 0 12px 24px -14px var(--shadow-color); transform: translateY(-1px); }
.guild-card__icon { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.guild-card__icon--fallback { display: flex; align-items: center; justify-content: center; background: var(--bg-elevated-2); font-weight: 700; color: var(--text-muted); }
.guild-card__body { flex: 1; min-width: 0; }
.guild-card__name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card__meta { font-size: 12.5px; color: var(--text-muted); }
.guild-card__chevron { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.empty-state { padding: 32px 20px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius-md); }
.empty-state--error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.empty-state .btn { margin-top: 14px; }

/* ── Shell (sidebar + content) ── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-elevated); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar__brand { display: flex; justify-content: center; padding: 4px 0 2px; }
.sidebar__brand-logo { width: 40px; height: 40px; border-radius: 10px; }
.sidebar__back { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; color: var(--text-muted); border-radius: 8px; }
.sidebar__back:hover { color: var(--text); background: var(--bg-hover); }
.sidebar__back .icon { width: 15px; height: 15px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar__item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  color: var(--text-muted); font-size: 14px; font-weight: 500; position: relative;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar__item .icon { width: 18px; height: 18px; }
.sidebar__item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar__item--active {
  color: var(--glow); background: color-mix(in srgb, var(--glow) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--glow), 0 0 18px -4px var(--glow-soft);
}
.sidebar__item--active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%; background: var(--glow); border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px 1px var(--glow);
}

.sidebar-backdrop { display: none; }

.shell__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; max-width: 900px; width: 100%; margin: 0 auto; padding: 8px 24px 100px; }

.sidebar-toggle { display: none; }

/* ── Page head ── */
.page-head { display: flex; align-items: center; gap: 16px; margin: 10px 0 24px; }
.page-head--simple { margin-bottom: 6px; }
.page-head__icon { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; }
.page-head__icon--fallback { display: flex; align-items: center; justify-content: center; background: var(--bg-elevated-2); font-weight: 700; font-size: 20px; color: var(--text-muted); }
.page-head__title { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }

/* ── Cards ── */
.card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 18px;
}
.card__eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 14px;
}
.card__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.server-id { font-size: 13px; color: var(--text-muted); background: var(--bg-elevated-2); padding: 6px 10px; border-radius: 8px; }

/* ── Embed-style stat grid ── */
.embed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.embed-stat { display: flex; flex-direction: column; gap: 4px; background: var(--bg-elevated-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.embed-stat__label { font-size: 12px; color: var(--text-muted); }
.embed-stat__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field__required { font-size: 11px; font-weight: 600; color: var(--danger); text-transform: none; margin-left: 4px; }
.field__row { display: flex; gap: 8px; }
.field__row .input { flex: 1; }
.input {
  background: var(--bg-elevated-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: var(--glow); box-shadow: 0 0 0 3px var(--glow-soft); outline: none; }
.input--mono { font-family: var(--font-mono); }
.input--invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
select.input { cursor: pointer; }
.textarea { resize: vertical; min-height: 90px; font-family: inherit; line-height: 1.5; }
.field__hint { font-size: 12px; color: var(--text-muted); }
.toggle-line { display: flex; align-items: center; gap: 12px; }
.toggle-line__label { font-size: 14px; font-weight: 600; }

/* ── Level roles (Leveling Setup) ── */
.level-role-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.level-role-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated-2); border: 1px solid var(--border);
}
.level-role-row__arrow { color: var(--text-muted); }
.level-role-row__role { font-weight: 600; font-size: 13.5px; flex: 1; }
.level-role-row__remove { width: 30px; height: 30px; margin-left: auto; }
.level-role-row__remove .icon { width: 14px; height: 14px; }
.level-role-add { display: flex; gap: 8px; flex-wrap: wrap; }
.level-role-add .input { flex: 1; min-width: 160px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.radio-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; }
.radio-option input[type="radio"] { margin-top: 3px; accent-color: var(--accent); }
.radio-option__title { font-weight: 600; font-size: 13.5px; }
.radio-option__hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Unsaved-changes bar ── */
.unsaved-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: 18px; background: var(--bg-elevated);
  border: 1px solid var(--warning); border-radius: var(--radius-md); padding: 12px 16px 12px 18px;
  box-shadow: 0 20px 50px -18px hsl(var(--shadow-color) / .8);
  z-index: 90; transition: transform .2s ease, opacity .2s ease, visibility .2s;
  font-size: 13.5px; font-weight: 600; color: var(--warning);
  opacity: 0; visibility: hidden; pointer-events: none;
}
.unsaved-bar--show { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; }
.unsaved-bar .icon { width: 16px; height: 16px; }
.unsaved-bar__actions { display: flex; gap: 8px; }

/* ── Toolbar / search ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.search-input {
  display: flex; align-items: center; gap: 8px; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; flex: 1; min-width: 200px; max-width: 340px;
}
.search-input .icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-input input { border: none; background: transparent; color: var(--text); font-size: 14px; width: 100%; outline: none; }

/* ── Command list ── */
.command-list { display: flex; flex-direction: column; gap: 6px; }
.command-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
}
.command-row__body { flex: 1; min-width: 0; }
.command-row__name { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; }
.command-row__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-row--sub { margin-left: 34px; padding: 9px 14px; background: var(--bg-elevated-2); }
.kiss-toggle-chevron { transform: rotate(90deg); transition: transform .15s ease; }
.kiss-toggle-chevron.is-expanded { transform: rotate(-90deg); }

/* ── Toggle switch ── */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; background: var(--bg-elevated-2); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: background-color .15s ease; }
.switch__track::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .18s ease; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch__track { background: var(--success); border-color: var(--success); }
.switch input:checked + .switch__track::before { transform: translateX(18px); }
.switch input:disabled + .switch__track { opacity: .5; cursor: not-allowed; }

/* ── Pills ── */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.pill--on { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.pill--off { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.pill--accent { background: color-mix(in srgb, var(--glow) 18%, transparent); color: var(--glow); text-transform: none; }
.pill--level { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }

/* ── Member list ── */
.member-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.member-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border); transition: border-color .15s ease;
}
.member-row:hover { border-color: var(--glow); }
.member-row__body { flex: 1; min-width: 0; }
.member-row__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-row__username { font-size: 12px; color: var(--text-muted); }
.member-row__chevron { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }

/* ── Pager ── */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 22px 0; }
.pager__label { font-size: 13px; color: var(--text-muted); }

/* ── Back link (user detail) ── */
.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted); margin-bottom: 18px; }
.back-link:hover { color: var(--text); }
.back-link .icon { width: 15px; height: 15px; }

/* ── Profile head ── */
.profile-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.profile-head__name { font-size: 24px; font-weight: 800; margin: 0 0 4px; }
.profile-head__meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

/* ── Family tree ── */
.family-tree__couple { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 10px 0 20px; }
.family-avatar { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; text-align: center; }
.family-avatar img { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 3px var(--glow-soft); }
.family-tree__heart { font-size: 22px; }
.family-tree__children { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.family-tree__none { text-align: center; }
.family-tree__since { text-align: center; font-size: 12.5px; margin: -8px 0 16px; }
.child-card { background: var(--bg-elevated-2); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.child-card__name { font-weight: 600; font-size: 13.5px; }
.child-card__hunger { font-size: 11.5px; color: var(--text-muted); }
.hunger-bar { width: 100%; height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.hunger-bar__fill { height: 100%; background: linear-gradient(90deg, var(--warning), var(--success)); }

/* ── Inventory ── */
.item-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.item-chip {
  display: flex; align-items: center; gap: 7px; background: var(--bg-elevated-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px 6px 8px; font-size: 13px;
}
.item-emoji { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.item-chip__name { font-weight: 500; }
.item-chip__qty { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Team ── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.team-card { background: var(--bg-elevated-2); border-radius: var(--radius-sm); padding: 14px; }
.team-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.team-card__animal { font-weight: 700; font-size: 14px; }
.team-card__xp { font-size: 12px; margin-bottom: 8px; }
.team-card__weapon { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 8px; }
.team-card__buffs { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-chip { font-size: 11px; font-weight: 600; background: var(--bg-hover); padding: 3px 8px; border-radius: 6px; color: var(--text-muted); }

/* ── Logs table ── */
/* table-layout:fixed plus explicit widths is what keeps a long "details"
   string (a 256-character giveaway title, a save that changed a dozen
   settings, a jump URL with no spaces in it) wrapping inside its own
   column instead of stretching the table sideways and squashing every
   other column into unreadable slivers. The wrapper keeps the whole thing
   scrollable rather than overflowing on a narrow screen. */
.log-table-wrap { width: 100%; overflow-x: auto; }
.log-table { width: 100%; min-width: 560px; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.log-table th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.log-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table th:nth-child(1), .log-table td:nth-child(1) { width: 174px; }
.log-table th:nth-child(2), .log-table td:nth-child(2) { width: 132px; }
.log-table th:nth-child(3), .log-table td:nth-child(3) { width: 166px; }
.log-table__time { color: var(--text-muted); white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.log-table__user { overflow-wrap: anywhere; }
.log-table__action .pill { max-width: 100%; white-space: normal; text-align: left; }
.log-table__details { overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; line-height: 1.5; }
.log-table tr:last-child td { border-bottom: none; }
.pager__arrow { padding-left: 11px; padding-right: 11px; }

/* ══════════════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 20px 0 40px -20px rgba(0,0,0,.5);
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39;
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar-backdrop--show { opacity: 1; pointer-events: auto; }
  .content { padding: 8px 16px 100px; }
  .welcome { flex-direction: column; text-align: center; gap: 14px; }
  .topbar { padding: 14px 16px; }
}

@media (max-width: 620px) {
  .topbar__username { display: none; }
  .guild-grid, .member-list, .team-grid { grid-template-columns: 1fr; }
  .embed-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { margin-top: 4vh; }
  .btn--giant { width: 100%; padding: 18px 24px; }
  .card { padding: 16px; }
  .unsaved-bar { left: 16px; right: 16px; bottom: 16px; transform: translateY(20px); flex-direction: column; align-items: stretch; text-align: center; }
  .unsaved-bar--show { transform: translateY(0); }
  .unsaved-bar__actions { justify-content: center; }
  .family-tree__couple { gap: 14px; }
}

/* ── Security (anti-nuke) ── */
.subsection-title { font-size: 15px; font-weight: 800; letter-spacing: .02em; margin: 28px 2px 12px; color: var(--text); }
.limit-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 20px; }
.limit-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.limit-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.limit-card__title { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text); }
.limit-card__fields { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.limit-card__fields .field { flex: 1; min-width: 110px; }
.input:disabled, select.input:disabled { opacity: .45; cursor: not-allowed; }
.member-picker-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.member-picker-results:empty { display: none; margin: 0; }
