:root {
  color-scheme: light dark;
  /* Light theme (default) */
  --rb-primary: #5865f2;
  --rb-primary-dark: #424fce;
  --rb-background: #f7f8fe;
  --rb-background-dark: #0f172a;
  --rb-text: #1f2933;
  --rb-text-muted: #52606d;
  --rb-surface: #ffffff;
  --rb-border: #e3e8f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --rb-background: var(--rb-background-dark);
    --rb-text: #e5e7eb;
    --rb-text-muted: #cbd5f5;
    --rb-surface: #14213d;
    --rb-border: #1f2a44;
  }
}

/* Explicit theme override via data-theme attribute (takes precedence) */
:root[data-theme="light"] {
  --rb-primary: #5865f2;
  --rb-primary-dark: #424fce;
  --rb-background: #f7f8fe;
  --rb-text: #1f2933;
  --rb-text-muted: #52606d;
  --rb-surface: #ffffff;
  --rb-border: #e3e8f4;
}

:root[data-theme="dark"] {
  --rb-primary: #8b93ff;
  --rb-primary-dark: #737bff;
  --rb-background: #0f172a;
  --rb-text: #e5e7eb;
  --rb-text-muted: #cbd5f5;
  --rb-surface: #14213d;
  --rb-border: #1f2a44;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--rb-background);
  color: var(--rb-text);
  line-height: 1.6;
}

body.rb-body--dashboard {
  min-height: 100vh;
}

.rb-dashboard {
  display: flex;
  min-height: 100vh;
}

.rb-sidebar {
  width: 260px;
  flex: 0 0 260px;
  min-width: 240px;
  background: var(--rb-surface);
  border-right: 1px solid var(--rb-border);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  /* fallback */
  height: 100svh;
  /* small viewport units */
  height: 100dvh;
  /* dynamic viewport units */
  overflow: hidden;
  /* make only the nav scroll */
}

.rb-sidebar__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rb-primary);
  text-decoration: none;
}

.rb-sidebar__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
}

.rb-sidebar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  color: var(--rb-text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.rb-sidebar__toggle:hover,
.rb-sidebar__toggle:focus {
  background: rgba(88, 101, 242, 0.08);
  border-color: rgba(88, 101, 242, 0.4);
}

.rb-sidebar__toggle-icon,
.rb-sidebar__toggle-icon::before,
.rb-sidebar__toggle-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.rb-sidebar__toggle-icon::before,
.rb-sidebar__toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.rb-sidebar__toggle-icon::before {
  top: -6px;
}

.rb-sidebar__toggle-icon::after {
  top: 6px;
}

.rb-sidebar.is-open .rb-sidebar__toggle-icon {
  transform: rotate(45deg);
}

.rb-sidebar.is-open .rb-sidebar__toggle-icon::before {
  transform: rotate(90deg) translateX(6px);
}

.rb-sidebar.is-open .rb-sidebar__toggle-icon::after {
  opacity: 0;
}

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

.rb-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  /* allow scrolling within flex child */
  overflow-y: auto;
  /* scroll middle content */
}

.rb-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.75rem;
  color: var(--rb-text);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.rb-sidebar__link:hover,
.rb-sidebar__link:focus {
  background: rgba(88, 101, 242, 0.12);
  color: var(--rb-primary);
}

.rb-sidebar__link.is-active {
  background: rgba(88, 101, 242, 0.18);
  color: var(--rb-primary);
}

.rb-sidebar__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  /* keep footer at the bottom of the sidebar */
  padding-top: 0.5rem;
  background: var(--rb-surface);
}

.rb-sidebar__profile {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 0;
  text-align: left;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  color: var(--rb-text);
  border-radius: 8px;
}

.rb-sidebar__profile:hover,
.rb-sidebar__profile:focus {
  background: rgba(88, 101, 242, 0.1);
}

.rb-sidebar__label {
  font-size: 0.75rem;
  color: var(--rb-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rb-sidebar__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rb-text);
}

.rb-sidebar__discord {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5865f2, #7289da);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rb-sidebar__discord:hover,
.rb-sidebar__discord:focus {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(88, 101, 242, 0.45);
}

.rb-sidebar__discord svg {
  width: 22px;
  height: 22px;
}

.rb-dashboard__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.rb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  background: var(--rb-surface);
  border-bottom: 1px solid var(--rb-border);
}

