/* Forever WoW — brand stylesheet
   Colours from the approved mockup; see CONTRACT.md "Brand". */

:root {
  --navy: #0b1a28;
  --page: #0e1519;
  --card: #17232c;
  --border: #223340;
  --parchment: #4a3a27;
  --parchment-card: #3b2d1d;
  --parchment-border: #6a5539;
  --parchment-muted: #d9c9a8;
  --gold: #e6b95a;
  --ice: #7fd0f0;
  --link: #a8e2f8;
  --teal: #157f92;
  --teal-hover: #1a95ab;
  --discord: #5865f2;
  --discord-hover: #4752c4;
  --text: #efe6d2;
  --muted: #9fb3c4;
  --alliance-bg: #1c3f6e;
  --alliance-fg: #a9cdff;
  --horde-bg: #5a1c1c;
  --horde-fg: #ffa3a3;
  --tank-bg: #2b3b5c;
  --tank-fg: #a9c4f5;
  --healer-bg: #1f4d2e;
  --healer-fg: #9fe3b0;
  --dps-bg: #5a2323;
  --dps-fg: #f5a3a3;
  --goldtag-bg: #5a4520;
  --goldtag-fg: #f0cf7a;
  --input-bg: #17232c;
  --input-border: #2e4a60;
  --danger: #c0392b;
  --danger-hover: #d64535;
  --ok: #2e8b57;
  --warn: #b7791f;
  --radius: 4px;
  --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --wrap: 1440px;
  --gutter: 56px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
}

@media (max-width: 767px) {
  :root {
    --gutter: 16px;
  }
}

/* ---------- Reset / base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: #fff;
}

h1,
h2,
h3,
h4 {
  font-weight: 300;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text);
}

h1 {
  font-size: 2.25rem;
}

h2 {
  font-size: 1.6rem;
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0 0 12px;
}

small,
.small {
  font-size: 0.875rem;
}

.muted {
  color: var(--muted);
}

.gold {
  color: var(--gold);
}

.ice {
  color: var(--ice);
}

.display {
  font-family: var(--font-display);
  font-weight: 700;
}

code,
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1px 6px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--gold);
  color: var(--navy);
  padding: 8px 12px;
  border-radius: var(--radius);
  z-index: 100;
}

.skip-link:focus {
  left: 8px;
}

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.wrap-narrow {
  max-width: 880px;
}

.site-main {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 56px;
}

.site-main > .banner {
  margin-bottom: 20px;
}

.stack > * + * {
  margin-top: 16px;
}

.stack-lg > * + * {
  margin-top: 32px;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.cluster-between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-cards {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid-sidebar {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
}

@media (max-width: 1023px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-sidebar,
  .grid-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  .site-main {
    padding-top: 20px;
    padding-bottom: 40px;
  }
}

.section {
  padding: 40px 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-head h1,
.section-head h2 {
  margin-bottom: 0;
}

.section-title {
  font-weight: 300;
}

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 6px;
}

.lead {
  font-size: 1.125rem;
  font-weight: 300;
  color: var(--muted);
  max-width: 68ch;
}

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

.site-header {
  background: var(--navy);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 28px;
  min-height: 76px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.brand {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.brand:hover {
  color: inherit;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.wordmark-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.wordmark-kicker {
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant-caps: all-small-caps;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.wordmark-name {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  white-space: nowrap;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.site-nav a.is-active {
  color: var(--gold);
  box-shadow: inset 0 -2px 0 var(--gold);
  border-radius: 0;
}

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

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}

.user-chip:hover {
  border-color: var(--input-border);
  color: var(--text);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  flex: none;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

@media (max-width: 767px) {
  .site-nav {
    order: 3;
    width: calc(100% + var(--gutter) * 2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
  }

  .header-auth {
    gap: 8px;
  }

  .user-meta {
    display: none;
  }

  .user-chip {
    padding-right: 4px;
  }

  .wordmark-kicker {
    font-size: 0.55rem;
  }

  .wordmark-name {
    font-size: 1.15rem;
  }

  .btn-discord .icon + span {
    display: none;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-inner {
  padding-top: 24px;
  padding-bottom: 24px;
  text-align: center;
}

.footer-inner p {
  margin: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.875rem;
}

.btn-lg {
  min-height: 52px;
  padding: 0 26px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.btn-primary:hover {
  background: var(--teal-hover);
  border-color: var(--teal-hover);
  color: #fff;
}

.btn-discord {
  background: var(--discord);
  color: #fff;
  border-color: var(--discord);
}

.btn-discord:hover {
  background: var(--discord-hover);
  border-color: var(--discord-hover);
  color: #fff;
}

/* Secondary Discord action, e.g. "Join guild Discord" next to the contact buttons. */
.btn-discord-outline {
  background: transparent;
  color: var(--discord);
  border-color: var(--discord);
}

