/* ─── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d24;
  --surface2: #21252e;
  --surface3: #2a2d38;
  --accent:   #5865f2;
  --accent2:  #4752c4;
  --text:     #dcddde;
  --text2:    #96989d;
  --text3:    #6d6f78;
  --success:  #23a55a;
  --danger:   #da373c;
  --warn:     #f0b132;
  --border:   rgba(255, 255, 255, 0.07);
  --radius:   8px;
}

body {
  font-family: 'Segoe UI', 'gg sans', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 15px;
}

code {
  font-family: 'Consolas', 'Fira Code', monospace;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.875em;
}

/* ─── Layout ────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon { font-size: 1.35rem; }
.logo-text {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

.nav-links {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text2);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
}

.nav-icon { font-size: 1rem; line-height: 1; }



/* ─── Main ──────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Topbar ────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.page-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8125rem;
  color: var(--text2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online  { background: var(--success); box-shadow: 0 0 5px var(--success); }
.status-dot.offline { background: var(--danger);  box-shadow: 0 0 5px var(--danger); }
.status-dot.loading { background: var(--warn); }
.status-dot.warn    { background: var(--warn);    box-shadow: 0 0 5px var(--warn); }

/* ─── Content ───────────────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.content::-webkit-scrollbar { width: 5px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Stat Cards ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat-icon  { font-size: 1.4rem; margin-bottom: 10px; }

.stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text3);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Section Header ────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
}

.section-count {
  font-size: 0.75rem;
  color: var(--text3);
  background: var(--surface2);
  padding: 1px 8px;
  border-radius: 10px;
}

/* ─── Embed Grid ────────────────────────────────────────────────────── */
.embed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EMBED  –  New Discord Style (2025)
   Farbiger Balken oben, abgerundete Ecken, dunkles #1e1f22
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.embed.embed-v2 {
  background: #1e1f22;
  border-radius: 10px;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.embed-v2-accent {
  height: 3px;
  width: 100%;
}

.embed-v2-body {
  padding: 14px 16px 14px 16px;
}

.embed-v2 .embed-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: #ffffff;
  margin-bottom: 7px;
}

.embed-v2 .embed-description {
  font-size: 0.875rem;
  color: #b5bac1;
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.embed-v2 .embed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.embed-v2 .embed-field {
  flex: 1 1 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  padding: 7px 10px;
}

.embed-v2 .embed-field.inline { flex: 0 1 calc(50% - 4px); }

.embed-v2 .embed-field-name {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #87898f;
  margin-bottom: 3px;
}

.embed-v2 .embed-field-value {
  font-size: 0.9375rem;
  color: #e3e5e8;
  font-weight: 500;
}

.embed-v2 .embed-footer {
  margin-top: 12px;
  font-size: 0.75rem;
  color: #6d6f78;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success { background: rgba(35, 165, 90, 0.2);  color: #3ba55d; }
.badge-danger  { background: rgba(218, 55, 60, 0.2);  color: #ed4245; }
.badge-warn    { background: rgba(240, 177, 50, 0.18); color: #f0b132; }
.badge-neutral { background: rgba(255, 255, 255, 0.08); color: var(--text3); }
.badge-accent  { background: rgba(88, 101, 242, 0.2);  color: #7289da; }

/* ─── Back button ───────────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: none;
  background: none;
  padding: 4px 0;
  transition: color 0.12s;
}

.back-btn:hover { color: var(--text); }

/* ─── Key link ──────────────────────────────────────────────────────── */
.key-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}

.key-link:hover { text-decoration: underline; }

/* ─── License Check Form ────────────────────────────────────────────── */
.check-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 460px;
  margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-bottom: 7px;
}

.form-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.15);
}

.form-group input::placeholder { color: var(--text3); }

/* ─── Button ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: filter 0.12s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }

/* ─── Loading / Empty ───────────────────────────────────────────────── */
.loading {
  color: var(--text3);
  font-size: 0.9375rem;
  padding: 28px 0;
}

.empty-hint {
  color: var(--text3);
  font-size: 0.875rem;
  margin-top: 6px;
}

/* ─── Auth Screens ──────────────────────────────────────────────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 40px;
  width: 390px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card-wide { width: 500px; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.auth-logo .logo-icon { font-size: 1.5rem; }
.auth-logo .logo-text { font-weight: 800; font-size: 1.125rem; color: var(--text); }

.auth-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.auth-subtitle {
  font-size: 0.8125rem;
  color: var(--text2);
  line-height: 1.55;
  margin-top: -6px;
}

.auth-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 0.8125rem;
}

/* ─── Full-width button ─────────────────────────────────────────────── */
.btn-full { width: 100%; justify-content: center; }

/* ─── TOTP elements ─────────────────────────────────────────────────── */
.totp-qr {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.totp-qr canvas, .totp-qr img {
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.totp-secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.totp-secret-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.totp-secret-box code {
  flex: 1;
  font-size: 0.8125rem;
  color: var(--text);
  background: none;
  padding: 0;
  word-break: break-all;
  letter-spacing: 0.08em;
}

.copy-btn {
  background: var(--surface3);
  border: none;
  color: var(--text2);
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: background 0.1s, color 0.1s;
}

.copy-btn:hover { background: var(--accent); color: #fff; }

.totp-input {
  font-size: 1.375rem;
  letter-spacing: 0.35em;
  text-align: center;
  font-family: 'Consolas', 'Fira Code', monospace;
}

/* ─── Logout button ─────────────────────────────────────────────────── */
.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8125rem;
  margin-left: 10px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.logout-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ─── Button variants ───────────────────────────────────────────────── */
.btn-secondary {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { filter: brightness(1.15); }

.btn-danger {
  background: var(--danger, #da373c);
  color: #fff;
  border: none;
}
.btn-danger:hover { filter: brightness(1.15); }

.btn-discord {
  background: #5865f2;
  color: #fff;
  border: none;
}
.btn-discord:hover { filter: brightness(1.12); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: -4px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8125rem;
}

/* ─── Key actions (footer of key embed) ─────────────────────────────── */
.key-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Modal overlay ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-card h3 {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.modal-error {
  min-height: 16px;
  color: var(--danger, #da373c);
  font-size: 0.8125rem;
}

/* ─── Add-plugin form (inside key detail) ───────────────────────────── */
.add-plugin-form {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 14px;
}

.add-plugin-form h4 {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.form-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 140px;
}

.form-row select,
.form-row input[type="number"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.9rem;
  width: 100%;
}

/* ─── Sidebar: nav-section labels + footer ─────────────────────────── */
.nav-section {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 14px 20px 4px;
  list-style: none;
  user-select: none;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-role-badge {
  font-size: 0.6875rem;
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 2px 8px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Users / Roles page: data table ───────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead th {
  text-align: left;
  padding: 6px 12px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: rgba(255,255,255,0.03); }

/* ─── Chips ────────────────────────────────────────────────────────── */
.role-chip {
  display: inline-block;
  background: rgba(88, 101, 242, 0.18);
  color: #8b9cf4;
  border-radius: 99px;
  padding: 1px 9px;
  font-size: 0.78rem;
  font-weight: 600;
}

.perm-chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text2);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 1px 2px;
}

.text-muted { color: var(--text3); }

/* ─── Permission checkbox grid ─────────────────────────────────────── */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}

.perm-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
  color: var(--text2);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.1s;
}

.perm-check:hover { background: rgba(255,255,255,0.05); }
.perm-check input[type="checkbox"] { accent-color: var(--accent); }

/* ─── Lookup row (Meine Lizenzen) ─────────────────────────────────── */
.lookup-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lookup-row input {
  flex: 1;
}
