/* ============================================================
   CrazyDePanel — Webpanel Theme
   Reines CSS-Redesign. Keine Markup-Klasse wurde umbenannt,
   jede View profitiert automatisch.
   ============================================================ */

:root,
:root[data-theme="dark"] {
  /* palette — dark (default) */
  --bg:        #0b0e14;
  --bg-1:      #10141d;
  --bg-2:      #141a24;
  --bg-3:      #1b222e;
  --bg-inset:  #0d1119;
  --border:    #262f3d;
  --border-soft: #1e2530;
  --text:      #e6edf3;
  --text-dim:  #b3bdc9;
  --muted:     #7d8896;

  --accent:    #3fb950;
  --accent-2:  #58a6ff;
  --accent-2-ink: #cfe4ff;

  --good-bg:   #0f2a17;
  --good-bd:   #1f6f2e;
  --good-fg:   #7ee787;
  --warn-bg:   #2a2113;
  --warn-bd:   #6f5a26;
  --warn-fg:   #e3b341;
  --bad-bg:    #2a1210;
  --bad-bd:    #6f2a26;
  --bad-fg:    #ff9d95;

  --ring:      0 0 0 3px rgba(88, 166, 255, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow:    0 8px 24px -10px rgba(0, 0, 0, .55), 0 2px 6px -2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 30px 80px -25px rgba(0, 0, 0, .7);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --grad-brand: linear-gradient(115deg, #58a6ff 0%, #3fb950 100%);
  --grad-line:  linear-gradient(90deg, transparent, var(--accent-2), transparent);
  --maxw: 1180px;
  --nav-w: 256px;
  --font: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* Light-Tokens: als Systemvorgabe (sofern nicht ausdruecklich "dark" gewaehlt)
   und bei ausdruecklicher Wahl "light". Selber Wertesatz. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #f4f6fb;
    --bg-1:      #ffffff;
    --bg-2:      #ffffff;
    --bg-3:      #eef1f7;
    --bg-inset:  #f0f3f9;
    --border:    #d7dee9;
    --border-soft: #e5eaf1;
    --text:      #131a24;
    --text-dim:  #38424f;
    --muted:     #6a7684;

    --accent:    #1a7f37;
    --accent-2:  #0969da;
    --accent-2-ink: #0a3d80;

    --good-bg:   #e7f6ec;
    --good-bd:   #a7dcb6;
    --good-fg:   #1a7f37;
    --warn-bg:   #fdf3e0;
    --warn-bd:   #ecc98a;
    --warn-fg:   #9a6700;
    --bad-bg:    #fdeceb;
    --bad-bd:    #f0b6b2;
    --bad-fg:    #cf222e;

    --shadow-sm: 0 1px 2px rgba(20, 30, 45, .08);
    --shadow:    0 12px 30px -14px rgba(20, 30, 45, .22), 0 2px 6px -2px rgba(20, 30, 45, .12);
    --shadow-lg: 0 40px 90px -30px rgba(20, 30, 45, .35);
  }
}

:root[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg-1:      #ffffff;
  --bg-2:      #ffffff;
  --bg-3:      #eef1f7;
  --bg-inset:  #f0f3f9;
  --border:    #d7dee9;
  --border-soft: #e5eaf1;
  --text:      #131a24;
  --text-dim:  #38424f;
  --muted:     #6a7684;

  --accent:    #1a7f37;
  --accent-2:  #0969da;
  --accent-2-ink: #0a3d80;

  --good-bg:   #e7f6ec;
  --good-bd:   #a7dcb6;
  --good-fg:   #1a7f37;
  --warn-bg:   #fdf3e0;
  --warn-bd:   #ecc98a;
  --warn-fg:   #9a6700;
  --bad-bg:    #fdeceb;
  --bad-bd:    #f0b6b2;
  --bad-fg:    #cf222e;

  --shadow-sm: 0 1px 2px rgba(20, 30, 45, .08);
  --shadow:    0 12px 30px -14px rgba(20, 30, 45, .22), 0 2px 6px -2px rgba(20, 30, 45, .12);
  --shadow-lg: 0 40px 90px -30px rgba(20, 30, 45, .35);
}

/* ---------- reset & base ---------- */
* { box-sizing: border-box; }
* { scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
::selection { background: rgba(88, 166, 255, .32); color: #fff; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% -5%, rgba(88, 166, 255, .10), transparent 60%),
    radial-gradient(800px 500px at -10% 0%, rgba(63, 185, 80, .09), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-2); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-2-ink); text-decoration: none; }

code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  padding: .12em .45em;
  border-radius: 6px;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -.02em;
  font-weight: 700;
  margin: 6px 0 22px;
}
h2 {
  font-size: 15px;
  letter-spacing: .01em;
  font-weight: 700;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
h2::before {
  content: "";
  width: 4px; height: 15px;
  border-radius: 4px;
  background: var(--grad-brand);
  flex: none;
}

.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ============================================================
   side nav — fixed vertical rail on the left edge
   ============================================================ */
body:not(.login-page) { padding-left: var(--nav-w); transition: padding-left .25s ease; }

.topbar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px 14px;
  color: var(--text);
  background:
    radial-gradient(150% 40% at 0% 0%, color-mix(in srgb, var(--accent-2) 13%, transparent), transparent 70%),
    radial-gradient(130% 30% at 0% 100%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    linear-gradient(180deg,
      color-mix(in srgb, var(--bg-1) 97%, transparent),
      color-mix(in srgb, var(--bg-1) 85%, transparent));
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-right: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  box-shadow:
    inset -1px 0 0 color-mix(in srgb, #fff 4%, transparent),
    22px 0 50px -36px rgba(0, 0, 0, .7);
}
/* animated gradient hairline riding the right edge */
.topbar::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: -1px;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    color-mix(in srgb, var(--accent-2) 80%, transparent) 26%,
    color-mix(in srgb, var(--accent) 80%, transparent) 64%,
    transparent 100%);
  background-size: 100% 220%;
  animation: bar-sheen 9s linear infinite;
  opacity: .55;
  pointer-events: none;
}
@keyframes bar-sheen { to { background-position: 0 -220%; } }

