/* =========================================
   RAD & MTLH Recruitment — Design System
   Sombre / premium / doré-cuivré
   ========================================= */

:root {
  /* Backgrounds */
  --bg-0: oklch(0.13 0.012 260);          /* deepest */
  --bg-1: oklch(0.16 0.012 260);          /* page */
  --bg-2: oklch(0.19 0.014 258);          /* card */
  --bg-3: oklch(0.23 0.014 258);          /* elevated */
  --bg-4: oklch(0.28 0.015 258);          /* input */

  /* Borders */
  --line-soft: oklch(0.28 0.012 258 / 0.6);
  --line: oklch(0.34 0.014 258 / 0.7);
  --line-strong: oklch(0.42 0.014 258 / 0.8);

  /* Text */
  --ink: oklch(0.94 0.008 80);
  --ink-dim: oklch(0.72 0.008 80);
  --ink-mute: oklch(0.55 0.008 260);
  --ink-faint: oklch(0.42 0.008 260);

  /* Accents — gold & copper share chroma family */
  --gold: oklch(0.82 0.12 78);
  --gold-deep: oklch(0.68 0.13 65);
  --copper: oklch(0.62 0.14 45);
  --copper-deep: oklch(0.48 0.12 40);

  /* Guild colors */
  --rad: oklch(0.82 0.12 78);             /* radiant gold */
  --rad-deep: oklch(0.62 0.14 60);
  --rad-glow: oklch(0.82 0.12 78 / 0.18);
  --mtlh: oklch(0.78 0.018 240);          /* cold metal */
  --mtlh-deep: oklch(0.58 0.02 245);
  --mtlh-glow: oklch(0.78 0.018 240 / 0.16);

  /* Status */
  --ok: oklch(0.72 0.13 150);
  --warn: oklch(0.78 0.13 80);
  --bad: oklch(0.65 0.18 25);
  --info: oklch(0.72 0.09 230);

  /* Type — system stack first (native SF Pro on Apple devices), Inter as cross-platform fallback */
  --f-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --f-display: var(--f-system);
  --f-sans: var(--f-system);
  --f-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* Spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;

  --r-sm: 4px; --r: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;

  --t-fast: 120ms cubic-bezier(.2,.7,.3,1);
  --t: 220ms cubic-bezier(.2,.7,.3,1);
  --t-slow: 420ms cubic-bezier(.22,.8,.28,1);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.22 0.04 70 / 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 100%, oklch(0.2 0.04 250 / 0.22), transparent 60%),
    var(--bg-0);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--gold); color: var(--bg-0); }

/* =====  App shell  ===== */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s6);
  padding: var(--s4) var(--s8);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, oklch(0.16 0.012 260 / 0.9), oklch(0.14 0.012 260 / 0.6));
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--s3);
  font-family: var(--f-display);
  font-size: 20px;
  letter-spacing: 0.08em;
}
.topbar__brand .glyph {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-deep);
  color: var(--gold);
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
}
.topbar__nav {
  display: flex; gap: var(--s2); margin-left: var(--s4);
}
.topbar__nav button {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink-dim);
  border-radius: var(--r);
  transition: var(--t-fast);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.topbar__nav button:hover { color: var(--ink); background: var(--bg-2); }
.topbar__nav button.is-active {
  color: var(--gold);
  background: oklch(0.82 0.12 78 / 0.08);
}
.topbar__spacer { flex: 1; }

.topbar__user {
  display: flex; align-items: center; gap: var(--s3);
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  transition: var(--t-fast);
}
.topbar__user:hover { border-color: var(--line); }

/* =====  Reusable typography  ===== */
.eyebrow {
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--gold);
}
.eyebrow--mute { color: var(--ink-mute); }
.display {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}
h1.display { font-size: clamp(40px, 6vw, 88px); }
h2.display { font-size: clamp(28px, 3.6vw, 52px); }
h3.display { font-size: clamp(22px, 2.4vw, 32px); }
.subtle { color: var(--ink-dim); }
.faint  { color: var(--ink-mute); }
.mono   { font-family: var(--f-mono); letter-spacing: 0; }

