@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #faf8f3;
  --bg-alt: #f2ede2;
  --surface: #ffffff;
  --border: #e5ddd0;
  --border-strong: #d8cdb8;
  --text: #1c1814;
  --text-dim: #6b6560;
  --text-faint: #9a9186;
  --gold: #c9a84c;
  --gold-hover: #d8b85e;
  --gold-text: #97792f;
  --gold-soft: rgba(201, 168, 76, 0.14);
  --dark: #171310;
  --success: #3d8f5c;
  --danger: #c45c5c;
  --gradient: linear-gradient(135deg, #d8b85e 0%, #c9a84c 55%, #97792f 100%);
  --gradient-text: linear-gradient(120deg, #e2c479 0%, #c9a84c 45%, #93762d 100%);
  --sidebar-w: 260px;
  --radius-md: 20px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-text); text-decoration: none; font-weight: 600; }
a:hover { color: var(--gold-hover); }

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(680px 420px at 15% -8%, rgba(201, 168, 76, 0.14), transparent 65%),
    radial-gradient(520px 380px at 100% 10%, rgba(201, 168, 76, 0.08), transparent 60%),
    var(--bg);
  pointer-events: none;
  overflow: hidden;
}

/* Login */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px 32px;
  box-shadow: 0 20px 50px -24px rgba(28, 24, 20, 0.15);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-brand img { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; }
.login-brand h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-brand h1 span {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-brand p { font-size: 0.88rem; color: var(--text-dim); margin-top: 6px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--gold);
}
.form-group textarea { min-height: 88px; resize: vertical; }
.tbl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.key-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 24, 20, 0.45);
}
.key-edit-overlay.hidden { display: none !important; }
.key-edit-modal {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 22px 18px;
  box-shadow: 0 18px 48px rgba(28, 24, 20, 0.18);
}
.key-edit-modal h3 { margin-bottom: 6px; }
.key-edit-modal .form-group { margin-top: 14px; }
.key-edit-modal select,
.key-edit-modal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.key-edit-modal select:focus,
.key-edit-modal input[type="text"]:focus { border-color: var(--gold); }
.key-edit-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.key-edit-row input { flex: 1; }
.key-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.btn-danger-text { color: #c0392b; }
.btn-danger-text:hover { background: rgba(192, 57, 43, 0.08); }

.gen-key-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(201, 168, 76, 0.3);
  font-size: 0.88rem;
}
.gen-key-result code { color: #5865F2; font-weight: 700; }

.form-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 6px; }

.export-json-hint {
  margin: -8px 0 18px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

.visitor-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.visitor-user-cell .dc-avatar,
.visitor-user-cell .dc-avatar-img {
  flex-shrink: 0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
}
.visitor-user-cell .dc-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5865F2;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.rich-presence-guide {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(201, 168, 76, 0.25);
  margin-bottom: 8px;
}
.rich-presence-guide h4 {
  margin: 0 0 10px;
  font-size: 0.88rem;
}
.rich-presence-guide ol {
  margin: 0 0 0 18px;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.65;
}

.discord-member-preview {
  border-radius: 12px;
  overflow: hidden;
  background: #111214;
  border: 1px solid #1e1f22;
  max-width: 340px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.dmp-banner {
  height: 60px;
  background: linear-gradient(135deg, #5865f2 0%, #3c4ec9 50%, #7289da 100%);
}
.dmp-header {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 0 16px;
  margin-top: -28px;
}
.dmp-avatar-wrap { position: relative; flex-shrink: 0; }
.dmp-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid #111214;
  background: #5865f2;
  object-fit: cover;
}
.dmp-status-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 4px solid #111214;
  background: #23a559;
}
.dmp-status-dot.status-idle { background: #f0b232; }
.dmp-status-dot.status-dnd { background: #f23f43; }
.dmp-status-dot.status-invisible { background: #80848e; }
.dmp-names { padding-bottom: 8px; min-width: 0; }
.dmp-display-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: #f2f3f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dmp-username {
  font-size: 0.82rem;
  color: #b5bac1;
}
.dmp-activity {
  display: flex;
  gap: 12px;
  margin: 12px 16px 16px;
  padding: 12px;
  border-radius: 8px;
  background: #1e1f22;
}
.dmp-activity-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #2b2d31;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.dmp-activity-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dmp-activity-icon-fallback {
  font-size: 0.75rem;
  font-weight: 800;
  color: #dbdee1;
}
.dmp-activity-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #949ba4;
}
.dmp-activity-detail {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f2f3f5;
  margin-top: 2px;
}
.dmp-activity-sub {
  font-size: 0.78rem;
  color: #949ba4;
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  width: 100%;
  box-shadow: 0 8px 24px -8px rgba(201, 168, 76, 0.5);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-text); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }

.login-error {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(196, 92, 92, 0.1);
  border: 1px solid rgba(196, 92, 92, 0.25);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}
.login-error.show { display: block; }

.demo-box {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px dashed rgba(201, 168, 76, 0.4);
  font-size: 0.82rem;
  color: var(--text-dim);
}
.demo-box code {
  display: block;
  margin-top: 6px;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--gold-text);
  font-size: 0.95rem;
  user-select: all;
}

.login-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* App layout */
.app-view { display: none; min-height: 100vh; }
.app-view.active { display: flex; }

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}
.app-sidebar-head {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.app-sidebar-head .tenant {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.app-sidebar-head .tenant-name {
  font-size: 0.95rem;
  font-weight: 800;
  margin-top: 4px;
  color: var(--text);
}
.plan-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--gold-soft);
  color: var(--gold-text);
}

.app-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.app-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  text-align: left;
  margin-bottom: 4px;
}
.app-nav-btn:hover { background: var(--gold-soft); color: var(--text); }
.app-nav-btn.active { background: var(--gold-soft); color: var(--gold-text); }
.app-nav-btn svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }

.app-sidebar-foot {
  padding: 14px;
  border-top: 1px solid var(--border);
}
.app-sidebar-foot .key-display {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  word-break: break-all;
  margin-bottom: 10px;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px 36px 48px;
  max-width: 920px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.app-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.app-header p { color: var(--text-dim); font-size: 0.9rem; margin-top: 4px; }

.panel-section { display: none; animation: fadeIn 0.2s ease; }
.panel-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}
.panel-card h3 {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .app-sidebar { transform: translateX(-100%); }
  .app-main { margin-left: 0; padding: 20px 16px; }
}