/* ---------- brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  position: relative;
  padding: 4px 8px 16px;
  margin-bottom: 6px;
  text-decoration: none;
}
.brand::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--grad-brand);
  box-shadow:
    0 10px 22px -8px color-mix(in srgb, var(--accent-2) 85%, transparent),
    inset 0 0 0 1px color-mix(in srgb, #fff 16%, transparent);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.35), box-shadow .3s ease;
}
.brand-mark svg { width: 23px; height: 23px; display: block; }
.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.07);
  box-shadow:
    0 14px 28px -8px color-mix(in srgb, var(--accent-2) 95%, transparent),
    inset 0 0 0 1px color-mix(in srgb, #fff 22%, transparent);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.02em;
  white-space: nowrap;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-text span {
  -webkit-text-fill-color: var(--muted);
  color: var(--muted);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: .02em;
  margin-top: 3px;
}

/* ---------- nav ---------- */
.topbar nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex: 1;
  min-height: 0;
  padding: 6px 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
          mask-image: linear-gradient(180deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}
.topbar nav::-webkit-scrollbar { display: none; }

.nav-group { display: flex; flex-direction: column; gap: 2px; flex: none; }
.nav-group + .nav-group { margin-top: 10px; }
.nav-cap {
  margin: 0;
  padding: 4px 12px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: .8;
}

.topbar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 11px;
  font-weight: 550;
  font-size: 13px;
  white-space: nowrap;
  isolation: isolate;
  transition: color .18s ease;
}
/* row fill springs in on hover / active */
.topbar nav a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--bg-3);
  border: 1px solid transparent;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2, .9, .3, 1.35),
              background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
/* icon sits in its own rounded chip */
.topbar nav a > .ic {
  box-sizing: content-box;
  width: 17px; height: 17px;
  padding: 6px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-3) 70%, transparent);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  opacity: 1;
  transition: background .18s ease, border-color .18s ease, color .18s ease,
              transform .18s cubic-bezier(.2, .9, .3, 1.35), box-shadow .18s ease;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a:hover::before { opacity: 1; transform: scale(1); }
