:root {
  --brand: #8b5cf6;
  --brand-light: #a78bfa;
  --brand-dark: #6d28d9;
  --brand-glow: rgba(139, 92, 246, 0.35);
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a26;
  --border: #2e2e3a;
  --text: #f8fafc;
  --muted: #94a3b8;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px var(--brand-glow);
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.18), transparent),
    radial-gradient(ellipse at 100% 100%, rgba(99, 102, 241, 0.1), transparent),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
}

body::-webkit-scrollbar {
  width: 8px;
}
body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* Pages plein écran (login, serveurs, propriétaire) */
#view-login.active,
#view-guilds.active,
#view-owner.active {
  min-height: 100vh;
  min-height: 100dvh;
}

#view-guilds .guild-picker,
#view-owner .owner-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Login */
#view-login {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  position: relative;
  background: linear-gradient(145deg, rgba(18, 18, 26, 0.95), rgba(18, 18, 26, 0.75));
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 24px;
  padding: 3rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow), var(--shadow-glow);
  text-align: center;
  backdrop-filter: blur(16px);
}

.login-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), transparent 50%, rgba(99, 102, 241, 0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.brand-icon-wrap {
  display: inline-flex;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.25);
  margin-bottom: 1rem;
}

.brand-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand p {
  color: var(--muted);
  margin-top: 0.25rem;
}

.login-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 1.5rem 0 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-discord {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  color: white;
  width: 100%;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}

.btn-discord:hover {
  box-shadow: 0 12px 28px rgba(88, 101, 242, 0.45);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white;
  box-shadow: 0 6px 20px var(--brand-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.error-text {
  color: var(--error);
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.oauth-setup {
  text-align: left;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 178, 50, 0.35);
  background: rgba(240, 178, 50, 0.08);
  font-size: 0.85rem;
  line-height: 1.6;
}

.oauth-setup ol {
  margin: 0.75rem 0 0 1.1rem;
}

.oauth-setup code {
  display: block;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  word-break: break-all;
}

.oauth-setup a {
  color: var(--brand-light);
}

.btn-discord.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 22, 31, 0.8);
  backdrop-filter: blur(8px);
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.guild-picker {
  flex: 1;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.guild-picker h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

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

.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.guild-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.guild-card:hover {
  border-color: var(--brand-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(139, 92, 246, 0.2);
}

.guild-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.guild-card-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.guild-card span {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Dashboard layout */
#view-dashboard.active {
  flex-direction: row;
}

.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  min-height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.15);
  font-size: 1.1rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  background: none;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(139, 92, 246, 0.08);
  color: var(--text);
}

.nav-item.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text);
  border-left-color: var(--brand-light);
  font-weight: 600;
}

.sidebar-back {
  margin-top: auto;
  width: 100%;
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.guild-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.panel-content {
  padding: 1.5rem 2rem 2rem;
  overflow-y: auto;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  position: relative;
  background: linear-gradient(160deg, var(--bg-card), rgba(18, 18, 26, 0.6));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139, 92, 246, 0.35);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), transparent);
  opacity: 0.7;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, var(--brand-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table th,
.data-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table th {
  background: var(--bg-hover);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tr:hover td {
  background: rgba(139, 92, 246, 0.04);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Settings form */
.settings-form {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-group input[type='text'] {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

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

.form-row input {
  flex: 1;
  min-width: 120px;
  padding: 0.65rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
}

.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.toggle-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem;
  color: var(--brand-light);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-open {
  background: rgba(35, 165, 89, 0.2);
  color: var(--success);
}

.badge-closed {
  background: rgba(161, 161, 170, 0.2);
  color: var(--muted);
}

.badge-claimed {
  background: rgba(240, 178, 50, 0.2);
  color: var(--warning);
}

.loading {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.empty {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--success);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  z-index: 100;
}

@keyframes slideIn {
  from {
    transform: translateY(1rem);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  /* ——— Login ——— */
  #view-login {
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .login-card {
    padding: 1.5rem 1.15rem;
    margin: 0;
    border-radius: 18px;
    max-width: none;
  }

  .brand h1 {
    font-size: 1.75rem;
  }

  .brand-icon {
    font-size: 2rem;
  }

  .login-desc {
    margin: 1rem 0 1.25rem;
    font-size: 0.9rem;
  }

  .oauth-setup {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
  }

  .oauth-setup code,
  .oauth-redirect-uri {
    font-size: 0.75rem;
    word-break: break-all;
  }

  .btn-discord {
    min-height: 48px;
  }

  /* ——— Topbar (serveurs + propriétaire) ——— */
  #view-guilds .topbar,
  #view-owner .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right)) 0.65rem
      max(0.85rem, env(safe-area-inset-left));
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .topbar-brand {
    font-size: 0.95rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-owner .topbar-brand {
    font-size: 0.88rem;
  }

  .topbar-user {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    max-width: 100%;
    width: 100%;
  }

  #view-guilds .topbar-user {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5rem;
  }

  #btn-owner-panel {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .topbar-user .btn {
    min-height: 44px;
    font-size: 0.85rem;
    padding: 0.55rem 0.85rem;
  }

  #view-owner .topbar-user {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
  }

  #view-owner .topbar-user .btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 7rem;
    justify-content: center;
  }

  #user-name {
    max-width: min(12rem, 45vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
  }

  .avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  /* ——— Choix serveur ——— */
  .guild-picker {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  .guild-picker h2 {
    font-size: 1.25rem;
  }

  .guild-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .guild-card {
    padding: 1rem;
    min-height: 56px;
  }

  .guild-card span {
    font-size: 0.9rem;
    word-break: break-word;
  }

  /* ——— Panel propriétaire ——— */
  .owner-panel {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  .owner-hero {
    padding: 1rem;
  }

  .owner-hero h2 {
    font-size: 1.15rem;
  }

  .owner-hero p {
    font-size: 0.85rem;
  }

  .owner-hero code {
    word-break: break-all;
    font-size: 0.75rem;
  }

  .owner-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.35rem;
    scrollbar-width: thin;
  }

  .owner-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .owner-tab-body {
    padding: 1rem;
    min-height: 200px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .owner-block-card {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    text-align: left;
  }

  .owner-block-card .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .owner-reason-chips {
    gap: 0.4rem;
  }

  .owner-reason-chip {
    font-size: 0.75rem;
    padding: 0.5rem 0.65rem;
    max-width: 100%;
  }

  .owner-form {
    max-width: 100%;
  }

  .owner-logs-table {
    display: block;
    min-width: 520px;
  }

  .owner-tab-body .data-table {
    min-width: 520px;
  }

  #view-dashboard.active {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.75rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: unset;
    gap: 0.35rem;
  }

  .nav-item {
    min-height: 44px;
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
  }

  .sidebar-back {
    margin-top: 0;
    width: 100%;
  }

  .main-content {
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 480px;
  }

  .partnership-bl-fields {
    grid-template-columns: 1fr;
  }

  .partnership-bl-item {
    flex-direction: column;
    align-items: stretch;
  }

  .card-panel,
  .owner-form {
    max-width: 100%;
  }
}

.preview-box {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  min-height: 2.5rem;
  white-space: pre-wrap;
}

.inline-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  width: 100%;
  max-width: 140px;
}

.inline-num {
  max-width: 80px;
}

.full-width {
  width: 100%;
  margin-top: 0.5rem;
}

/* Panel propriétaire */
#view-owner.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#view-owner .topbar {
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(12px);
}

.owner-panel {
  flex: 1;
  padding: 1.5rem 2rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.owner-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.owner-hero {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.2), rgba(18, 18, 26, 0.9));
  box-shadow: var(--shadow-glow);
}

.owner-hero h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.owner-hero p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.owner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.owner-tab {
  appearance: none;
  font: inherit;
  font-family: inherit;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.owner-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.owner-tab.active {
  color: var(--text);
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px var(--brand-glow);
}

.owner-tab-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-height: 280px;
  box-shadow: var(--shadow);
}

.owner-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted);
  padding: 3rem 1rem;
}