/* =====  Buttons  ===== */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 10px 18px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: var(--t-fast);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: oklch(0.18 0.012 60);
  border-color: var(--gold-deep);
}
.btn--primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 8px 24px -10px var(--gold), 0 0 0 1px var(--gold) inset;
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--bg-2);
  border-color: var(--line-strong);
}
.btn--danger {
  background: transparent;
  color: var(--bad);
  border-color: oklch(0.65 0.18 25 / 0.4);
}
.btn--danger:hover:not(:disabled) { background: oklch(0.65 0.18 25 / 0.1); }
.btn--ok {
  background: oklch(0.72 0.13 150 / 0.15);
  color: var(--ok);
  border-color: oklch(0.72 0.13 150 / 0.4);
}
.btn--ok:hover:not(:disabled) { background: oklch(0.72 0.13 150 / 0.25); }
.btn--discord {
  background: oklch(0.55 0.16 275);
  color: white;
  border-color: oklch(0.62 0.16 275);
  padding: 14px 22px;
}
.btn--discord:hover:not(:disabled) {
  background: oklch(0.6 0.16 275);
  box-shadow: 0 8px 24px -10px oklch(0.55 0.16 275);
}
.btn--lg { padding: 14px 26px; font-size: 14px; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--icon { padding: 8px; }

/* =====  Inputs  ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--f-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  color: var(--ink-mute);
}
.field label .req { color: var(--copper); }
.input, .textarea, .select {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 11px 14px;
  color: var(--ink);
  transition: var(--t-fast);
  width: 100%;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--gold-deep);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px oklch(0.82 0.12 78 / 0.1);
}
.textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.field-hint { font-size: 11.5px; color: var(--ink-mute); font-family: var(--f-mono); }
.field-error { color: var(--bad); font-size: 12px; }

/* =====  Cards  ===== */
.card {
  background: linear-gradient(180deg, var(--bg-2), oklch(0.17 0.013 258));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: var(--s6);
  position: relative;
}
.card--lift:hover {
  border-color: var(--line);
  transform: translateY(-2px);
  transition: var(--t);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.card__title {
  font-family: var(--f-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* =====  Badges  ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid transparent;
  font-weight: 500;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--rad { color: var(--rad); background: var(--rad-glow); border-color: oklch(0.82 0.12 78 / 0.3); }
.badge--mtlh { color: var(--mtlh); background: var(--mtlh-glow); border-color: oklch(0.78 0.018 240 / 0.3); }
.badge--pending { color: var(--warn); background: oklch(0.78 0.13 80 / 0.1); border-color: oklch(0.78 0.13 80 / 0.3); }
.badge--review { color: var(--info); background: oklch(0.72 0.09 230 / 0.1); border-color: oklch(0.72 0.09 230 / 0.3); }
.badge--accepted { color: var(--ok); background: oklch(0.72 0.13 150 / 0.1); border-color: oklch(0.72 0.13 150 / 0.3); }
.badge--rejected { color: var(--bad); background: oklch(0.65 0.18 25 / 0.1); border-color: oklch(0.65 0.18 25 / 0.3); }
.badge--role { color: var(--ink); background: var(--bg-3); border-color: var(--line); }

/* =====  Avatars  ===== */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-dim);
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar--lg { width: 56px; height: 56px; font-size: 16px; }
.avatar--xl { width: 88px; height: 88px; font-size: 24px; }
.avatar--rad { color: var(--rad); border-color: oklch(0.82 0.12 78 / 0.4); background: var(--rad-glow); }
.avatar--mtlh { color: var(--mtlh); border-color: oklch(0.78 0.018 240 / 0.4); background: var(--mtlh-glow); }

/* =====  Page containers  ===== */
.container { max-width: 1280px; margin: 0 auto; padding: var(--s8); }
.container--narrow { max-width: 720px; }
.container--wide { max-width: 1480px; }

/* Decorative line */
.hairline {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  border: 0;
  margin: var(--s6) 0;
}
.hairline--gold { background: linear-gradient(90deg, transparent, var(--gold-deep), transparent); }

/* =====  Landing page  ===== */
.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  position: relative;
  padding: var(--s16) var(--s8);
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, oklch(0.82 0.12 78 / 0.4) 0, transparent 100%),
    radial-gradient(1px 1px at 60% 70%, oklch(0.82 0.12 78 / 0.3) 0, transparent 100%),
    radial-gradient(1.5px 1.5px at 80% 20%, oklch(0.82 0.12 78 / 0.5) 0, transparent 100%),
    radial-gradient(1px 1px at 35% 80%, oklch(0.78 0.018 240 / 0.4) 0, transparent 100%),
    radial-gradient(1px 1px at 90% 50%, oklch(0.82 0.12 78 / 0.4) 0, transparent 100%),
    radial-gradient(2px 2px at 10% 60%, oklch(0.78 0.018 240 / 0.5) 0, transparent 100%),
    radial-gradient(1px 1px at 50% 10%, oklch(0.82 0.12 78 / 0.3) 0, transparent 100%);
  pointer-events: none;
}
.hero__inner { max-width: 1080px; text-align: center; position: relative; z-index: 1; }
.hero h1 { margin: var(--s4) 0 var(--s6); }
.hero h1 .accent { color: var(--gold); font-style: italic; }
.hero p.lead {
  font-size: 19px; max-width: 640px; margin: 0 auto var(--s8);
  color: var(--ink-dim);
  white-space: pre-line;
}
.hero__cta { display: flex; gap: var(--s4); justify-content: center; flex-wrap: wrap; }

.guilds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s6);
  margin-top: var(--s12);
}
@media (max-width: 880px) { .guilds { grid-template-columns: 1fr; } }