.topbar nav a:hover > .ic {
  background: color-mix(in srgb, var(--accent-2) 14%, var(--bg-3));
  border-color: color-mix(in srgb, var(--accent-2) 30%, var(--border));
  color: var(--text);
  transform: scale(1.05);
}
.topbar nav a:active > .ic { transform: scale(.95); }
.topbar nav a:focus-visible { outline: none; }
.topbar nav a:focus-visible::before { opacity: 1; transform: scale(1); box-shadow: var(--ring); }

.topbar nav a.active { color: var(--text); font-weight: 650; }
.topbar nav a.active::before {
  opacity: 1;
  transform: scale(1);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent-2) 20%, transparent),
    color-mix(in srgb, var(--accent-2) 5%, transparent));
  border-color: color-mix(in srgb, var(--accent-2) 30%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 8%, transparent);
}
.topbar nav a.active > .ic {
  background: var(--grad-brand);
  border-color: transparent;
  color: #04130a;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--accent-2) 80%, transparent);
}
/* accent bar hugging the active row */
.topbar nav a.active::after {
  content: "";
  position: absolute;
  left: 2px; top: 50%;
  width: 3px; height: 18px;
  transform: translateY(-50%);
  border-radius: 3px;
  background: var(--grad-brand);
  box-shadow: 0 0 10px 0 color-mix(in srgb, var(--accent-2) 60%, transparent);
}

/* ---------- user card (pinned to the bottom) ---------- */
.topbar .user {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex: none;
  margin-top: 8px;
  padding: 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}
.topbar .user .who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px;
  margin: -4px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
a.who:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
a.who.active { background: color-mix(in srgb, var(--accent-2) 14%, transparent); }
a.who:focus-visible { outline: none; box-shadow: var(--ring); }
.topbar .user .avatar {
  width: 34px; height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--grad-brand);
  color: #04130a;
  font-weight: 800;
  font-size: 14px;
  box-shadow:
    0 6px 14px -5px color-mix(in srgb, var(--accent-2) 80%, transparent),
    inset 0 0 0 1px color-mix(in srgb, #fff 18%, transparent);
}
.topbar .user .who-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar .user .who-text b {
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .user .who-text i {
  font-style: normal;
  align-self: flex-start;
  margin-top: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent-2-ink);
  background: color-mix(in srgb, var(--accent-2) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 26%, transparent);
}
.topbar .user-actions { display: flex; gap: 8px; }
.topbar .user-actions form { display: block; flex: 1; }
.topbar .user-actions .btn.sm,
.topbar .user-actions button.sm { width: 100%; }
.topbar .user-actions #themeToggle {
  flex: none;
  width: 36px;
  padding: 0;
  color: var(--text-dim);
}
.topbar .user-actions #themeToggle:hover { color: var(--text); }

/* logout — calm by default, turns to a warm "leave" on hover */
.topbar .user-actions button[type="submit"] {
  background: color-mix(in srgb, var(--bg-3) 80%, transparent);
  border-color: var(--border-soft);
  color: var(--text-dim);
  font-weight: 600;
  box-shadow: none;
  transition: color .16s ease, background .16s ease, border-color .16s ease,
              transform .12s ease, box-shadow .16s ease;
}
.topbar .user-actions button[type="submit"] .ic {
  transition: transform .16s cubic-bezier(.2, .9, .3, 1.35);
}
.topbar .user-actions button[type="submit"]:hover {
  background: var(--bad-bg);
  border-color: var(--bad-bd);
  color: var(--bad-fg);
  transform: none;
  box-shadow: 0 8px 18px -12px color-mix(in srgb, var(--bad-fg) 85%, transparent);
}
.topbar .user-actions button[type="submit"]:hover .ic { transform: translateX(2px); }
.topbar .user-actions button[type="submit"]:active { transform: translateY(1px); }
.topbar .user-actions button[type="submit"]:focus-visible { box-shadow: var(--ring); }

/* ---------- collapsed icon rail (medium widths) ---------- */
@media (max-width: 1100px) {
  :root { --nav-w: 74px; }
  .topbar { padding: 16px 10px 12px; }
  .brand { justify-content: center; padding: 0 0 14px; }
  .brand::after { left: 12px; right: 12px; }
  .brand-text { display: none; }
  .nav-cap { display: none; }
  .nav-group + .nav-group {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
  }
  .topbar nav a { justify-content: center; gap: 0; padding: 4px; }
  .topbar nav a span { display: none; }
  .topbar nav a.active::after { display: none; }
  .topbar .user { align-items: center; padding: 8px; }
  .topbar .user .who { padding: 0; margin: 0; }
  .topbar .user .who-text { display: none; }
  .topbar .user-actions { flex-direction: column; width: 100%; }
  .topbar .user-actions form { flex: none; width: 100%; }
  .topbar .user-actions #themeToggle { width: 100%; }
  .topbar .user-actions button.sm[type="submit"] { font-size: 0; gap: 0; padding: 8px 0; }
}