.preview-banner {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 12px;
}
.preview-banner img { width: 100%; height: 100%; object-fit: cover; }
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 8px;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-drag {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.dropzone img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  display: none;
}
.dropzone.has-file img { display: block; }
.dropzone.has-file .dropzone-hint { display: none; }
.dropzone-banner { min-height: 92px; }
.dropzone-banner img { width: 100%; height: 92px; object-fit: cover; }
.dropzone-hint {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--dark);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s;
  z-index: 200;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { background: var(--success); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.stat-box strong { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-box span { font-size: 0.78rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.callout {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(201,168,76,0.25);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.hidden { display: none !important; }

/* Discord activity preview */
.discord-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: #2b2d31;
  color: #dbdee1;
  border: 1px solid #1e1f22;
  transition: box-shadow 0.3s;
}
.discord-preview:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.discord-preview-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient);
  flex-shrink: 0;
  position: relative;
}
.discord-preview-avatar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #23a559;
  border: 3px solid #2b2d31;
}
.discord-preview.status-idle .discord-preview-avatar::after { background: #f0b232; }
.discord-preview.status-dnd .discord-preview-avatar::after { background: #f23f43; }
.discord-preview-name { font-weight: 700; font-size: 0.95rem; color: #fff; }
.discord-preview-status { font-size: 0.72rem; color: #949ba4; margin-top: 2px; }
.discord-preview-activity { font-size: 0.78rem; color: #949ba4; margin-top: 6px; }

.loading-info {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  border: 1px solid rgba(201,168,76,0.25);
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.loading-info code {
  font-family: ui-monospace, monospace;
  font-size: 0.84em;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
}

.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

/* Animations */
@keyframes panelFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}
@keyframes panelShine {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes panelPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

.bg-glow::before,
.bg-glow::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  filter: blur(70px);
  animation: panelPulse 9s ease-in-out infinite;
}
.bg-glow::before {
  width: 400px; height: 400px;
  top: -5%; right: 10%;
  background: rgba(201, 168, 76, 0.15);
}
.bg-glow::after {
  width: 280px; height: 280px;
  bottom: 10%; left: 20%;
  background: rgba(201, 168, 76, 0.1);
  animation-delay: -4.5s;
}

.login-card {
  animation: panelFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.login-view .login-brand img {
  animation: panelFadeUp 0.6s ease 0.1s backwards;
}

.app-view.active .app-sidebar {
  animation: panelFadeUp 0.4s ease;
}
.app-view.active .app-main {
  animation: panelFadeUp 0.45s ease 0.05s backwards;
}

.panel-section.active {
  animation: panelFadeUp 0.35s ease;
}

.stat-box {
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.stat-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -12px rgba(28, 24, 20, 0.15);
  border-color: rgba(201, 168, 76, 0.35);
}

.anim-stat:nth-child(1) { animation: panelFadeUp 0.4s ease 0.05s backwards; }
.anim-stat:nth-child(2) { animation: panelFadeUp 0.4s ease 0.1s backwards; }
.anim-stat:nth-child(3) { animation: panelFadeUp 0.4s ease 0.15s backwards; }
.anim-stat:nth-child(4) { animation: panelFadeUp 0.4s ease 0.2s backwards; }

.panel-card {
  transition: transform 0.25s, box-shadow 0.25s;
}
.panel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -18px rgba(28, 24, 20, 0.12);
}

.app-nav-btn {
  transition: transform 0.2s, background 0.2s, color 0.2s;
}
.app-nav-btn:hover {
  transform: translateX(4px);
}
.app-nav-btn.active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s;
}
.btn-primary:hover::after {
  opacity: 1;
  animation: panelShine 1.2s ease;
}

.demo-box {
  animation: panelFadeUp 0.5s ease 0.25s backwards;
}

/* Login Discord */
.login-discord-block {
  margin-bottom: 20px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(88, 101, 242, 0.25);
  background: rgba(88, 101, 242, 0.06);
}
.login-discord-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.login-discord-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.86rem;
  color: var(--text-dim);
}
.login-discord-chip .dc-avatar-img,
.login-discord-chip .dc-avatar,
.admin-discord-chip .dc-avatar-img,
.admin-discord-chip .dc-avatar,
.sidebar-discord-user .dc-avatar-img,
.sidebar-discord-user .dc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #5865F2;
}
.dmp-activity-app {
  font-size: 0.72rem;
  color: #b5bac1;
  margin-top: 2px;
  font-weight: 650;
}
.login-discord-chip.connected span span {
  font-size: 0.72rem;
  color: var(--text-faint);
}
.btn-discord-connect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: #5865F2;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.btn-discord-connect:hover {
  background: #4752c4;
  transform: translateY(-1px);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-faint);
  font-size: 0.78rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.demo-keys-list {
  margin: 10px 0 0 18px;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
}
.demo-keys-list code {
  font-size: 0.78rem;
}

/* Admin hub */
.admin-view {
  display: none;
  min-height: 100vh;
}
.admin-view.active {
  display: grid;
  grid-template-columns: 260px 1fr;
  animation: panelFadeUp 0.4s ease;
}
.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  margin-top: 16px;
}
.admin-nav-btn {
  text-align: left;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.admin-nav-btn:hover { background: var(--gold-soft); color: var(--text); transform: translateX(4px); }
.admin-nav-btn.active { background: var(--gold-soft); color: var(--gold-text); box-shadow: inset 3px 0 0 var(--gold); }
.admin-main {
  padding: 28px 32px 48px;
  overflow: auto;
}
.admin-section { display: none; animation: panelFadeUp 0.35s ease; }
.admin-section.active { display: block; }
.admin-discord-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.admin-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.tbl-muted { font-size: 0.76rem; color: var(--text-faint); }
.key-cell {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
}
.table-wrap { overflow-x: auto; }
.table-card h3 { margin-bottom: 14px; }
.server-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.server-pick-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: transform 0.2s, border-color 0.2s;
}
.server-pick-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 168, 76, 0.4);
}
.server-pick-card h4 { margin-bottom: 6px; }
.server-pick-card p { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 10px; }
.server-pick-card code { display: block; font-size: 0.72rem; margin-bottom: 12px; }
.sidebar-discord-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 12px 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
}
.admin-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.3);
  font-size: 0.86rem;
}
.env-sync-block {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.env-sync-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.env-sync-preview {
  margin: 0;
  padding: 14px;
  font-family: ui-monospace, monospace;
  font-size: 0.76rem;
  line-height: 1.6;
  background: #1c1814;
  color: #e8e0d4;
  overflow-x: auto;
  white-space: pre-wrap;
}
.discord-preview-app {
  font-size: 0.68rem;
  color: #949ba4;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .admin-view.active { grid-template-columns: 1fr; }
  .admin-sidebar { position: relative; height: auto; min-height: auto; }
}