.guild-card {
  padding: var(--s10) var(--s8);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: var(--t);
}
.guild-card--rad {
  background:
    radial-gradient(600px 200px at 50% -10%, var(--rad-glow), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.guild-card--rad:hover {
  border-color: oklch(0.82 0.12 78 / 0.5);
  box-shadow: 0 30px 80px -40px oklch(0.82 0.12 78 / 0.4);
}
.guild-card--mtlh {
  background:
    radial-gradient(600px 200px at 50% -10%, var(--mtlh-glow), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.guild-card--mtlh:hover {
  border-color: oklch(0.78 0.018 240 / 0.5);
  box-shadow: 0 30px 80px -40px oklch(0.78 0.018 240 / 0.3);
}
.guild-card__sigil {
  width: 96px; height: 96px;
  display: grid; place-items: center;
  border-radius: 50%;
  margin: 0 auto var(--s6);
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  position: relative;
}
.guild-card__sigil::after {
  content: "";
  position: absolute; inset: -8px;
  border-radius: 50%;
  border: 1px dashed currentColor;
  opacity: 0.3;
}
.guild-card--rad .guild-card__sigil { color: var(--rad); border: 1px solid var(--rad); background: var(--rad-glow); }
.guild-card--mtlh .guild-card__sigil { color: var(--mtlh); border: 1px solid var(--mtlh); background: var(--mtlh-glow); }
.guild-card__motto {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 18px;
  color: var(--ink-dim);
  margin: var(--s4) 0 var(--s6);
}
.guild-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--s2); margin-top: var(--s6);
  border-top: 1px solid var(--line-soft);
  padding-top: var(--s6);
}
.guild-stats__item { text-align: center; }
.guild-stats__value {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 500;
}
.guild-stats__label {
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  margin-top: 4px;
}

/* =====  Auth screens  ===== */
.center-stage {
  min-height: calc(100vh - 72px);
  display: grid; place-items: center;
  padding: var(--s10) var(--s6);
}
.auth-card { max-width: 460px; width: 100%; padding: var(--s10); }
.auth-card .glyph-big {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 1px solid var(--gold-deep);
  color: var(--gold);
  display: grid; place-items: center;
  font-family: var(--f-mono);
  margin: 0 auto var(--s5);
}

/* =====  Tabs (admin)  ===== */
.tabs {
  display: flex; gap: var(--s2);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s6);
}
.tabs button {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: 0.04em;
  transition: var(--t-fast);
  font-weight: 500;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active {
  color: var(--gold);
  border-color: var(--gold);
}
.tabs__count {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 6px;
  font-size: 10px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--ink-mute);
  font-family: var(--f-mono);
}
.tabs button.is-active .tabs__count { background: var(--rad-glow); color: var(--gold); }

/* =====  Candidate row / table  ===== */
.candidate-list { display: flex; flex-direction: column; gap: var(--s3); }
.candidate-row {
  display: grid;
  grid-template-columns: 44px 1.5fr 1fr 1fr 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  transition: var(--t-fast);
  cursor: pointer;
}
.candidate-row:hover { background: var(--bg-3); border-color: var(--line); }
.candidate-row.is-active { border-color: var(--gold-deep); background: var(--bg-3); }
.candidate-row__name {
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: var(--s2);
}
.candidate-row__uid {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.candidate-row__power {
  font-family: var(--f-display);
  font-size: 18px;
  color: var(--gold);
}
.candidate-row__meta {
  font-size: 12px;
  color: var(--ink-dim);
  font-family: var(--f-mono);
}

/* =====  Vote pills  ===== */
.votes {
  display: inline-flex;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
}
.vote-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--ink-mute);
  border: 1px solid var(--line-soft);
}
.vote-pill.up { color: var(--ok); border-color: oklch(0.72 0.13 150 / 0.3); background: oklch(0.72 0.13 150 / 0.08); }
.vote-pill.dn { color: var(--bad); border-color: oklch(0.65 0.18 25 / 0.3); background: oklch(0.65 0.18 25 / 0.08); }

/* =====  Detail panel  ===== */
.detail-grid {
  display: grid; grid-template-columns: 1fr 380px;
  gap: var(--s6);
}
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.kv {
  display: grid; grid-template-columns: 130px 1fr;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}