.rb-topbar__user {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rb-topbar__greeting {
  font-size: 0.85rem;
  color: var(--rb-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rb-topbar__name {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Badge styles */
.rb-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .5rem;
  margin-left: .5rem;
  font-size: .75rem;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid var(--rb-border);
  background: color-mix(in oklab, var(--rb-surface) 85%, var(--rb-background) 15%);
}

.rb-badge--flush {
  margin-left: 0;
}

.rb-badge--plan.is-free {
  background: rgba(107, 114, 128, .15);
  color: #6b7280;
  border-color: rgba(107, 114, 128, .3);
}

.rb-badge--plan.is-community {
  background: rgba(59, 130, 246, .15);
  color: #2563eb;
  border-color: rgba(59, 130, 246, .3);
}

.rb-badge--plan.is-pro {
  background: rgba(88, 101, 242, .18);
  color: var(--rb-primary-dark);
  border-color: rgba(88, 101, 242, .35);
}

.rb-badge--plan.is-plus {
  background: rgba(16, 185, 129, .18);
  color: #059669;
  border-color: rgba(16, 185, 129, .35);
}

.rb-badge--warning {
  background: #fffbeb;
  border-color: #facc15;
  color: #854d0e;
}

.rb-plan-stack {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rb-plan-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.rb-plan-label--missing {
  color: #d14343;
}

.rb-plan-current {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rb-border);
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--rb-surface) 85%, var(--rb-background) 15%);
}

.rb-plan-current__title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.rb-plan-current__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.rb-plan-current__price {
  font-weight: 600;
  color: var(--rb-primary-dark);
}

.rb-plan-current__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--rb-muted);
  font-size: 0.9rem;
}

.rb-plan-current__valid-until {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--rb-muted);
}

.rb-plan-current__features-wrapper {
  margin-top: 1rem;
}

.rb-plan-current__features-title {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.rb-plan-current__features {
  list-style: disc;
  margin: 0 0 0.25rem 1.25rem;
  padding: 0;
}

.rb-plan-feature {
  margin-bottom: 0.2rem;
  text-transform: capitalize;
}

.rb-plan-current__features.is-collapsed .rb-plan-feature--extra {
  display: none;
}

.rb-link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--rb-primary);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.rb-plan-overview {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto 2rem;
  padding: 1.25rem 1rem;
}

.rb-plan-overview__eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rb-primary);
  margin-bottom: 0.35rem;
}

.rb-plan-overview__title {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  font-weight: 700;
  margin: 0;
  color: var(--rb-text);
}

.rb-plan-overview__lead {
  font-size: 1rem;
  color: var(--rb-text-muted);
  margin: 0.85rem auto 0;
}

.rb-plan-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.rb-plan-summary__card {
  border: 1px solid color-mix(in oklab, var(--rb-border) 75%, transparent);
  border-radius: 18px;
  padding: 1.5rem;
  background: color-mix(in oklab, var(--rb-surface) 96%, transparent);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.rb-plan-summary__card.is-current {
  border-color: var(--rb-primary);
  box-shadow: 0 20px 45px rgba(241, 101, 41, 0.25);
}

.rb-plan-summary__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rb-text-muted);
  margin: 0;
}

.rb-plan-summary__title {
  margin: 0;
  font-size: 1.8rem;
  color: var(--rb-primary-dark);
}

.rb-plan-summary__tagline {
  margin: 0;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  color: var(--rb-text-muted);
}

.rb-plan-summary__price {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.rb-plan-summary__stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--rb-text-muted);
}

.rb-plan-summary__cta {
  margin-top: auto;
}

.rb-plan-summary__current {
  display: inline-flex;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rb-border) 25%, transparent);
  color: var(--rb-text-muted);
  font-size: 0.85rem;
}

.rb-plan-compare-wrapper {
  margin-top: 2rem;
  overflow-x: auto;
}

.rb-plan-compare {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.rb-plan-compare thead th {
  background: #ffffff;
  border-top: 1px solid color-mix(in oklab, var(--rb-border) 80%, transparent);
  padding: 1.5rem 1.25rem;
  text-align: left;
  vertical-align: top;
}

.rb-plan-compare thead th:first-child {
  vertical-align: bottom;
}

.rb-plan-compare tbody th {
  background: color-mix(in oklab, var(--rb-surface) 92%, transparent);
  border-top: 1px solid color-mix(in oklab, var(--rb-border) 85%, transparent);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  width: 225px;
}

.rb-plan-compare td {
  background: color-mix(in oklab, var(--rb-surface) 92%,
      transparent);
  border-top: 1px solid color-mix(in oklab, var(--rb-border) 85%, transparent);
  padding: 1rem 0.85rem 1rem 1.5rem;
  text-align: left;
}

.rb-plan-compare__plan-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rb-plan-compare__plan-head {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 190px;
}

.rb-plan-compare__plan-eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--rb-text-muted);
}

.rb-plan-compare__plan-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--rb-primary-dark);
}

