/* Deutsches Dosenbier — Admin Control Panel (mobile-first) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap');

:root {
  --bg: #070709;
  --bg2: #0e0e12;
  --panel: rgba(255,255,255,0.045);
  --border: rgba(255,255,255,0.1);
  --text: #f3f3f5;
  --muted: #9b9ba6;
  --gold: #f5c518;
  --gold2: #ffd84a;
  --red: #e30613;
  --green: #3dd68c;
  --blue: #5865f2;
  --radius: 16px;
  --side: 260px;
  --top: 64px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --font: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* LOGIN */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(245,197,24,0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(227,6,19,0.1), transparent 50%),
    var(--bg);
}
.login-wrap { width: min(400px, 100%); }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 24px;
  text-align: center;
  backdrop-filter: blur(16px);
}
.login-logo {
  width: 88px;
  height: auto;
  margin: 0 auto 16px;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.45));
}
.login-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}
.login-sub { color: var(--muted); font-size: 0.9rem; margin: 6px 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.login-form input, .admin-main input, .admin-main select, .admin-main textarea {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}
.login-form input:focus, .admin-main input:focus, .admin-main select:focus, .admin-main textarea:focus {
  border-color: rgba(245,197,24,0.45);
}
.btn.sm {
  padding: 6px 10px;
  font-size: 0.78rem;
  border-radius: 10px;
}
.btn-primary, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}
.btn-primary, .btn.gold {
  background: linear-gradient(135deg, var(--gold), #d4a50f);
  color: #111;
  border: none;
  box-shadow: 0 8px 24px rgba(245,197,24,0.3);
}
.btn:hover, .btn-primary:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.back-link:hover { color: var(--gold); }
.alert {
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 600;
}
.alert.err {
  background: rgba(227,6,19,0.15);
  border: 1px solid rgba(227,6,19,0.35);
  color: #ff8a8a;
}

/* APP LAYOUT */
.admin-app {
  display: flex;
  min-height: 100vh;
}
.admin-side {
  width: var(--side);
  background: linear-gradient(180deg, #0e0e12, #0a0a0c);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform 0.3s var(--ease);
}
.side-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.side-brand img { width: 40px; height: auto; }
.side-brand strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--gold2);
  font-size: 1rem;
}
.side-brand span { font-size: 0.75rem; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: auto; }
.side-btn {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 11px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.side-btn:hover { background: rgba(255,255,255,0.04); }
.side-btn.active {
  background: linear-gradient(90deg, rgba(245,197,24,0.18), transparent);
  border-color: rgba(245,197,24,0.25);
  color: var(--gold2);
}
.side-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.bot-pill {
  text-align: center;
  padding: 8px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
}
.bot-pill.on { color: var(--green); border-color: rgba(61,214,140,0.35); background: rgba(61,214,140,0.08); }
.bot-pill.off { color: #ff8a8a; border-color: rgba(227,6,19,0.35); background: rgba(227,6,19,0.08); }
.side-link {
  text-align: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px;
  border-radius: 10px;
}
.side-link:hover { color: var(--gold); background: rgba(255,255,255,0.04); }
.side-link.danger:hover { color: #ff8a8a; }

.admin-main {
  flex: 1;
  margin-left: var(--side);
  padding: 18px 20px 40px;
  min-width: 0;
  max-width: 1100px;
}
.admin-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-top h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}
.muted { color: var(--muted); font-size: 0.88rem; }
.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}
.guild-select {
  margin-left: auto;
  min-width: 180px;
  max-width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.tab { display: none; }
.tab.active { display: block; animation: fade 0.25s var(--ease); }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.live-refresh {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--green);
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(61,214,140,0.25);
  background: rgba(61,214,140,0.08);
  transition: background 0.3s;
}
.live-refresh.pulse {
  background: rgba(61,214,140,0.22);
}
.pill-inline {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.pill-inline.ok { color: var(--green); border-color: rgba(61,214,140,0.35); }
.pill-inline.bad { color: #ff8a8a; border-color: rgba(227,6,19,0.35); }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card .n {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-all;
}
.card .l {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.panel h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.form-grid label, .panel > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-grid label.full, .panel > label.full { grid-column: 1 / -1; }
.form-grid label.check {
  flex-direction: row;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--text);
  gap: 10px;
  padding-top: 18px;
}
.form-grid label.check input { width: auto; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.log-list {
  max-height: 280px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.log-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.log-item b { color: var(--gold2); }
.table-wrap { overflow: auto; font-size: 0.85rem; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.table-wrap th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,24,0.96);
  border: 1px solid rgba(245,197,24,0.35);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); }
.toast.err { border-color: rgba(227,6,19,0.5); }
.side-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
}
.side-backdrop.show { display: block; }
code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* MOBILE */
@media (max-width: 900px) {
  .admin-side {
    transform: translateX(-105%);
  }
  .admin-side.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
    padding: 14px 14px 32px;
  }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .cards { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.check { padding-top: 4px; }
  .guild-select {
    margin-left: 0;
    width: 100%;
    order: 3;
    flex: 1 1 100%;
  }
  .admin-top { gap: 10px; }
  .quick-grid { grid-template-columns: 1fr; }
  .row.gap { flex-direction: column; align-items: stretch; }
  .row.gap .btn { width: 100%; }
}

@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
  .card .n { font-size: 1.1rem; }
  .panel { padding: 16px; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .admin-main { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .admin-side { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* Help tips (?) */
.lbl-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.help-tip {
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 50%;
  border: 1px solid rgba(245,197,24,0.45);
  background: rgba(245,197,24,0.12);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  padding: 0;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 4px;
  -webkit-tap-highlight-color: transparent;
}
.help-tip:hover,
.help-tip:focus-visible,
.help-tip.is-open {
  background: rgba(245,197,24,0.28);
  border-color: var(--gold);
  outline: none;
}
.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: min(260px, 70vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: #16161c;
  border: 1px solid rgba(245,197,24,0.35);
  color: #f3f3f5;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 80;
  white-space: normal;
}
.help-tip::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(245,197,24,0.35);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 81;
}
.help-tip:hover::after,
.help-tip:focus-visible::after,
.help-tip.is-open::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.help-tip:hover::before,
.help-tip:focus-visible::before,
.help-tip.is-open::before {
  opacity: 1;
}
label.check .help-tip { margin-left: auto; }
.form-grid label {
  position: relative;
}
@media (max-width: 900px) {
  .help-tip::after {
    left: 0;
    transform: translateX(0) translateY(4px);
    width: min(280px, calc(100vw - 48px));
  }
  .help-tip:hover::after,
  .help-tip:focus-visible::after,
  .help-tip.is-open::after {
    transform: translateX(0) translateY(0);
  }
  .help-tip::before { left: 10px; transform: none; }
}