.kv:last-child { border-bottom: none; }
.kv__k {
  font-family: var(--f-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}
.kv__v { color: var(--ink); }
.kv__v.mono { font-family: var(--f-mono); font-size: 13px; }

/* =====  Chat  ===== */
.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.chat__head {
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-2);
}
.chat__title {
  font-family: var(--f-display);
  font-size: 18px;
}
.chat__sub {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
  letter-spacing: 0.08em;
}
.chat__participants {
  display: flex; gap: -4px; margin-top: var(--s2);
}
.chat__participants .avatar {
  width: 24px; height: 24px; font-size: 9px;
  margin-left: -6px; border: 2px solid var(--bg-2);
}
.chat__participants .avatar:first-child { margin-left: 0; }

.chat__messages {
  overflow-y: auto;
  padding: var(--s5);
  display: flex; flex-direction: column; gap: var(--s4);
}
.chat__day {
  text-align: center;
  font-family: var(--f-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  position: relative;
  margin: var(--s4) 0;
}
.chat__day::before, .chat__day::after {
  content: ""; position: absolute; top: 50%;
  width: calc(50% - 60px);
  height: 1px; background: var(--line-soft);
}
.chat__day::before { left: 0; }
.chat__day::after { right: 0; }

.msg { display: flex; gap: var(--s3); }
.msg__bubble {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  padding: 8px 12px;
  border-radius: 12px 12px 12px 4px;
  max-width: 500px;
}
.msg__head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: 2px; }
.msg__name { font-weight: 600; font-size: 13px; }
.msg__time { font-family: var(--f-mono); font-size: 10px; color: var(--ink-mute); }
.msg__role { font-family: var(--f-mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em; }
.msg.is-self { flex-direction: row-reverse; }
.msg.is-self .msg__bubble {
  background: linear-gradient(180deg, oklch(0.82 0.12 78 / 0.18), oklch(0.82 0.12 78 / 0.08));
  border-color: oklch(0.82 0.12 78 / 0.3);
  border-radius: 12px 12px 4px 12px;
}
.msg.is-system .msg__bubble {
  background: oklch(0.72 0.09 230 / 0.08);
  border-color: oklch(0.72 0.09 230 / 0.25);
  font-style: italic;
  color: var(--ink-dim);
  font-size: 13px;
}
.msg.is-vote .msg__bubble {
  background: var(--bg-3);
  border: 1px dashed var(--line);
}
.msg__vote-bar {
  display: flex; gap: var(--s2); margin-top: var(--s2);
}
.msg__vote-bar button {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-family: var(--f-mono);
  font-size: 11px;
  border: 1px solid var(--line);
  transition: var(--t-fast);
}
.msg__vote-bar .up:hover, .msg__vote-bar .up.active { background: oklch(0.72 0.13 150 / 0.15); color: var(--ok); border-color: oklch(0.72 0.13 150 / 0.4); }
.msg__vote-bar .dn:hover, .msg__vote-bar .dn.active { background: oklch(0.65 0.18 25 / 0.15); color: var(--bad); border-color: oklch(0.65 0.18 25 / 0.4); }
.msg__vote-bar .ab:hover, .msg__vote-bar .ab.active { background: var(--bg-4); color: var(--ink); border-color: var(--line-strong); }

.typing {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-mute);
}
.typing__dots { display: inline-flex; gap: 3px; }
.typing__dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-mute);
  animation: typing 1.2s infinite ease-in-out;
}
.typing__dots span:nth-child(2) { animation-delay: 0.15s; }
.typing__dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat__composer {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
  display: flex; align-items: end; gap: var(--s3);
}
.chat__composer textarea {
  flex: 1; background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 10px 12px; color: var(--ink); resize: none;
  font-family: inherit; font-size: 14px; max-height: 120px; min-height: 40px;
  outline: none;
}
.chat__composer textarea:focus { border-color: var(--gold-deep); }

/* =====  Status pill  ===== */
.status-large {
  display: inline-flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s6);
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
}
.status-large__dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: currentColor;
  position: relative;
}
.status-large__dot::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%; background: currentColor; opacity: 0.3;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.5); opacity: 0; }
}
.status-large.pending { color: var(--warn); }
.status-large.review { color: var(--info); }
.status-large.accepted { color: var(--ok); }
.status-large.rejected { color: var(--bad); }

/* =====  Stepper  ===== */
.stepper {
  display: flex; align-items: center; gap: var(--s3);
  margin-bottom: var(--s8);
}
.stepper__step {
  display: flex; align-items: center; gap: var(--s3);
  font-family: var(--f-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-mute);
}
.stepper__num {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 12px;
}
.stepper__step.done { color: var(--gold); }
.stepper__step.done .stepper__num { border-color: var(--gold); background: var(--rad-glow); }
.stepper__step.current { color: var(--ink); }
.stepper__step.current .stepper__num { border-color: var(--gold); color: var(--gold); }
.stepper__line { flex: 1; height: 1px; background: var(--line); max-width: 80px; }
.stepper__line.done { background: var(--gold); }