.btn-discord-outline:hover {
  background: var(--discord);
  border-color: var(--discord);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--input-border);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ice);
  color: #fff;
}

.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

.btn-gold:hover {
  background: #f0c96e;
  border-color: #f0c96e;
  color: var(--navy);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--link);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.btn .icon {
  flex: none;
}

/* ---------- Tags ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
}

.tag-alliance {
  background: var(--alliance-bg);
  color: var(--alliance-fg);
}

.tag-horde {
  background: var(--horde-bg);
  color: var(--horde-fg);
}

.tag-tank {
  background: var(--tank-bg);
  color: var(--tank-fg);
}

.tag-healer {
  background: var(--healer-bg);
  color: var(--healer-fg);
}

.tag-dps,
.tag-melee,
.tag-ranged {
  background: var(--dps-bg);
  color: var(--dps-fg);
}

.tag-gold {
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
}

.tag-focus {
  background: #1d2f3b;
  color: var(--ice);
}

/* Region. */
.tag-region {
  background: #23313a;
  color: var(--muted);
}

/* Region + realm type, derived on render ("US PvE"). */
.tag-megaserver {
  background: #1f3a44;
  color: var(--ice);
}

.tag-status {
  text-transform: none;
  letter-spacing: 0;
}

.tag-status-approved {
  background: var(--healer-bg);
  color: var(--healer-fg);
}

.tag-status-pending,
.tag-status-draft {
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
}

.tag-status-changes_requested {
  background: #4a3410;
  color: #f7d58a;
}

.tag-status-rejected,
.tag-status-closed,
.tag-status-expired {
  background: #2a3138;
  color: #c4ccd4;
}

/* ---------- Cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
}

.card + .card {
  margin-top: 16px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 10px 0 4px;
}

.card-title a {
  color: var(--text);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--ice);
}

.card-sub {
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.card-desc {
  color: var(--muted);
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-meta {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.meta-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-right: 6px;
}

.card-needs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.card-expiry {
  color: var(--muted);
  font-size: 0.8rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.listing-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.listing-card.is-featured,
.guild-card.is-featured {
  border-color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}

.grid-cards .card + .card {
  margin-top: 0;
}

/* ---------- Bands ---------- */

.band {
  padding: 48px 0;
}

.band-parchment {
  background: var(--parchment);
  color: var(--text);
  border-top: 1px solid var(--parchment-border);
  border-bottom: 1px solid var(--parchment-border);
}

.band-parchment .muted,
.band-parchment .card-desc,
.band-parchment .lead {
  color: var(--parchment-muted);
}

.band-parchment .card {
  background: var(--parchment-card);
  border-color: var(--parchment-border);
}

.band-parchment .card-footer {
  border-top-color: var(--parchment-border);
}

.band-parchment a {
  color: #ffe7b0;
}

.band-parchment .btn-outline {
  color: var(--text);
  border-color: var(--parchment-border);
}

.band-dark {
  background: var(--navy);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.band-full {
  margin-left: calc(var(--gutter) * -1);
  margin-right: calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Hero ---------- */

.hero {
  padding: 24px 0 8px;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 300;
  margin-bottom: 8px;
}

.hero .display {
  font-size: 3rem;
  color: var(--gold);
}

@media (max-width: 767px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero .display {
    font-size: 2.1rem;
  }
}

/* ---------- Stat tiles ---------- */

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  color: var(--text);
  text-decoration: none;
  min-height: 96px;
}

a.stat-tile:hover {
  border-color: var(--ice);
  color: var(--text);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--gold);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 6px;
}

.stat-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-gold {
  border-color: var(--gold);
}

.stat-warn .stat-value {
  color: #f5a3a3;
}

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

.form {
  max-width: 760px;
}