.owner-loading::before {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: owner-spin 0.7s linear infinite;
}

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

.owner-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.5;
}

.owner-alert strong {
  display: block;
  color: #fff;
  margin-bottom: 0.35rem;
}

.owner-empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem;
  font-size: 0.95rem;
}

.owner-block-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.owner-block-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.owner-block-card:hover {
  border-color: rgba(139, 92, 246, 0.35);
}

.owner-block-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.owner-block-badge.guild {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.owner-block-badge.user {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.owner-block-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.owner-block-meta code {
  color: var(--brand-light);
  background: rgba(0, 0, 0, 0.35);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.owner-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 520px;
}

.owner-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.owner-detail-caption {
  display: block;
  margin-bottom: 0.15rem;
}

.owner-form input,
.owner-form select,
.owner-form textarea,
.owner-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  width: 100%;
}

.owner-form textarea {
  resize: vertical;
  min-height: 4rem;
  font-family: inherit;
}

.owner-select {
  cursor: pointer;
  color-scheme: dark;
}

.owner-select option {
  background: var(--bg-card);
  color: var(--text);
}

.owner-reason-field {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin: 0;
}

.owner-reason-field legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.owner-reason-hint {
  font-size: 0.85rem;
  margin: 0 0 0.65rem;
}

.owner-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}

.owner-reason-chip {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  max-width: 100%;
}

.owner-reason-chip:hover {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.45);
}

.owner-reason-chip.selected {
  color: var(--text);
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--brand);
}

.owner-reason-chip-other {
  border-style: dashed;
  font-style: italic;
}

.owner-reason-chip-other.selected {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
}

.owner-checkbox {
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem !important;
  color: var(--text) !important;
}

.owner-hint {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.owner-logs-table {
  font-size: 0.85rem;
}

/* Blacklist partenariats (page serveur) */
.partnership-blacklist-panel {
  margin-bottom: 2rem;
  padding: 1.25rem;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.06);
}

.partnership-bl-desc {
  margin: 0.35rem 0 1rem;
  font-size: 0.9rem;
}

.partnership-bl-form {
  margin-bottom: 1.25rem;
}

.partnership-bl-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.partnership-bl-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.partnership-bl-fields input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.65rem;
}

.partnership-bl-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.partnership-bl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.partnership-bl-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  vertical-align: middle;
}

tr.row-blacklisted {
  opacity: 0.85;
  background: rgba(239, 68, 68, 0.05);
}

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

.partnership-active-list li {
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.partnership-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Bans serveurs & documentation */
.guild-panel-card {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.guild-panel-desc {
  margin: 0.35rem 0 1rem;
  font-size: 0.9rem;
}

.guild-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.guild-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.guild-form-grid input,
.guild-form-grid select,
.guild-form-grid textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font-family: inherit;
}

.guild-form-grid button[type='submit'] {
  grid-column: 1 / -1;
  justify-self: start;
}

.server-ban-panel {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.server-ban-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.server-ban-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.server-ban-meta {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.doc-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.doc-upload-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1 1 200px;
}

.doc-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-file-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.doc-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .guild-form-grid {
    grid-template-columns: 1fr;
  }

  .server-ban-item,
  .doc-file-item {
    flex-direction: column;
    align-items: stretch;
  }

  .doc-file-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.card-panel {
  border: none;
  padding: 0;
  background: transparent;
}