/* =====  Guild selector  ===== */
.guild-picker { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.guild-pick {
  padding: var(--s6);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--t);
  text-align: center;
  background: var(--bg-2);
}
.guild-pick:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.guild-pick.selected { border-width: 2px; padding: calc(var(--s6) - 1px); }
.guild-pick--rad.selected { border-color: var(--rad); background: var(--rad-glow); }
.guild-pick--mtlh.selected { border-color: var(--mtlh); background: var(--mtlh-glow); }

/* =====  Roster cards (final accepted)  ===== */
.roster {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s4);
}
.roster__card {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: var(--s5);
  display: flex; flex-direction: column; gap: var(--s3);
}
.roster__card.is-rad { border-left: 3px solid var(--rad); }
.roster__card.is-mtlh { border-left: 3px solid var(--mtlh); }

/* =====  Misc  ===== */
.row { display: flex; align-items: center; gap: var(--s3); }
.row--gap2 { gap: var(--s2); }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: var(--s3); }
.col--gap4 { gap: var(--s4); }
.col--gap6 { gap: var(--s6); }
.col--gap8 { gap: var(--s8); }
.mt-4 { margin-top: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mt-8 { margin-top: var(--s8); }
.text-center { text-align: center; }

.empty {
  text-align: center; padding: var(--s12);
  color: var(--ink-mute);
  font-family: var(--f-mono); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
}

.divider-v { width: 1px; background: var(--line-soft); align-self: stretch; }

/* =====  Role switcher (demo)  ===== */
.role-switcher {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  box-shadow: 0 16px 40px -20px black;
  font-family: var(--f-mono);
  font-size: 11px;
}
.role-switcher__title {
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gold);
  font-size: 10px;
  margin-bottom: var(--s2);
}
.role-switcher__row { display: flex; gap: 4px; flex-wrap: wrap; max-width: 380px; }
.role-switcher button {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
  font-size: 10.5px;
  color: var(--ink-dim);
  transition: var(--t-fast);
  font-family: var(--f-mono);
}
.role-switcher button:hover { background: var(--bg-4); color: var(--ink); }
.role-switcher button.active {
  background: var(--gold);
  color: var(--bg-0);
  border-color: var(--gold);
  font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* =================================================================
   TEAM MANAGEMENT (Prince Dashboard)
   ================================================================= */
.creds-banner {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s6);
  background: oklch(0.72 0.13 150 / 0.08);
  border-bottom: 1px solid oklch(0.72 0.13 150 / 0.35);
}
.creds-banner__pwd {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.creds-banner__pwd > .mono {
  flex: 1; min-width: 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  word-break: break-all;
  color: var(--ok);
}
.team-creds {
  background: var(--bg-1);
  padding: var(--s3) var(--s6);
  border-bottom: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: var(--s2);
}
.team-creds__row {
  display: flex; align-items: center; gap: var(--s3);
  flex-wrap: wrap;
}
.team-creds__row .mono {
  font-size: 13px;
  letter-spacing: 0.02em;
  word-break: break-all;
}

.team-add {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr auto;
  gap: var(--s4);
  padding: var(--s5) var(--s5);
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
  align-items: end;
}
.team-add__actions { display: flex; gap: var(--s2); justify-content: flex-end; }
@media (max-width: 880px) {
  .team-add { grid-template-columns: 1fr; gap: var(--s3); }
  .team-add__actions { justify-content: stretch; }
  .team-add__actions .btn { flex: 1; justify-content: center; }
}

.team-list { display: flex; flex-direction: column; }
.team-list__head {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1.2fr;
  gap: var(--s4);
  padding: 10px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--f-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}
.team-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1.2fr;
  gap: var(--s4);
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line-soft);
  transition: var(--t-fast);
}
.team-row:last-child { border-bottom: none; }
.team-row:hover { background: var(--bg-2); }
.team-row--editing { background: var(--bg-3); }
.team-row .select { padding: 8px 10px; font-size: 13px; }