/* ---------- back to a horizontal bar on small screens ---------- */
@media (max-width: 780px) {
  :root { --nav-w: 0px; }
  .topbar {
    position: sticky;
    inset: 0 0 auto 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: 58px;
    border-right: none;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, #fff 5%, transparent),
      0 12px 30px -22px rgba(0, 0, 0, .55);
  }
  .topbar::after {
    top: auto; left: 0; right: 0; bottom: -1px;
    width: auto; height: 1px;
    animation: none;
  }
  .brand { padding: 0 12px 0 4px; margin: 0; }
  .brand::after {
    left: auto; right: 0; bottom: auto; top: 50%;
    transform: translateY(-50%);
    width: 1px; height: 24px;
    background: linear-gradient(var(--border), transparent);
  }
  .brand-text { display: flex; }
  .brand-text span { display: none; }
  .topbar nav {
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-height: 0;
    padding: 4px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  }
  .nav-group { display: contents; }
  .nav-cap { display: none; }
  .topbar nav a { justify-content: center; gap: 0; padding: 4px; }
  .topbar nav a span { display: none; }
  .topbar nav a.active::after { display: none; }
  .topbar .user {
    flex-direction: row;
    align-items: center;
    margin: 0;
    padding: 0 0 0 10px;
    border: none;
    border-left: 1px solid var(--border-soft);
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .topbar .user .who { padding: 0; margin: 0; }
  .topbar .user .who-text { display: none; }
  .topbar .user-actions { flex-direction: row; }
  .topbar .user-actions form { flex: none; }
  .topbar .user-actions .btn.sm,
  .topbar .user-actions button.sm { width: auto; }
  .topbar .user-actions button.sm[type="submit"] { font-size: 0; gap: 0; padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .topbar::after { animation: none; }
  body:not(.login-page) { transition: none; }
}

/* ---------- layout ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 22px 80px;
  animation: page-in .4s ease both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 22px 40px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
footer strong { color: var(--text-dim); }

/* ---------- plugin status strip ---------- */
.plugin-status {
  margin: 0 0 20px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
}
.plugin-status::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
}
.plugin-status.up   { border-color: var(--good-bd); background: var(--good-bg); color: var(--good-fg); }
.plugin-status.up::before   { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); animation: pulse 2s ease-in-out infinite; }
.plugin-status.down { border-color: var(--bad-bd); background: var(--bad-bg); color: var(--bad-fg); }
.plugin-status.down::before  { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
  50%      { box-shadow: 0 0 0 7px color-mix(in srgb, currentColor 0%, transparent); }
}

/* ---------- flash ---------- */
.flash {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: flash-in .35s cubic-bezier(.2, .8, .25, 1) both;
}
.flash::before { content: "i"; font-weight: 800; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; flex: none; background: currentColor; color: var(--bg-1); }
.flash.ok  { border-color: var(--good-bd); background: var(--good-bg); color: var(--good-fg); }
.flash.ok::before  { content: "\2713"; }
.flash.err { border-color: var(--bad-bd); background: var(--bad-bg); color: var(--bad-fg); }
.flash.err::before { content: "!"; }
.flash code { background: color-mix(in srgb, currentColor 12%, transparent); border-color: transparent; color: inherit; }
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

/* ---------- stat cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}
.card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-align: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-brand);
  opacity: .8;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
  box-shadow: var(--shadow);
}
.card .num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.card .lbl {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: 8px;
}

/* ---------- panels ---------- */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 0 0 20px;
  box-shadow: var(--shadow-sm);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 880px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel > table, .panel > p + table { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; }
thead th {
  position: sticky;
  top: 0;
  background: var(--bg-3);
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
tbody tr { transition: background .12s ease; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-2) 7%, transparent); }
td code { font-size: 12px; }

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on  { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-bd); }
.badge.off { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }

.chip {
  display: inline-flex;
  align-items: center;
  margin: 3px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

/* ---------- forms ---------- */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 12px;
}

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; }
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent-2) 35%, var(--border)); }

/* ---------- custom checkbox / radio ---------- */
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: inline-grid;
  place-content: center;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg-inset);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before,
input[type="radio"]::before {
  content: "";
  transition: transform .12s cubic-bezier(.2, .9, .3, 1.4);
  transform: scale(0);
}
input[type="checkbox"]::before {
  width: 11px; height: 11px;
  clip-path: polygon(14% 48%, 0 62%, 40% 100%, 100% 22%, 86% 8%, 38% 70%);
  background: #04130a;
}
input[type="radio"]::before {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #04130a;
}
input[type="checkbox"]:hover, input[type="radio"]:hover {
  border-color: color-mix(in srgb, var(--accent-2) 55%, var(--border));
}
input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--grad-brand);
  border-color: transparent;
}
input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: var(--ring);
  background: var(--bg-1);
}

button, .btn {
  --btn-bg1: color-mix(in srgb, var(--bg-3) 100%, #fff 4%);
  --btn-bg2: var(--bg-3);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--btn-bg1), var(--btn-bg2));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font-weight: 650;
  font-size: 13px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  width: auto;
  margin-top: 0;
  text-decoration: none;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}
button:hover, .btn:hover {
  border-color: color-mix(in srgb, var(--accent-2) 60%, var(--border));
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
}
button:active, .btn:active { transform: translateY(0) scale(.985); box-shadow: var(--shadow-sm); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled, .btn:disabled, button[disabled], .btn.disabled {
  opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm);
}

.btn .ic, button .ic { width: 16px; height: 16px; }

.btn.primary, button.primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: #04130a;
  font-weight: 750;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent-2) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.primary:hover, button.primary:hover {
  filter: brightness(1.07);
  border-color: transparent;
  box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent-2) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.btn.danger, button.danger {
  background: var(--bad-bg);
  border-color: var(--bad-bd);
  color: var(--bad-fg);
}
.btn.danger:hover, button.danger:hover { border-color: var(--bad-fg); filter: brightness(1.06); }

.btn.ghost, button.ghost { background: transparent; border-color: var(--border); box-shadow: none; }
.btn.ghost:hover, button.ghost:hover { background: var(--bg-3); box-shadow: var(--shadow-sm); }

.btn.sm, button.sm { padding: 6px 11px; font-size: 12px; border-radius: 7px; gap: 6px; }
.btn.sm .ic, button.sm .ic { width: 14px; height: 14px; }
.btn.block, button.block { width: 100%; }