.field {
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.field-label .req {
  color: var(--gold);
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 6px 0 0;
}

/* Character counter next to a capped field's label ("0 / 2000"). */
.char-count {
  float: right;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.8rem;
}

.char-count.warn {
  color: var(--gold);
}

.char-count.over {
  color: #f5a3a3;
  font-weight: 600;
}

/* A guild name always reads as <Name>; the brackets are rendering, not data. */
.guild-name {
  white-space: nowrap;
}

.field-error {
  color: #f5a3a3;
  font-size: 0.85rem;
  margin: 6px 0 0;
}

.has-error .input {
  border-color: var(--danger);
}

.input,
input[type='text'],
input[type='search'],
input[type='url'],
input[type='number'],
input[type='password'],
input[type='email'],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
}

.input::placeholder,
input::placeholder,
textarea::placeholder {
  color: #6f8496;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--ice);
  outline-offset: 0;
  border-color: var(--ice);
}

.input:read-only,
input:read-only {
  color: var(--muted);
}

textarea,
.textarea {
  min-height: 140px;
  resize: vertical;
}

select,
.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239fb3c4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select option {
  background: var(--input-bg);
  color: var(--text);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px 0 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--teal);
  flex: none;
}

.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.role-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 767px) {
  .role-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}

@media (max-width: 767px) {
  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px 4px;
  margin: 0 0 20px;
  min-width: 0;
}

legend {
  padding: 0 8px;
  font-weight: 600;
  color: var(--gold);
}

/* ---------- Filters / tabs ---------- */

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
}

.filters .field {
  margin-bottom: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--text);
}

.tabs a.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---------- Tables ---------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: var(--navy);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.actions {
  white-space: nowrap;
}

td .btn + .btn,
td .inline-form + .inline-form,
td .btn + .inline-form,
td .inline-form + .btn {
  margin-left: 6px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.is-ok {
  background: #3fbf7f;
}

.status-dot.is-bad {
  background: #f06060;
}

.status-dot.is-off {
  background: #5b6b78;
}

/* ---------- Banners ---------- */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.95rem;
  transition: opacity 0.4s ease;
}

.banner.is-hiding {
  opacity: 0;
}

.banner-ok {
  background: #14372a;
  border-color: #2e8b57;
  color: #b8f0cf;
}

.banner-error {
  background: #3d1717;
  border-color: #c0392b;
  color: #ffc4c4;
}

.banner-warn {
  background: #3f2e0f;
  border-color: #b7791f;
  color: #f7d58a;
}

.banner-danger {
  background: #7a1f1f;
  border-color: #c0392b;
  color: #fff;
}

.banner-info {
  background: #14283a;
  border-color: #2e4a60;
  color: var(--link);
}

.banner-full {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.banner-full .wrap {
  display: block;
}

.banner-close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius);
  flex: none;
}

.banner-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ---------- Notes / callouts ---------- */

.note {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.925rem;
}

.note-danger {
  border-left-color: var(--danger);
}

.note-ok {
  border-left-color: var(--ok);
}

/* ---------- Listing detail ---------- */

.detail-head {
  margin-bottom: 20px;
}

.detail-head h1 {
  margin: 10px 0 6px;
  font-size: 2rem;
}

.detail-body {
  white-space: pre-line;
  font-size: 1.05rem;
  line-height: 1.65;
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding-top: 3px;
}

.kv dd {
  margin: 0;
}