@media (max-width: 880px) {
  .team-list__head { display: none; }
  .team-row {
    grid-template-columns: 1fr;
    gap: var(--s2);
    padding: var(--s4);
  }
  .team-row > :nth-child(4) { justify-content: flex-start; }
}
.admin-fullview {
  height: calc(100dvh - 73px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  padding: 0;
}
.admin-fullview__head {
  display: flex;
  align-items: center;
  gap: var(--s5);
  padding: var(--s4) var(--s8);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.admin-fullview__title {
  font-size: 24px;
  margin-top: 4px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-fullview__tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-wrap: wrap;
}
.admin-fullview__tabs button {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--ink-dim);
  border-radius: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  transition: var(--t-fast);
  font-family: var(--f-mono);
  background: transparent;
}
.admin-fullview__tabs button:hover { color: var(--ink); background: var(--bg-2); }
.admin-fullview__tabs button.is-active {
  color: var(--gold);
  background: oklch(0.82 0.12 78 / 0.1);
}

.admin-fullview__mobiletabs { display: none; }

.admin-fullview__body {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(320px, 1fr) minmax(360px, 460px);
  min-height: 0;
  overflow: hidden;
}
.admin-col {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.admin-col--list   { border-right: 1px solid var(--line-soft); }
.admin-col--detail { border-right: 1px solid var(--line-soft); background: oklch(0.16 0.012 260 / 0.4); }
.admin-col--chat   { background: var(--bg-1); }

/* Reset chat border to play nicely as a column */
.admin-col--chat .chat {
  border: 0;
  border-radius: 0;
  height: 100%;
}

/* List */
.admin-list-compact {
  overflow-y: auto;
  flex: 1;
  padding: var(--s3);
  display: flex; flex-direction: column; gap: 4px;
}
.candidate-compact {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  transition: var(--t-fast);
  width: 100%;
}
.candidate-compact:hover { background: var(--bg-2); border-color: var(--line-soft); }
.candidate-compact.is-active {
  background: oklch(0.82 0.12 78 / 0.08);
  border-color: var(--gold-deep);
}
.candidate-compact__main { min-width: 0; }
.candidate-compact__name {
  font-weight: 600; color: var(--ink); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.candidate-compact__sub {
  font-size: 11px; color: var(--ink-mute); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.candidate-compact__right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.candidate-compact__votes { font-size: 10px; }
.candidate-compact__votes .votes { gap: 3px; }
.candidate-compact__votes .vote-pill { padding: 2px 5px; font-size: 9.5px; }

/* Detail */
.admin-detail-compact {
  display: flex; flex-direction: column;
  min-height: 0;
  height: 100%;
}
.admin-detail-compact__head {
  display: flex; gap: var(--s3); align-items: center;
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
}
.admin-detail-compact__name {
  font-family: var(--f-display);
  font-size: 22px;
  line-height: 1.1;
}
.admin-detail-compact__scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4) var(--s5);
  min-height: 0;
}
.admin-detail-compact__kv {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.admin-kv-item {
  padding: var(--s2) 0;
}
.admin-kv-item__v {
  color: var(--ink);
  font-size: 14px;
  margin-top: 2px;
}
.admin-kv-item__v.mono { font-family: var(--f-mono); font-size: 12.5px; }
.admin-kv-item__v.accent {
  color: var(--gold);
  font-family: var(--f-display);
  font-size: 22px;
}
.admin-detail-compact__motiv {
  padding-top: var(--s3);
  border-top: 1px solid var(--line-soft);
  margin-bottom: var(--s4);
}
.admin-detail-compact__votes {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4);
  background: var(--bg-1);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.admin-detail-compact__actions {
  display: flex; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-2);
}

/* === Tablet: collapse chat into the middle column / show 2 cols === */
@media (max-width: 1180px) {
  .admin-fullview__body {
    grid-template-columns: minmax(260px, 320px) 1fr minmax(320px, 380px);
  }
  .admin-detail-compact__kv { grid-template-columns: 1fr; gap: var(--s2); }
}

/* === Mobile drill-in === */
@media (max-width: 880px) {
  .admin-fullview { grid-template-rows: auto auto 1fr; }
  .admin-fullview__head { padding: var(--s3) var(--s4); gap: var(--s2); }
  .admin-fullview__title { font-size: 18px; }
  .admin-fullview__tabs {
    margin-left: 0; width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .admin-fullview__tabs::-webkit-scrollbar { display: none; }
  .admin-fullview__tabs button { white-space: nowrap; }

  .admin-fullview__mobiletabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg-1);
  }
  .admin-fullview__mobiletabs button {
    padding: 10px 8px;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-mute);
    border-bottom: 2px solid transparent;
    transition: var(--t-fast);
  }
  .admin-fullview__mobiletabs button:disabled { opacity: 0.35; }
  .admin-fullview__mobiletabs button.is-active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: oklch(0.82 0.12 78 / 0.06);
  }

  .admin-fullview__body { grid-template-columns: 1fr; }
  .admin-col--list, .admin-col--detail, .admin-col--chat { display: none; border: 0; }
  .admin-fullview__body.view-list   .admin-col--list   { display: flex; }
  .admin-fullview__body.view-detail .admin-col--detail { display: flex; }
  .admin-fullview__body.view-chat   .admin-col--chat   { display: flex; }

  .admin-detail-compact__head { padding: var(--s3) var(--s4); }
  .admin-detail-compact__scroll { padding: var(--s3) var(--s4); }
  .admin-detail-compact__actions { padding: var(--s3) var(--s4); }
}

/* =================================================================
   MOBILE-FIRST RESPONSIVE LAYER
   Base styles above are desktop-leaning; everything below adapts the
   experience for small screens and progressively re-expands.
   Breakpoints: ≤640 phone · 641–960 tablet · ≥961 desktop
   ================================================================= */