.rb-plan-compare__plan-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rb-primary) 12%, transparent);
  color: var(--rb-primary);
  border: 1px solid color-mix(in oklab, var(--rb-primary) 35%, transparent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rb-plan-compare__plan-tagline {
  color: var(--rb-text-muted);
  margin: 0;
  min-height: 2.5rem;
}

.rb-plan-compare__plan-price {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  color: var(--rb-primary-dark);
  margin-top: auto;
}

.rb-plan-compare__plan-cta {
  margin-top: 0.75rem;
}

.rb-plan-compare__section-title {
  color: var(--rb-primary-dark);
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.rb-plan-compare__current-chip {
  display: inline-flex;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rb-border) 25%, transparent);
  color: var(--rb-text-muted);
  font-size: 0.85rem;
}

.rb-plan-compare__muted {
  color: var(--rb-text-muted);
}

.rb-plan-compare__indicator {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.rb-plan-compare__indicator.is-on {
  color: #00ffb0;
}

.rb-plan-compare__indicator.is-off {
  color: #9ca3af;
  font-size: 1.6rem;
}

.rb-plan-table {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.rb-plan-tier {
  border: 1px solid color-mix(in oklab, var(--rb-border) 75%, transparent);
  border-radius: 24px;
  padding: 2rem;
  background: color-mix(in oklab, var(--rb-surface) 95%, transparent);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.04);
}

.rb-plan-tier--featured {
  border-color: var(--rb-primary);
  box-shadow: 0 35px 60px rgba(88, 101, 242, 0.2);
  transform: translateY(-5px);
}

.rb-plan-tier__head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rb-plan-tier__badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rb-primary) 12%, transparent);
  color: var(--rb-primary);
  border: 1px solid color-mix(in oklab, var(--rb-primary) 35%, transparent);
}

.rb-plan-tier__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rb-text-muted);
  margin: 0;
}

.rb-plan-tier__title {
  margin: 0;
  font-size: 1.45rem;
}

.rb-plan-tier__tagline {
  color: var(--rb-text-muted);
  margin: 0.4rem 0 1rem;
  min-height: 2.5rem;
}

.rb-plan-tier__price {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.rb-plan-tier__stats,
.rb-plan-tier__features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rb-plan-tier__stats {
  color: var(--rb-text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.rb-plan-tier__features {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rb-plan-tier__features li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--rb-text);
}

.rb-plan-tier__features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--rb-primary);
  font-weight: 700;
}

.rb-plan-tier__cta {
  margin-top: auto;
}

.rb-plan-tier__current-chip {
  display: inline-flex;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--rb-border) 30%, transparent);
  color: var(--rb-text-muted);
  font-size: 0.85rem;
}

.rb-link-button:focus-visible {
  outline: 2px solid var(--rb-primary);
  outline-offset: 2px;
}

.rb-badge--status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  text-transform: capitalize;
  color: #fff;
}

.rb-status--running {
  background: linear-gradient(120deg, #22c55e, #16a34a);
  border: none;
}

.rb-status--ended {
  background: linear-gradient(120deg, #60a5fa, #3b82f6);
  border: none;
}

.rb-status--canceled {
  background: linear-gradient(120deg, #f87171, #ef4444);
  border: none;
}

.rb-status--failed,
.rb-status.rb-status--failed {
  background: linear-gradient(120deg, #fb7185, #e11d48);
  border: none;
  color: #fff;
}

.rb-topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rb-topbar__logout {
  margin: 0;
}

.rb-topbar__button {
  white-space: nowrap;
}

.rb-dashboard__content .rb-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2.5rem 3rem;
}

/* Modal */
.rb-modal[hidden] {
  display: none;
}

.rb-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.rb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.rb-modal__dialog {
  position: relative;
  margin: 8vh auto 0;
  width: min(560px, 92vw);
  background: var(--rb-surface);
  color: var(--rb-text);
  border: 1px solid var(--rb-border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.rb-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rb-border);
}

.rb-modal__title {
  margin: 0;
  font-size: 1.1rem;
}

.rb-modal__close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--rb-text);
}

.rb-modal__body {
  padding: 1rem 1.25rem;
}

.rb-modal__footer {
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  border-top: 1px solid var(--rb-border);
}

.rb-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.rb-fieldset--spaced {
  margin-top: 1rem;
}

.rb-fieldset__legend {
  font-weight: 700;
  margin-bottom: .5rem;
}

.rb-radio {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-right: 1rem;
}

.rb-dashboard__content .rb-main.rb-main--full {
  max-width: none;
  width: 100%;
}

/* Narrow layout for detail pages */
.rb-dashboard__content .rb-main.rb-main--narrow {
  max-width: 900px;
}

.rb-footer--dashboard {
  margin-top: auto;
  padding: 1.5rem 2rem 2rem;
  text-align: right;
  color: var(--rb-text-muted);
}

@media (max-width: 900px) {
  .rb-dashboard {
    min-height: auto;
  }

  .rb-dashboard__content {
    min-height: auto;
  }

  .rb-dashboard {
    flex-direction: column;
  }

  .rb-sidebar {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    border-right: none;
    border-bottom: 1px solid var(--rb-border);
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    position: static;
    /* disable sticky on mobile layout */
    height: auto;
    overflow: visible;
  }

  .rb-sidebar__toggle {
    display: inline-flex;
  }

  .rb-sidebar__nav {
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    overflow: visible;
  }

  .rb-sidebar__footer {
    display: none;
  }

  .rb-sidebar.is-open .rb-sidebar__nav,
  .rb-sidebar.is-open .rb-sidebar__footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .rb-sidebar.is-open .rb-sidebar__footer {
    gap: 0.5rem;
  }

  .rb-sidebar.is-open .rb-sidebar__nav .rb-sidebar__link {
    width: 100%;
  }

  .rb-sidebar__header {
    padding-right: 0;
  }

  .rb-sidebar__nav {
    -webkit-overflow-scrolling: auto;
  }

  .rb-sidebar__footer {
    margin-top: 0;
  }

  .rb-sidebar__profile {
    min-width: 150px;
    padding: 0.5rem 0.75rem;
  }

  .rb-dashboard__content .rb-main {
    padding: 0.5rem 0.5rem 3rem;
  }

  .rb-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
  }

  .rb-topbar__actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .rb-button {
    padding: 0.55rem 0.75rem;
  }
}