/* ---------- icons ---------- */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- inline / toolbar forms ---------- */
.form-inline { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-inline label { margin-bottom: 0; flex: 0 0 auto; }
.form-inline .grow { flex: 1 1 220px; }
.form-inline input, .form-inline select { width: auto; min-width: 160px; margin-top: 6px; }

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.toolbar input, .toolbar select { width: auto; min-width: 240px; margin-top: 0; }
.toolbar form { display: contents; }

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.switch-row:last-child { border-bottom: 0; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.row-actions form { display: inline; }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin: 20px 0 -1px;
  position: relative;
  z-index: 1;
}
.tabs a {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  background: var(--bg-1);
  transition: color .15s ease, background .15s ease;
}
.tabs a:hover { color: var(--text-dim); background: var(--bg-2); }
.tabs a.active {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 -2px 0 0 var(--accent-2) inset;
}
.tabs + .panel, .tabs + .tablewrap { border-top-left-radius: 0; }

/* ---------- pager ---------- */
.pager { display: flex; gap: 5px; margin-top: 20px; flex-wrap: wrap; }
.pager a {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pager a:hover { border-color: var(--accent-2); color: var(--text); }
.pager a.active { background: var(--grad-brand); border-color: transparent; color: #04130a; }

/* ---------- pick list ---------- */
.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-list li {
  padding: 11px 2px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.pick-list li:last-child { border-bottom: 0; }

/* ---------- login / register ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(700px 500px at 50% -10%, rgba(88, 166, 255, .18), transparent 65%),
    radial-gradient(600px 500px at 15% 110%, rgba(63, 185, 80, .16), transparent 60%),
    var(--bg);
}
.login-box {
  width: 380px;
  max-width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 32px;
  box-shadow: var(--shadow-lg);
  animation: page-in .45s ease both;
}
.brand-big {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 24px;
  text-align: center;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-big span {
  display: block;
  -webkit-text-fill-color: var(--muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
}
.login-box label { margin-bottom: 16px; }
.login-box button { width: 100%; margin-top: 8px; padding: 11px; }
.login-box .btn { display: flex; width: 100%; margin-top: 8px; padding: 11px; }

/* ---------- verify code ---------- */
.verify-code {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 4px;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  margin: 12px 0;
  background: var(--bg-inset);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--accent-2-ink);
}

/* ---------- live updates ---------- */
.live-pill {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--bg-1) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text-dim);
  user-select: none;
  transition: border-color .2s ease, color .2s ease;
}
.live-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.live-pill.live       { color: var(--good-fg); border-color: color-mix(in srgb, var(--good-bd) 70%, var(--border)); }
.live-pill.live .dot  { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); animation: pulse 2s ease-in-out infinite; }
.live-pill.warn       { color: var(--warn-fg); border-color: color-mix(in srgb, var(--warn-bd) 70%, var(--border)); }
.live-pill.connecting { color: var(--muted); }
.live-pill.connecting .dot { animation: blink 1s steps(2, start) infinite; }
.live-pill.flash { animation: pill-flash .5s ease; }
@keyframes blink { 50% { opacity: .25; } }
@keyframes pill-flash {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); box-shadow: 0 0 0 6px color-mix(in srgb, var(--good-fg) 18%, transparent), var(--shadow); }
  100% { transform: scale(1); }
}

/* value changed on a live tick */
.live-bump { animation: live-bump .6s cubic-bezier(.2, .8, .25, 1); }
.live-bump .num { color: var(--accent-2); }
@keyframes live-bump {
  0%   { transform: none; }
  30%  { transform: translateY(-3px) scale(1.04); }
  100% { transform: none; }
}

@media (max-width: 620px) {
  .live-pill { right: 10px; bottom: 10px; padding: 6px 11px; }
}

/* ---------- MOTD editor ---------- */
textarea { resize: vertical; min-height: 56px; line-height: 1.5; }
.motd-input { font-family: var(--mono); font-size: 13px; }
.motd-preview {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #0c0c10;
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
  font-family: "Minecraftia", var(--mono);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: calc(2 * 1.6em + 24px);
  color: #aaa;
}
.motd-preview div { min-height: 1.6em; }

/* ---------- permission chips (clickable to remove) ---------- */
button.perm-chip {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  margin: 2px;
  border-radius: 999px;
  background: var(--good-bg);
  color: var(--good-fg);
  border: 1px solid var(--good-bd);
  box-shadow: none;
  transition: filter .12s ease, transform .12s ease;
}
button.perm-chip:hover { filter: brightness(1.12); transform: none; border-color: var(--good-fg); box-shadow: none; }
button.perm-chip.neg { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
button.perm-chip.neg:hover { border-color: var(--bad-fg); }

/* ---------- theme toggle ---------- */
.theme-toggle {
  font-size: 15px;
  line-height: 1;
  padding: 6px 10px;
  min-width: 34px;
}

/* ---------- "angemeldet bleiben" ---------- */
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.check-row input { margin: 0; }

/* ---------- cookie notice ---------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  margin: 0 auto;
  max-width: 640px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-1) 94%, transparent);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateY(140%);
  opacity: 0;
  transition: transform .3s cubic-bezier(.2, .8, .25, 1), opacity .3s ease;
}
.cookie-banner.in { transform: none; opacity: 1; }
.cookie-banner.closing { transform: translateY(140%); opacity: 0; }
.cookie-banner p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.cookie-banner .btn { flex: none; }
@media (max-width: 560px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ---------- misc ---------- */
p { margin: 0 0 12px; }
main > p:last-child, .panel > p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 620px) {
  main { padding: 22px 15px 60px; }
  h1 { font-size: 22px; }
  .topbar { gap: 8px; padding: 8px 10px; }
}