/* Prevent iOS Safari auto-zoom on focus by forcing ≥16px input font */
@media (max-width: 640px) {
  .input, .textarea, .select, .chat__composer textarea { font-size: 16px; }
}

/* --- Topbar / nav drawer --- */
.topbar__burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  align-items: center; justify-content: center;
  color: var(--ink);
}
.topbar__burger:hover { background: var(--bg-2); }
.topbar__burger svg { display: block; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: oklch(0.1 0.012 260 / 0.7);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0;
  width: min(320px, 86vw);
  height: 100dvh;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-left: 1px solid var(--line);
  z-index: 95;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(.22,.8,.28,1);
  display: flex; flex-direction: column;
  padding: var(--s5);
  gap: var(--s2);
}
.drawer.is-open { transform: translateX(0); }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: var(--s3);
}
.drawer__nav { display: flex; flex-direction: column; gap: 4px; }
.drawer__nav button {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink-dim);
  text-align: left;
  border-radius: var(--r);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  min-height: 48px;
}
.drawer__nav button:hover { color: var(--ink); background: var(--bg-3); }
.drawer__nav button.is-active { color: var(--gold); background: oklch(0.82 0.12 78 / 0.08); }
.drawer__foot {
  margin-top: auto;
  padding-top: var(--s4);
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: var(--s3);
}

@media (max-width: 880px) {
  .topbar { padding: var(--s3) var(--s4); gap: var(--s3); }
  .topbar__brand { font-size: 15px; gap: var(--s2); }
  .topbar__brand .glyph { width: 24px; height: 24px; font-size: 10px; }
  .topbar__nav { display: none; }
  .topbar__user { padding: 4px 8px 4px 4px; }
  .topbar__user span { display: none; }
  .topbar__burger { display: inline-flex; }
  /* Hide the logout button on mobile — duplicated inside the drawer */
  .topbar > .btn.btn--ghost.btn--sm { display: none; }
}
@media (min-width: 881px) {
  .topbar__burger { display: none; }
  .drawer, .drawer-backdrop { display: none; }
}

/* --- Containers / page padding --- */
@media (max-width: 640px) {
  .container { padding: var(--s5) var(--s4); }
  .container--narrow { padding: var(--s5) var(--s4); }
}

/* --- Buttons: bigger tap targets on touch --- */
@media (max-width: 880px) {
  .btn { padding: 12px 18px; min-height: 44px; }
  .btn--sm { padding: 8px 14px; min-height: 36px; font-size: 12px; }
  .btn--lg { padding: 14px 22px; }
}

/* --- Hero --- */
@media (max-width: 880px) {
  .hero {
    min-height: auto;
    padding: var(--s10) var(--s5) var(--s8);
  }
  .hero__inner { max-width: 100%; }
  h1.display { font-size: clamp(34px, 11vw, 56px); }
  .hero p.lead { font-size: 16px; }
  .hero__cta { flex-direction: column; width: 100%; }
  .hero__cta .btn { width: 100%; justify-content: center; }
}

/* --- Guild cards --- */
@media (max-width: 640px) {
  .guild-card { padding: var(--s6) var(--s5); }
  .guild-card__sigil { width: 72px; height: 72px; margin-bottom: var(--s4); }
  .guild-card__sigil svg { width: 60px; height: 60px; }
  .guild-card__motto { font-size: 16px; margin: var(--s3) 0 var(--s4); }
  .guild-stats { gap: var(--s2); }
  .guild-stats__value { font-size: 22px; }
  .guild-stats__label { font-size: 9px; letter-spacing: 0.12em; }
}

/* --- Auth card --- */
@media (max-width: 640px) {
  .center-stage { padding: var(--s5) var(--s4); align-items: stretch; }
  .auth-card { padding: var(--s6) var(--s5); }
  h2.display { font-size: clamp(26px, 7vw, 36px); }
}

/* --- Stepper: scroll horizontally if cramped, shrink labels --- */
@media (max-width: 640px) {
  .stepper {
    overflow-x: auto;
    margin-left: calc(var(--s4) * -1); margin-right: calc(var(--s4) * -1);
    padding: 0 var(--s4) var(--s2);
    scrollbar-width: none;
  }
  .stepper::-webkit-scrollbar { display: none; }
  .stepper__step { font-size: 10px; gap: var(--s2); }
  .stepper__num { width: 24px; height: 24px; font-size: 11px; }
  .stepper__line { max-width: 24px; }
}