.rb-container {
  width: min(960px, 92vw);
  margin: 0 auto;
}

.rb-header {
  background: var(--rb-surface);
  border-bottom: 1px solid var(--rb-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.rb-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.rb-logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--rb-primary);
}

.rb-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.rb-nav__link {
  text-decoration: none;
  color: var(--rb-text);
  font-weight: 600;
}

.rb-nav__logout-form {
  margin: 0;
  display: flex;
}

.rb-nav__button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--rb-text);
  font-weight: 600;
  cursor: pointer;
}

/* Theme toggle */
.rb-theme-toggle {
  margin-left: 0.75rem;
  appearance: none;
  border: 1px solid var(--rb-border);
  background: var(--rb-surface);
  color: var(--rb-text);
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  line-height: 1;
}

.rb-theme-toggle:hover,
.rb-theme-toggle:focus {
  border-color: var(--rb-primary);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.rb-theme-toggle[aria-pressed="true"] .rb-theme-toggle__icon {
  content: '🌙';
}

.rb-theme-toggle__icon {
  font-size: 1rem;
}

.rb-nav__button:hover,
.rb-nav__button:focus {
  color: var(--rb-primary);
  text-decoration: underline;
}

.rb-main {
  padding: 2.5rem 0 3rem;
}

.rb-hero {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--rb-surface);
  border-radius: 16px;
  border: 1px solid var(--rb-border);
  box-shadow: 0 16px 40px rgba(88, 101, 242, 0.08);
  margin-bottom: 2rem;
}

.rb-hero__title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 0.5rem;
}

.rb-hero__subtitle {
  margin: 0 auto;
  max-width: 640px;
  color: var(--rb-text-muted);
}

.rb-hero__actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.rb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 0.75rem 1.5rem;
  min-height: 2.75rem;
  /* 高さを統一 */
  background: var(--rb-primary);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease;
  border: 2px solid transparent;
  /* 二次ボタンと同じ太さにして高さを完全一致 */
  cursor: pointer;
  line-height: 1;
  /* フォント差による見た目のズレを抑える */
}

/* Button size modifiers */
.rb-button--sm {
  padding: 0.45rem 0.9rem;
  min-height: 2.2rem;
  /* 小サイズの高さを統一 */
  font-size: 1rem;
  /* フォントサイズ差による見かけの高さ違いを解消 */
  border-radius: 10px;
}

.rb-button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.rb-button:hover,
.rb-button:focus {
  background: var(--rb-primary-dark);
}

.rb-button--secondary {
  background: transparent;
  color: var(--rb-primary);
  border: 2px solid var(--rb-primary);
}

.rb-button--secondary.rb-button--sm {
  border-width: 1px;
}

/* Improve contrast on hover for outline buttons */
.rb-button--secondary:hover,
.rb-button--secondary:focus {
  color: #fff;
  border-color: var(--rb-primary-dark);
}

