
.container {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 28px;
}

.page-hero.compact {
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hero-text,
.muted {
  color: var(--text-soft);
  opacity: 1;
}

.guild-grid,
.modules-grid,
.stats-grid {
  display: grid;
  gap: 18px;
}

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

.modules-grid {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 20px;
}

.guild-card,
.module-card,
.stat-card,
.side-card,
.panel-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
  color: var(--text);
}

.guild-card,
.module-card {
  min-height: 220px;
}

.guild-card__top,
.module-card__header,
.module-card__footer,
.status-row,
.switch-row,
.form-actions,
.guild-layout {
  display: flex;
  gap: 12px;
}

.guild-card__top,
.module-card__header,
.form-actions,
.guild-layout {
  align-items: flex-start;
  justify-content: space-between;
}

.guild-card__top,
.module-title,
.managed-guild-meta {
  min-width: 0;
}

.guild-card__footer,
.module-card__footer {
  margin-top: auto;
}

.guild-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.module-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.module-card:hover,
.guild-card:hover {
  transform: translateY(-2px);
}

.guild-avatar {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(175, 122, 69, 0.18), rgba(252, 215, 136, 0.28));
  border: 1px solid rgba(175, 122, 69, 0.16);
  color: var(--text);
  font-weight: 800;
  font-size: 1.25rem;
}

.guild-avatar.large {
  width: 82px;
  height: 82px;
  border-radius: 24px;
}

.guild-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center;
}

.guild-layout {
  align-items: stretch;
  gap: 24px;
}

.guild-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guild-main {
  flex: 1;
  min-width: 0;
}

.side-card h1,
.side-card h2,
.side-card h3,
.module-title h3,
.managed-guild-meta h2,
.module-page-title {
  margin: 0;
}

.side-card > .muted,
.managed-guild-meta .muted,
.module-title p,
.module-card__body p,
.module-config-note {
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.is-online {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-badge.is-offline {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-badge.is-neutral {
  background: rgba(175, 122, 69, 0.08);
  color: var(--text-soft);
  border: 1px solid rgba(175, 122, 69, 0.12);
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(175, 122, 69, 0.04);
  border: 1px solid rgba(175, 122, 69, 0.08);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.module-nav a.is-active,
.module-nav a:hover {
  background: rgba(252, 215, 136, 0.22);
  border-color: rgba(175, 122, 69, 0.2);
  transform: translateX(2px);
}

.module-nav-icon,
.module-icon-svg,
.module-page-title-icon {
  display: block;
  flex: 0 0 auto;
}

.module-nav-icon {
  width: 18px;
  height: 18px;
}

.module-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.module-title > div,
.managed-guild-meta {
  min-width: 0;
}

.module-title h3,
.managed-guild-meta h2 {
  font-size: 1.15rem;
  line-height: 1.25;
  word-break: break-word;
}

.module-title p,
.managed-guild-meta p,
.managed-guild-meta .status-row {
  margin-top: 8px;
}

.module-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(175, 122, 69, 0.08);
  border: 1px solid rgba(175, 122, 69, 0.12);
  flex: 0 0 48px;
}

.module-icon-svg {
  width: 24px;
  height: 24px;
}

.module-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.module-config-note {
  color: var(--danger-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: none;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

.btn-primary {
  background: #5865f2;
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(0.97);
}

.btn-secondary {
  background: rgba(175, 122, 69, 0.08);
  color: var(--text);
  border: 1px solid rgba(175, 122, 69, 0.12);
}

.btn-success-soft {
  background: var(--success-bg);
  color: var(--success-text);
}

.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-disabled {
  background: rgba(125, 98, 72, 0.12);
  border: 1px solid rgba(125, 98, 72, 0.18);
  color: rgba(125, 98, 72, 0.8);
  cursor: not-allowed;
  pointer-events: none;
}

.inline-form,
.module-switch-form {
  margin: 0;
}

.panel-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.module-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-header h3,
.section-header p {
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.check-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(175, 122, 69, 0.16);
  background: var(--input-bg);
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  resize: vertical;
}

.switch-row {
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(175, 122, 69, 0.05);
  border: 1px solid rgba(175, 122, 69, 0.08);
}

.switch-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(125, 98, 72, 0.22);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
  border: none;
  outline: none;
}

.switch-row input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
  transition: transform 0.18s ease;
}

.switch-row input[type="checkbox"]:checked {
  background: #5865f2;
}

.switch-row input[type="checkbox"]:checked::before {
  transform: translateX(22px);
}

.module-test-form {
  display: flex;
  justify-content: flex-end;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card strong {
  font-size: 26px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-soft);
}

.managed-guild-card {
  min-height: 210px;
}

.managed-guild-avatar {
  width: 70px;
  height: 70px;
  min-width: 70px;
  border-radius: 22px;
}

.managed-guild-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.managed-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.managed-guild-footer {
  display: flex;
  justify-content: flex-start;
}

.toggle-switch {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.toggle-switch__track {
  width: 56px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: rgba(125, 98, 72, 0.22);
  transition: background 0.18s ease;
}

.toggle-switch__thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
  transition: transform 0.18s ease;
}

.toggle-switch.is-on .toggle-switch__track {
  background: #5865f2;
}

.toggle-switch.is-on .toggle-switch__thumb {
  transform: translateX(24px);
}

.toggle-switch:focus-visible,
.btn:focus-visible,
.module-nav a:focus-visible {
  outline: 3px solid rgba(88, 101, 242, 0.28);
  outline-offset: 2px;
}

.module-page-hero {
  margin-bottom: 24px;
}

.module-page-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 10px;
}

.module-page-title-icon {
  width: 30px;
  height: 30px;
}

.module-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .guild-layout {
    flex-direction: column;
  }

  .guild-sidebar {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .guild-grid,
  .modules-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .guild-card__top,
  .module-card__header,
  .module-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .toggle-switch {
    align-self: flex-end;
  }
}