/* --- Card / form grids: stack on mobile --- */
@media (max-width: 880px) {
  .detail-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .card { padding: var(--s5); border-radius: var(--r-md); }
  .card__head { flex-wrap: wrap; gap: var(--s2); }
  .card__title { font-size: 18px; }
}
@media (max-width: 640px) {
  /* Any inline-styled "repeat(2, 1fr)" or "1fr 1fr" grids inside cards
     are overridden by adding the .grid-2 utility, but as a last-resort
     safety, target the most common pattern. */
  .card > [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .field label { font-size: 11px; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* --- Candidate rows → cards on mobile --- */
@media (max-width: 880px) {
  .candidate-row {
    grid-template-columns: 44px 1fr auto;
    grid-template-areas:
      "avatar name status"
      "avatar uid    uid"
      "power  power  meta";
    gap: var(--s2) var(--s3);
    padding: var(--s4);
  }
  .candidate-row > :nth-child(1) { grid-area: avatar; }
  .candidate-row > :nth-child(2) { grid-area: name; min-width: 0; }
  .candidate-row > :nth-child(2) .candidate-row__uid { grid-area: uid; }
  .candidate-row > :nth-child(3) { grid-area: power; font-size: 16px; }
  .candidate-row > :nth-child(4) { grid-area: meta; text-align: right; }
  .candidate-row > :nth-child(5) { display: none; } /* votes — visible only in detail */
  .candidate-row > :nth-child(6) { grid-area: status; justify-self: end; }
  .candidate-row__name { font-size: 14px; }
}

/* --- Tabs: horizontal scroll on mobile --- */
@media (max-width: 880px) {
  .tabs {
    overflow-x: auto;
    margin-left: calc(var(--s4) * -1); margin-right: calc(var(--s4) * -1);
    padding: 0 var(--s4);
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: 12px 12px; font-size: 12px; }
}

/* --- Admin drill-in on mobile --- */
.admin-mobile-back { display: none; }
@media (max-width: 880px) {
  /* When in detail mode on mobile, hide list; vice versa */
  .admin-grid.is-detail .admin-list { display: none; }
  .admin-grid:not(.is-detail) .admin-detail { display: none; }
  .admin-mobile-back {
    display: inline-flex;
    align-items: center; gap: 6px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--ink-dim);
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--s4);
  }
  .admin-mobile-back:hover { background: var(--bg-2); color: var(--ink); }
}

/* --- Chat: fill available height on mobile, sticky composer --- */
@media (max-width: 880px) {
  .chat { border-radius: var(--r-md); }
  .chat__head { padding: var(--s3) var(--s4); }
  .chat__title { font-size: 16px; }
  .chat__sub { display: none; }
  .chat__participants .avatar:nth-child(n+4) { display: none; }
  .chat__messages { padding: var(--s4); gap: var(--s3); }
  .msg__bubble { max-width: calc(100vw - 110px); font-size: 14px; }
  .chat__composer { padding: var(--s2) var(--s3); }
  .chat__composer textarea { font-size: 16px; }
  /* Force the chat wrapper to a reasonable height when stacked under details */
  .chat-mobile-fill { height: 70dvh !important; }
}

/* --- Status pill --- */
@media (max-width: 640px) {
  .status-large { padding: var(--s3) var(--s4); width: 100%; }
  .status-large > div > div:first-child { font-size: 18px; }
}

/* --- Roster grid --- */
@media (max-width: 640px) {
  .roster { grid-template-columns: 1fr; gap: var(--s3); }
}

/* --- Guild picker (apply step) --- */
@media (max-width: 640px) {
  .guild-picker { grid-template-columns: 1fr; }
}

/* --- Role switcher: collapsible bubble --- */
.role-switcher__toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--line);
  color: var(--gold);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  box-shadow: 0 12px 28px -16px black;
}
.role-switcher__toggle:hover { background: var(--bg-3); }
@media (max-width: 640px) {
  .role-switcher {
    bottom: 12px; left: 12px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .role-switcher__toggle { display: inline-flex; align-items: center; justify-content: center; }
  .role-switcher__panel {
    display: none;
    position: absolute;
    bottom: 56px; left: 0;
    background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--s3) var(--s4);
    width: min(280px, 80vw);
    box-shadow: 0 16px 40px -20px black;
  }
  .role-switcher.is-open .role-switcher__panel { display: block; }
  .role-switcher__row { max-width: 100%; }
}
@media (min-width: 641px) {
  .role-switcher__toggle { display: none; }
  .role-switcher__panel { display: block !important; position: static; background: transparent; border: 0; padding: 0; box-shadow: none; width: auto; }
}

/* --- Generic safety: no horizontal scroll --- */
html, body { overflow-x: hidden; }
img, svg { max-width: 100%; }

/* --- Responsive grid utility used by inline-styled grids --- */
.grid-resp-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid-resp-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.grid-resp-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s4); }
@media (max-width: 880px) {
  .grid-resp-2, .grid-resp-3 { grid-template-columns: 1fr; }
  .grid-resp-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-resp-4 { grid-template-columns: 1fr; }
}