.rb-button--discord {
  background: linear-gradient(135deg, #5a6bff, #7a8bff);
  color: #fff;
}

.rb-button--discord:hover,
.rb-button--discord:focus {
  background: linear-gradient(135deg, #5162f0, #6f82f0);
}

.rb-button--wide {
  min-width: 10rem;
}

/* Mobile: compact button padding */
@media (max-width: 900px) {
  .rb-button {
    padding: 0.55rem 0.75rem;
  }
}

.rb-card {
  background: var(--rb-surface);
  border-radius: 16px;
  border: 1px solid var(--rb-border);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.rb-card--tall {
  min-height: 220px;
}

.rb-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Compact actions: do not stretch buttons full width */
.rb-card__actions--compact {
  align-items: flex-start;
}

.rb-card__actions--center {
  align-items: center;
  text-align: center;
}

/* landing-specific styles moved to landing.css */

/* Collapsible (details/summary) for filters */
.rb-collapsible {
  border: 1px solid var(--rb-border);
  border-radius: 12px;
  background: var(--rb-surface);
  overflow: hidden;
  margin: 1rem 0;
}

.rb-collapsible>summary {
  list-style: none;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: color-mix(in oklab, var(--rb-primary) 5%, var(--rb-surface));
  user-select: none;
}

.rb-collapsible>summary::-webkit-details-marker {
  display: none;
}

.rb-collapsible>summary::before {
  content: '';
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--rb-primary);
  border-bottom: 2px solid var(--rb-primary);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.rb-collapsible[open]>summary::before {
  transform: rotate(45deg);
}

.rb-collapsible__body {
  border-top: 1px solid var(--rb-border);
  padding: 1rem 1rem 1.25rem;
}

/* Toggle label text depending on open state */
.rb-collapsible:not([open]) .rb-collapsible__label--open {
  display: none;
}

.rb-collapsible[open] .rb-collapsible__label--closed {
  display: none;
}

.rb-collapsible--spaced {
  margin-top: 0.5rem;
}

.rb-accordion__content--spaced {
  margin-top: 0rem;
  padding-top: 0rem;
}

.rb-form__group--full {
  width: 100%;
}

.rb-form__group--full .rb-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Edit form layout */
.rb-edit-section {
  background: color-mix(in oklab, var(--rb-surface) 96%, transparent);
  border: 1px solid color-mix(in oklab, var(--rb-border) 50%, transparent);
  border-radius: 20px;
  padding: 1.5rem;
  margin: 0 0 1.5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.rb-edit-section__title {
  margin: 0 0 1.1rem;
  font-size: 1.1rem;
}

.rb-edit-grid {
  display: grid;
  gap: 1rem 1.25rem;
}

.rb-edit-grid--two {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rb-edit-grid--single {
  grid-template-columns: 1fr;
}

@media (max-width: 640px) {
  .rb-edit-grid--two {
    grid-template-columns: 1fr;
  }
}

.rb-edit-grid .rb-form__group {
  margin: 0;
}

.rb-edit-grid .rb-form__group--full {
  grid-column: 1 / -1;
}

.rb-accordion.rb-edit-section {
  padding: 0;
}

.rb-accordion.rb-edit-section summary {
  padding: 1.25rem;
  border-bottom: none;
}

.rb-accordion__summary--stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.rb-accordion__title {
  font-weight: 600;
}

.rb-accordion__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--rb-text-muted);
}

.rb-accordion__content--spaced>.rb-edit-grid {
  padding: 1.25rem;
}

.rb-tooltip {
  position: relative;
}

.rb-tooltip[data-tooltip]:hover::after,
.rb-tooltip[data-tooltip]:focus-within::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -0.5rem;
  left: 0;
  transform: translateY(-100%);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 320px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  z-index: 5;
  pointer-events: none;
}

.rb-tooltip[data-tooltip]:hover::before,
.rb-tooltip[data-tooltip]:focus-within::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  width: 10px;
  height: 10px;
  transform: translateY(-50%) rotate(45deg);
  background: rgba(15, 23, 42, 0.95);
  z-index: 4;
  pointer-events: none;
}

.rb-card--narrow {
  max-width: 560px;
  margin: 0 auto;
}

.rb-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rb-card__title {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
}

.rb-card__title--flush {
  margin: 0;
}

.rb-card__subtitle {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.2rem;
}

.rb-card__text {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--rb-text-muted);
}

.rb-docs {
  max-width: 100%;
}

.rb-docs-section {
  margin-top: 1.5rem;
}

.rb-list--numbered {
  list-style: decimal;
  padding-left: 1.25rem;
}

.rb-docs-table code {
  background: color-mix(in srgb, var(--rb-primary) 8%, var(--rb-surface) 92%);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rb-border);
  border-radius: 4px;
  font-size: 0.95rem;
}