.contact-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.contact-handle {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  color: var(--ice);
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.pagination-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.page-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.page-link.is-current {
  background: var(--teal);
  color: #fff;
}

.page-gap {
  color: var(--muted);
  padding: 0 4px;
}

/* ---------- Empty / error ---------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
}

.empty-title {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 300;
  margin-bottom: 6px;
}

.empty-hint {
  margin-bottom: 16px;
}

.error-page {
  text-align: center;
  padding: 48px 0;
  max-width: 560px;
  margin: 0 auto;
}

.error-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 5rem;
  line-height: 1;
  color: var(--gold);
  margin-bottom: 8px;
}

.error-title {
  font-weight: 300;
  margin-bottom: 8px;
}

.error-message {
  color: var(--muted);
  margin-bottom: 24px;
}

.error-page .cluster {
  justify-content: center;
}

/* ---------- Misc helpers ---------- */

.text-center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mt-4 {
  margin-top: 32px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.w-100 {
  width: 100%;
}

.nowrap {
  white-space: nowrap;
}

.break {
  overflow-wrap: anywhere;
}

.copy-btn.is-copied {
  border-color: #3fbf7f;
  color: #b8f0cf;
}

.key-reveal {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--navy);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-wrap: anywhere;
  color: var(--gold);
}

@media print {
  .site-header,
  .site-footer,
  .banner,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}


/* =====================================================================
   Phase 2: guild pages, profiles, applications, community
   ===================================================================== */

:root {
  --class-warrior: #c79c6e;
  --class-paladin: #f48cba;
  --class-hunter: #abd473;
  --class-rogue: #fff569;
  --class-priest: #f2efe6;
  --class-shaman: #2f8ae8;
  --class-mage: #69ccf0;
  --class-warlock: #9482c9;
  --class-druid: #ff7d0a;
  --match-great: #e6b95a;
  --match-great-bg: #3a2e12;
  --match-possible: #7fd0f0;
  --match-possible-bg: #14303d;
  --match-explore: #9fb3c4;
  --match-explore-bg: #22303a;
  --flex-bg: #2f3f3a;
  --flex-fg: #bde5cf;
}

/* ---------- Header: user menu (details/summary, no JS) ---------- */

.user-menu {
  position: relative;
}

.user-menu > summary {
  list-style: none;
  cursor: pointer;
}

.user-menu > summary::-webkit-details-marker {
  display: none;
}

.user-menu > summary::marker {
  content: '';
}

.user-chip-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  margin-left: 2px;
  flex: none;
}

.user-menu[open] .user-chip {
  border-color: var(--ice);
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 60;
}

.user-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.925rem;
}

.user-menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.user-menu-hint {
  font-size: 0.7rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-menu-logout {
  margin: 8px 4px 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.notif-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  flex: none;
}

@media (max-width: 767px) {
  .user-menu-panel {
    position: fixed;
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    min-width: 0;
  }

  .user-chip .notif-dot {
    position: absolute;
    top: -4px;
    right: -4px;
  }

  .user-chip {
    position: relative;
  }
}

/* ---------- Footer columns ---------- */

.footer-inner {
  text-align: left;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 20px;
}

.footer-title {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 8px;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin: 0;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-legal {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  text-align: center;
  margin: 0;
}

@media (max-width: 767px) {
  .footer-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Badges, class tags, role tags ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-gold,
.badge-founding {
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
}

.badge-founding::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.badge-ice {
  background: #1d2f3b;
  color: var(--ice);
}

.badge-muted {
  background: #2a3138;
  color: #c4ccd4;
}

.badge-ok {
  background: var(--healer-bg);
  color: var(--healer-fg);
}

.badge-warn {
  background: #4a3410;
  color: #f7d58a;
}

.badge-danger {
  background: var(--dps-bg);
  color: var(--dps-fg);
}

.class-icon {
  flex: none;
  vertical-align: middle;
}

.class-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.tag-flex {
  background: var(--flex-bg);
  color: var(--flex-fg);
}

.tag-atmo {
  background: #26303a;
  color: #d9c9a8;
}

.tag-atmo-relaxed {
  background: #1f3d3a;
  color: #a9e6d6;
}

.tag-atmo-balanced {
  background: #2a3652;
  color: #b9c9f5;
}

.tag-atmo-progression {
  background: #4a2a1e;
  color: #f5b98f;
}

.tag-ruleset {
  background: #2e2a3f;
  color: #d0c4f5;
}

.tag-gstatus-published {
  background: var(--healer-bg);
  color: var(--healer-fg);
}

.tag-gstatus-pending,
.tag-gstatus-draft {
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
}

.tag-gstatus-hidden,
.tag-gstatus-suspended {
  background: var(--dps-bg);
  color: var(--dps-fg);
}

.freshness,
.active-ago {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Raid-day strip ---------- */

.day-strip {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

.day-strip .day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  background: var(--navy);
  border: 1px solid var(--border);
  color: #6f8496;
  font-size: 0.72rem;
  font-weight: 700;
}

.day-strip .day.is-on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.day-strip-sm .day {
  width: 20px;
  height: 20px;
  font-size: 0.65rem;
}

/* ---------- Match badge and reasons ---------- */

.match-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.match-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.35);
}

.match-great {
  background: var(--match-great-bg);
  color: var(--match-great);
  border-color: var(--match-great);
}

.match-possible {
  background: var(--match-possible-bg);
  color: var(--match-possible);
  border-color: #2e6a80;
}

.match-explore {
  background: var(--match-explore-bg);
  color: var(--match-explore);
  border-color: var(--border);
}

.fit-link {
  text-decoration: none;
  display: inline-flex;
}

.match-reasons {
  margin: 0;
}

.match-note {
  background: var(--navy);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.match-row {
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
}

.match-row:last-child {
  border-bottom: 0;
}

.match-row.is-unknown {
  opacity: 0.6;
}

.match-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 0.9rem;
}

.match-label {
  font-weight: 600;
}

.match-points {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.match-bar {
  height: 6px;
  background: var(--navy);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}

.match-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--ice));
  border-radius: 3px;
}