.rb-code {
  background: color-mix(in srgb, var(--rb-primary) 6%, var(--rb-surface) 94%);
  border: 1px solid var(--rb-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 1rem;
}

.rb-docs-example {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.rb-docs-example__title {
  margin-bottom: 0.35rem;
  color: var(--rb-text);
  font-size: 1.05rem;
  font-weight: 800;
}

.rb-docs-example__hint {
  margin: 0.35rem 0 0;
  color: var(--rb-text-muted);
  font-size: 0.95rem;
}

.rb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
  text-align: center;
}

.rb-pagination__info {
  font-weight: 600;
  color: var(--rb-text-muted);
}

.rb-guild-section {
  margin-top: 1.5rem;
}

.rb-card__text--muted {
  font-size: 0.9rem;
  color: var(--rb-text-muted);
  margin-bottom: 0;
}

.rb-form {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.rb-form__datetime {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rb-form__group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rb-form__actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rb-form label {
  font-weight: 600;
}

.rb-form select,
.rb-form input[type='number'],
.rb-form input[type='text'],
.rb-form input[type='url'],
.rb-form input[type='date'],
.rb-form input[type='time'],
.rb-form input[type='datetime-local'],
.rb-form textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--rb-border);
  border-radius: 12px;
  background: var(--rb-surface);
  color: var(--rb-text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  color-scheme: light;
  /* フォーム内蔵UIをライトに固定 */
}

.rb-form input::placeholder {
  color: var(--rb-text-muted);
  opacity: 0.8;
}

.rb-form select:hover,
.rb-form input[type='number']:hover,
.rb-form input[type='text']:hover,
.rb-form input[type='date']:hover,
.rb-form input[type='time']:hover,
.rb-form input[type='datetime-local']:hover,
.rb-form textarea:hover {
  border-color: color-mix(in oklab, var(--rb-primary) 25%, var(--rb-border));
}

.rb-form select:focus,
.rb-form input[type='number']:focus,
.rb-form input[type='text']:focus,
.rb-form input[type='date']:focus,
.rb-form input[type='time']:focus,
.rb-form input[type='datetime-local']:focus,
.rb-form textarea:focus {
  outline: none;
  border-color: var(--rb-primary);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

/* Invalid field highlight */
.rb-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
}

.rb-check.rb-invalid {
  outline: 3px solid rgba(239, 68, 68, 0.25);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Disabled (plan-gated) fields: gray-out consistently (light/dark) */
.rb-form select[disabled],
.rb-form input[disabled],
.rb-form textarea[disabled],
.rb-form [aria-disabled='true'] {
  background: color-mix(in oklab, var(--rb-surface) 70%, var(--rb-background) 30%);
  color: var(--rb-text-muted);
  border-color: color-mix(in oklab, var(--rb-border) 85%, var(--rb-text-muted) 15%);
  cursor: not-allowed;
  opacity: 0.8;
  /* keep readability while indicating disabled */
}

/* Remove interactive hover/focus feedback when disabled */
.rb-form select[disabled]:hover,
.rb-form input[disabled]:hover,
.rb-form textarea[disabled]:hover,
.rb-form [aria-disabled='true']:hover {
  border-color: color-mix(in oklab, var(--rb-border) 85%, var(--rb-text-muted) 15%);
  box-shadow: none;
}

/* Checkbox/label text muted when disabled */
.rb-check input[disabled]+span,
.rb-check[aria-disabled='true'] span {
  color: var(--rb-text-muted);
}

/* Group-level dimming when plan-gated; applied via JS helper */
.rb-form .rb-disabled {
  opacity: 0.75;
}

.rb-form .rb-disabled label {
  color: var(--rb-text-muted);
}

/* Accented group for better contrast on dark background */
.rb-form__group--accent {
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in oklab, var(--rb-border) 50%, transparent);
  border-radius: 12px;
  background: color-mix(in oklab, var(--rb-surface) 95%, transparent);
}

/* Ensure date/time pickers show visible icons */
.rb-form input[type='date'],
.rb-form input[type='time'],
.rb-form input[type='datetime-local'] {
  position: relative;
  padding-right: 2.2rem;
  /* space for icon */
}

.rb-form input[type='date']::-webkit-calendar-picker-indicator,
.rb-form input[type='time']::-webkit-calendar-picker-indicator,
.rb-form input[type='datetime-local']::-webkit-calendar-picker-indicator {
  opacity: 1;
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: .35rem;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1rem 1rem;
  filter: none;
  /* do not invert our custom icon */
}

/* Light theme icons */
.rb-form input[type='date']::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2352606d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
}

.rb-form input[type='time']::-webkit-calendar-picker-indicator,
.rb-form input[type='datetime-local']::-webkit-calendar-picker-indicator {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2352606d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  .rb-form input[type='date']::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  }

  .rb-form input[type='time']::-webkit-calendar-picker-indicator,
  .rb-form input[type='datetime-local']::-webkit-calendar-picker-indicator {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='12 6 12 12 16 14'/%3E%3C/svg%3E");
  }
}

.rb-form__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--rb-text-muted);
}