.match-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.match-total {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.match-total strong {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.fit-box {
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 16px 20px;
}

.fit-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 767px) {
  .fit-picker {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Tabs (counts) ---------- */

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  font-size: 0.72rem;
}

.tabs a.is-active .tab-count {
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
}

/* ---------- Guild and player cards ---------- */

.guild-card,
.player-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-activities {
  margin: 4px 0 8px;
}

.guild-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.guild-members {
  font-weight: 600;
}

.player-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.player-card-head .card-title {
  margin: 0;
}

.player-card-head .card-sub {
  margin: 0;
}

.player-card-id {
  flex: 1 1 auto;
  min-width: 0;
}

.player-card-id .card-title a {
  overflow-wrap: anywhere;
}

.player-card-class {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.player-card.is-list {
  height: auto;
}

.player-fit {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.grid-guilds {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.grid-players {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

@media (max-width: 767px) {
  .grid-guilds,
  .grid-players {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Guild page ---------- */

.guild-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 32px;
  align-items: start;
  margin-bottom: 20px;
}

.guild-head h1 {
  margin: 8px 0 6px;
}

.guild-motto {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 300;
  margin-bottom: 10px;
}

.guild-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.guild-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.guild-facts strong {
  color: var(--text);
}

.freshness-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

@media (max-width: 767px) {
  .guild-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .guild-head-actions {
    justify-content: flex-start;
  }
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.week-day {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  min-height: 72px;
}

.week-day.is-on {
  border-color: var(--teal);
}

.week-day-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.week-slot {
  font-size: 0.8rem;
  margin: 0 0 4px;
}

.week-slot .tz-local {
  display: block;
  color: var(--muted);
}

@media (max-width: 767px) {
  .week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tz-local {
  color: var(--muted);
  font-size: 0.85em;
}

.roster-health {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.roster-health .stat-tile {
  min-height: 80px;
  padding: 12px 14px;
}

.activity-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-feed li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.activity-feed li:last-child {
  border-bottom: 0;
}

.activity-feed time {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.8rem;
}

.offer-list {
  margin: 0;
  padding-left: 20px;
}

.offer-list li {
  margin-bottom: 4px;
}

/* ---------- Compare table ---------- */

.compare-table th:first-child,
.compare-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 1;
  min-width: 140px;
}

.compare-table th {
  vertical-align: bottom;
}

.compare-table tr.diff td {
  background: rgba(230, 185, 90, 0.08);
}

.compare-table tr.diff td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}

.compare-table td.diff {
  background: rgba(230, 185, 90, 0.1);
}

/* ---------- Compare bar (rendered by app.js) ---------- */

.compare-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: var(--navy);
  border-top: 1px solid var(--gold);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  padding: 10px var(--gutter);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.compare-bar-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.compare-bar-names {
  flex: 1 1 200px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-bar-names strong {
  color: var(--text);
}

body.has-compare-bar {
  padding-bottom: 72px;
}

.compare-toggle.is-on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* ---------- Dashboard sidebar (shares the manage sidebar look) ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.dash-nav {
  position: sticky;
  top: 24px;
}

.dash-nav .nav-group {
  margin-bottom: 22px;
}

.dash-nav .nav-title {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin: 0 0 6px 12px;
}

.dash-nav .nav-link,
.side-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.925rem;
}

.dash-nav .nav-link:hover,
.side-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.dash-nav .nav-link.is-active,
.side-nav .nav-link.is-active {
  background: var(--card);
  color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}

.dash-nav .nav-badge,
.side-nav .nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
  font-size: 0.75rem;
  font-weight: 700;
}

.dash-main > * + * {
  margin-top: 28px;
}

.dash-head h1 {
  font-weight: 300;
  margin: 0;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1023px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .dash-nav {
    position: static;
  }

  .dash-nav .nav-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
  }

  .dash-nav .nav-title {
    width: 100%;
  }
}

/* ---------- Editable row lists (openings, schedule, questions) ---------- */

.row-list {
  display: grid;
  gap: 10px;
}

.row-item {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}

.row-item .field {
  margin-bottom: 0;
}

.row-item .row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---------- Application thread ---------- */

.thread {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 82%;
}

.msg.is-mine {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.is-mine .msg-bubble {
  background: #163b46;
  border-color: #1f5566;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 4px;
}

.msg-meta {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 4px;
}

.msg.is-mine .msg-meta {
  text-align: right;
}

.msg.is-hidden .msg-bubble {
  opacity: 0.6;
  font-style: italic;
}

.composer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}

.composer .textarea {
  min-height: 100px;
}

.suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.suggest {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px dashed var(--input-border);
  background: transparent;
  color: var(--link);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
}

.suggest:hover {
  border-color: var(--ice);
  color: #fff;
}

.answer-block {
  margin-bottom: 14px;
}

.answer-prompt {
  font-weight: 600;
  margin-bottom: 4px;
}

.answer-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  margin: 0;
}

.pre-wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.app-row.is-unread .row-title {
  color: var(--gold);
}

.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notes-list li:last-child {
  border-bottom: 0;
}

@media (max-width: 767px) {
  .msg {
    max-width: 100%;
  }

  .app-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* ---------- Notifications ---------- */

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  overflow: hidden;
}

.notif-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.notif-item:last-child {
  border-bottom: 0;
}

.notif-item.is-unread {
  background: rgba(230, 185, 90, 0.06);
  box-shadow: inset 3px 0 0 var(--gold);
}

.notif-title {
  font-weight: 600;
  margin: 0;
}

.notif-title a {
  color: var(--text);
  text-decoration: none;
}

.notif-title a:hover {
  color: var(--ice);
}

.notif-body {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
  grid-column: 1 / -1;
}

.notif-time {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- Events ---------- */

.event-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.event-date {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  padding: 8px 4px;
}

.event-date .month {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
}

.event-date .day {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.event-time-host,
.event-time-local {
  color: var(--muted);
}

.event-card.is-cancelled {
  opacity: 0.6;
}

.event-card.is-cancelled .card-title {
  text-decoration: line-through;
}

@media (max-width: 480px) {
  .event-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .event-date {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
    padding: 4px 10px;
  }
}

/* ---------- Inn ---------- */

.inn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  overflow: hidden;
}

.inn-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.inn-row:last-child {
  border-bottom: 0;
}

.inn-row.is-pinned {
  background: rgba(230, 185, 90, 0.05);
}

.vote-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.vote-btn {
  min-width: 44px;
  min-height: 40px;
  padding: 0 8px;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.vote-btn.is-on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.vote-count {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
}

.inn-title {
  font-weight: 600;
  margin: 0 0 2px;
  font-size: 1.05rem;
}

.inn-title a {
  color: var(--text);
  text-decoration: none;
}

.inn-title a:hover {
  color: var(--ice);
}

.inn-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.inn-count {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.comment {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

.comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 4px 0 0;
}

.comment-meta {
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  line-height: 1.65;
}

@media (max-width: 767px) {
  .inn-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .inn-count {
    grid-column: 2;
  }
}

/* ---------- Class tiles (home) and demand bars (insights) ---------- */

.class-tiles {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
}

.class-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 44px;
}

.class-tile:hover {
  border-color: var(--ice);
  color: var(--text);
}

@media (max-width: 1023px) {
  .class-tiles {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .class-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.demand-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.demand-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.demand-bar {
  height: 14px;
  background: var(--navy);
  border-radius: 3px;
  overflow: hidden;
}

.demand-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.demand-n {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .demand-row {
    grid-template-columns: 100px minmax(0, 1fr) auto;
  }
}

/* ---------- Report box, FAQ, guides ---------- */

.report-box > summary {
  list-style: none;
  display: inline-flex;
}

.report-box > summary::-webkit-details-marker {
  display: none;
}

.report-form {
  margin-top: 10px;
  max-width: 480px;
}

.report-form .textarea {
  min-height: 90px;
  margin-bottom: 10px;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  padding: 0 16px;
  margin-bottom: 8px;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 48px;
  display: flex;
  align-items: center;
}

.faq details p {
  color: var(--muted);
}

.prose {
  max-width: 72ch;
  font-size: 1.05rem;
  line-height: 1.7;
}

.prose h2 {
  margin-top: 32px;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.guide-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.finder-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

@media (max-width: 767px) {
  .finder-strip {
    grid-template-columns: minmax(0, 1fr);
  }
}

.wrap-wide {
  max-width: var(--wrap);
}

@media (max-width: 767px) {
  .table-wrap table {
    min-width: 560px;
  }
}

/* --- Token field: pills + role autocomplete (app.js feature 7) -------------
   Before app.js runs, .tokenfield holds a plain comma-separated text input and
   looks like any other field. After enhancement (.is-enhanced) the raw input is
   hidden and the box below takes over. */

.tokenfield {
  position: relative;
}

.tokenfield.is-enhanced .tokens-raw {
  display: none;
}

.tokenfield-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  cursor: text;
}

.tokenfield-box:focus-within {
  border-color: var(--ice);
  box-shadow: 0 0 0 2px rgba(127, 208, 240, 0.25);
}

fieldset:disabled .tokenfield-box {
  opacity: 0.6;
  cursor: not-allowed;
}

.tokenfield-search {
  flex: 1 1 8ch;
  min-width: 8ch;
  padding: 3px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  outline: none;
}

.tokenfield-search::placeholder {
  color: var(--muted);
}

/* --- pills --- */

.token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 4px 3px 9px;
  background: var(--goldtag-bg);
  color: var(--goldtag-fg);
  border: 1px solid rgba(230, 185, 90, 0.35);
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.token-unknown {
  background: #2b3b4a;
  color: var(--muted);
  border-color: var(--border);
}

.token-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.token-x {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.token-x:hover,
.token-x:focus-visible {
  background: rgba(0, 0, 0, 0.35);
  opacity: 1;
}

fieldset:disabled .token-x {
  display: none;
}

/* --- suggestion menu --- */

.tokenfield-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tokenfield-menu[hidden] {
  display: none;
}

.tokenfield-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
}

.tokenfield-opt.is-active {
  background: var(--teal);
  color: #fff;
}

.tokenfield-opt-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tokenfield-opt-id {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: 0.8;
}

.tokenfield-opt.is-active .tokenfield-opt-id {
  color: rgba(255, 255, 255, 0.8);
}

.tokenfield-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Rendered Markdown (guild About) ---------- */

/* The only markup src/lib/markdown.ts can emit: p, br, h3, h4, strong, em,
   del, code, pre, ul, ol, li, blockquote, hr and a. */

.md-body {
  overflow-wrap: anywhere;
}

/* The guild overview preview: the whole About renders and is clamped here.
   Cutting the Markdown source instead would leave "[our charter](https://exa"
   or an unclosed ``` fence on the page. */
.md-clamp {
  position: relative;
  max-height: 20em;
  overflow: hidden;
}

.md-clamp::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3em;
  background: linear-gradient(to bottom, transparent, var(--card));
  pointer-events: none;
}

.md-body > :first-child {
  margin-top: 0;
}

.md-body > :last-child {
  margin-bottom: 0;
}

.md-body p {
  margin: 0 0 12px;
  line-height: 1.65;
}

.md-body h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 8px;
}

.md-body h4 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--gold);
  margin: 16px 0 6px;
}

.md-body ul,
.md-body ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.md-body li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.md-body blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

.md-body pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.md-body pre code {
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

.md-body hr {
  margin: 16px 0;
}

.md-body a {
  overflow-wrap: anywhere;
}

/* "Markdown supported" note under a Markdown-capable textarea: it belongs to
   the field above it, so it sits inside that field's bottom margin. */
.md-note {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: -14px 0 18px;
}