.rb-form__hint--inline {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rb-form__hint-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--rb-text-muted);
}

.rb-quick-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rb-button--xs {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
}

.rb-feedback {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  border: 1px solid var(--rb-border);
  font-weight: 500;
}

.rb-feedback--success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #047857;
}

.rb-feedback--info {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.rb-feedback--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.rb-inline-loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0;
  color: var(--rb-text-muted);
  font-size: 0.95rem;
}

.rb-inline-loading[hidden] {
  display: none;
}

.rb-inline-loading__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(88, 101, 242, 0.25);
  border-top-color: var(--rb-primary);
  animation: rb-spin 0.9s linear infinite;
}

.rb-alert--spaced {
  margin-bottom: 1rem;
}

.rb-alert {
  border: 1px solid var(--rb-border);
  border-radius: 8px;
  padding: 1rem;
}

.rb-alert--warning {
  background: #fffbeb;
  border-color: #facc15;
  color: #854d0e;
}

.rb-alert__title {
  font-size: 1rem;
  line-height: 1.4;
  margin: 0 0 0.4rem;
}

.rb-alert__text,
.rb-alert__meta {
  margin: 0.35rem 0;
}

.rb-alert__steps {
  margin: 0.7rem 0;
  padding-left: 1.25rem;
}

.rb-alert__steps li + li {
  margin-top: 0.25rem;
}

.rb-alert__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

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

/* Indented nested list for feature items */
.rb-list--nested {
  padding-left: 1.5rem;
  /* deeper indent */
  margin-left: 1rem;
  /* visual offset from parent label */
}

.rb-list--spaced-xs {
  margin-top: 0.25rem;
}

.rb-list--nested .rb-list__item {
  padding-left: 0;
  /* align bullets neatly */
  font-size: 0.95em;
  /* slightly smaller text */
}

.rb-list__item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rb-border);
}

.rb-list__item:last-child {
  border-bottom: none;
}

.rb-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rb-steps {
  padding-left: 1.25rem;
  color: var(--rb-text-muted);
}

.rb-steps__item {
  margin-bottom: 0.75rem;
}

.rb-table-wrapper {
  margin-top: 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--rb-border);
  border-radius: 14px;
  background: var(--rb-surface);
}

/* Spacing utility */
.rb-mb-1 {
  margin-bottom: 1rem;
}

.rb-table-wrapper:empty {
  display: none;
  border: none;
}

.rb-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.rb-table th,
.rb-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rb-border);
  text-align: left;
}

.rb-table th {
  font-weight: 700;
  background: rgba(88, 101, 242, 0.08);
}

.rb-table tbody tr:hover {
  background: rgba(88, 101, 242, 0.05);
}

.rb-table tbody tr.rb-table__row--warning {
  background: #fffbeb;
}

.rb-table tbody tr.rb-table__row--warning:hover {
  background: #fef3c7;
}

.rb-table__note {
  margin-top: 0.35rem;
  color: var(--rb-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.rb-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.rb-pagination__status {
  font-size: 0.9rem;
  color: var(--rb-text-muted);
}

.rb-status {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.rb-status--running {
  background: #ecfdf3;
  color: #047857;
}

.rb-status--ended {
  background: #eff6ff;
  color: #1d4ed8;
}

.rb-status--canceled {
  background: #fef2f2;
  color: #b91c1c;
}

.rb-status--failed,
.rb-status.rb-status--failed {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.rb-row--failed td {
  background: rgba(254, 242, 242, 0.65);
}

.rb-footer {
  padding: 1.5rem 0 2rem;
  text-align: center;
  color: var(--rb-text-muted);
}

.rb-footer__note {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.rb-plan-grid {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}


.rb-plan-card {
  border: 1px solid var(--rb-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  background: var(--rb-surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rb-plan-card__title {
  font-size: 1.15rem;
  margin: 0;
}

.rb-plan-card__price {
  margin: 0;
  color: var(--rb-text-muted);
  font-weight: 600;
}

.rb-plan-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--rb-text-secondary);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rb-plan-card__cta {
  margin-top: auto;
  padding-top: 1rem;
}

.rb-plan-card--selectable {
  border: 2px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rb-plan-card--selectable:hover,
.rb-plan-card--selectable:focus-within {
  border-color: var(--rb-primary);
  box-shadow: 0 12px 30px rgba(44, 82, 130, 0.12);
  transform: translateY(-2px);
}

.rb-plan-card__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rb-button--current {
  background: rgba(16, 185, 129, .15);
  color: #059669;
  border-color: rgba(16, 185, 129, .35);
  cursor: default;
}

.rb-logout {
  margin-top: 1.5rem;
}

.rb-guild-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.rb-guild-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem;
  border: 1px solid var(--rb-border);
  border-radius: 16px;
  background: var(--rb-surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.rb-guild__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--rb-border);
}

.rb-guild__icon--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--rb-primary);
}

.rb-guild__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rb-guild__name {
  margin: 0;
  font-size: 1.1rem;
}

.rb-guild__meta {
  margin: 0;
  color: var(--rb-text-muted);
  font-size: 0.9rem;
}

.rb-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.6);
  color: #ffffff;
  z-index: 1000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rb-loading__spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.25);
  border-top-color: #ffffff;
  animation: rb-spin 0.9s linear infinite;
}

.rb-loading__text {
  margin: 0;
  font-weight: 600;
}

.rb-loading--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes rb-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .rb-header__inner {
    flex-direction: column;
    gap: 0.75rem;
  }

  .rb-nav {
    width: 100%;
    justify-content: center;
  }

  .rb-hero {
    padding: 1.5rem 1rem;
  }

  .rb-form {
    grid-template-columns: 1fr;
  }

  .rb-form__actions {
    justify-content: flex-start;
  }

  .rb-table {
    min-width: 640px;
  }
}

/* Make label column compact for detail tables */
.rb-table--narrow th {
  width: 1%;
  white-space: nowrap;
}

.rb-table .rb-table__prize {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

.rb-table__note {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rb-table td:last-child {
  max-width: 300px;
}

/* Checkbox styled like radios */
.rb-check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
}

.rb-check input[type='checkbox'] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--rb-primary);
}

.rb-input--sm {
  min-height: 2.2rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--rb-surface) 97%, transparent), color-mix(in oklab, var(--rb-surface) 85%, transparent));
  border: 1px solid color-mix(in oklab, var(--rb-border) 80%, transparent);
  color: var(--rb-text);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.rb-input--sm:hover,
.rb-input--sm:focus {
  border-color: var(--rb-primary);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 3px rgba(88, 101, 242, 0.15);
  outline: none;
}

/* URL input with leading icon */
.rb-input--url {
  padding-left: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2352606d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.07 0l1.17-1.17a5 5 0 1 0-7.07-7.07L10 5'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.07 0L5.76 12.17a5 5 0 1 0 7.07 7.07L14 19'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .7rem 50%;
  background-size: 1.1rem 1.1rem;
}

@media (prefers-color-scheme: dark) {
  .rb-input--sm {
    background: linear-gradient(180deg, color-mix(in oklab, var(--rb-surface) 60%, transparent), color-mix(in oklab, var(--rb-surface) 40%, transparent));
    border-color: color-mix(in oklab, var(--rb-border) 50%, transparent);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
  }

  .rb-input--sm:hover,
  .rb-input--sm:focus {
    border-color: var(--rb-primary);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(88, 101, 242, 0.35);
  }

  .rb-input--url {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23cbd5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.07 0l1.17-1.17a5 5 0 1 0-7.07-7.07L10 5'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.07 0L5.76 12.17a5 5 0 1 0 7.07 7.07L14 19'/%3E%3C/svg%3E");
  }
}

.rb-collapsible--muted {
  border: 1px dashed var(--rb-border);
  background: #f9fafb;
}

.rb-plan-card--selectable {
  border: 2px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.rb-plan-card--selectable:hover,
.rb-plan-card--selectable:focus-within {
  border-color: var(--rb-primary);
  box-shadow: 0 12px 30px rgba(44, 82, 130, 0.12);
  transform: translateY(-2px);
}

.rb-plan-card__title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rb-raffle-id {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
}

.rb-raffle-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  color: var(--rb-primary);
  background: color-mix(in oklab, var(--rb-primary) 15%, var(--rb-background) 85%);
  border: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.rb-raffle-link:hover,
.rb-raffle-link:focus-visible {
  color: var(--rb-primary-dark);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 8px 16px rgba(44, 82, 130, 0.18);
  outline: none;
}

.rb-raffle-link--static {
  color: var(--rb-muted);
  background: color-mix(in oklab, var(--rb-surface) 90%, var(--rb-background) 10%);
}

.rb-raffle-link__badge {
  font-variant-numeric: tabular-nums;
}

.rb-raffle-link__chevron {
  font-size: 0.8rem;
  opacity: 0.7;
}

.rb-raffle-id__meta {
  font-size: 0.75rem;
  color: var(--rb-muted);
  word-break: break-all;
}

.rb-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--rb-border);
  border-radius: 999px;
  padding: 0.3rem 2rem 0.3rem 0.85rem;
  background: var(--rb-surface);
  font: inherit;
  color: var(--rb-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a7f89' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px 6px;
}

.rb-select:focus {
  outline: none;
  border-color: var(--rb-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.rb-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.rb-select--status {
  min-width: 140px;
}

.rb-ops-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
