:root {
  --bg: #0c0e10;
  --surface: #191c1d;
  --surface-raised: #242625;
  --surface-soft: #302d28;
  --border: #47443c;
  --border-bright: #796b55;
  --text: #f0ece2;
  --muted: #aaa79f;
  --accent: #c7a16c;
  --accent-light: #efd0a0;
  --accent-text: #211c17;
  --aqua: #83cad7;
  --good: #a2ca9f;
  --warn: #dfa86a;
  --bad: #dc796c;
  --discord: #8d9bff;
  --mono: ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, monospace;
  --display: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; min-height: 100%; }
body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(ellipse 53% 52% at 4% 7%, rgb(67 105 113 / .21), transparent 73%),
    radial-gradient(ellipse 45% 55% at 94% 95%, rgb(143 55 37 / .16), transparent 70%),
    linear-gradient(145deg, #151718 0%, #0c0e10 52%, #171514 100%);
  animation: atmosphere 22s ease-in-out infinite alternate;
}
body::after {
  opacity: .24;
  background-image: repeating-linear-gradient(102deg, transparent 0 39px, rgb(199 161 108 / .05) 40px 41px, transparent 42px 117px), repeating-linear-gradient(0deg, transparent 0 86px, rgb(199 161 108 / .04) 87px 88px);
  mask-image: linear-gradient(to bottom, transparent 3%, #000 42%, transparent 100%);
}
@keyframes atmosphere { to { transform: scale(1.08) translate(-1%, 1%); filter: hue-rotate(8deg); } }

a { color: var(--accent-light); text-underline-offset: 3px; }
code, .mono { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { margin-left: auto; }

/* Navigation und Seitenrahmen */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
  min-height: 78px;
  padding: 14px clamp(20px, 4vw, 72px);
  border-bottom: 1px solid rgb(199 161 108 / .22);
  background: rgb(16 17 18 / .86);
  box-shadow: 0 12px 36px rgb(0 0 0 / .12);
  backdrop-filter: blur(24px) saturate(140%);
}
.brand { display: inline-flex; align-items: center; gap: 13px; white-space: nowrap; color: var(--text); font-family: var(--display); font-size: 1.12rem; font-weight: 600; letter-spacing: -.015em; text-decoration: none; }
.brand img { width: 38px; height: 38px; padding: 5px; border: 1px solid rgb(199 161 108 / .4); border-radius: 9px; background: linear-gradient(150deg, #38332d, #171819); box-shadow: 0 0 23px rgb(162 66 39 / .17); }
.brand strong { color: var(--accent-light); font-weight: 700; }
.brand-lockup { display: grid; gap: 0; line-height: 1.1; }
.brand-lockup small { margin-top: 4px; color: var(--muted); font: 700 .56rem var(--mono); letter-spacing: .11em; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; flex: 1; }
.nav a { position: relative; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: .88rem; font-weight: 600; text-decoration: none; transition: color .2s, background .2s, border-color .2s; }
.nav a:hover, .nav a.active { color: var(--text); background: rgb(199 161 108 / .09); }
.nav a.active { border-color: rgb(199 161 108 / .3); }
.nav a.active::after { content: ""; position: absolute; right: 16px; bottom: 4px; left: 16px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.language { min-width: 112px; }
.whoami { color: var(--muted); font-size: .86rem; }
.main { position: relative; z-index: 1; width: min(100%, 1460px); margin: 0 auto; padding: 46px clamp(20px, 4vw, 72px) 100px; }
body:not(.auth-mode) .main::before { content: ""; position: absolute; z-index: -1; top: 0; right: 0; left: 0; height: 340px; pointer-events: none; opacity: .22; background: url('/visuals/barrier-storm.webp') center 40% / cover no-repeat; mask-image: linear-gradient(#000, transparent 95%); }
.page { animation: page-enter .52s cubic-bezier(.2,.7,.2,1) both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(13px); } to { opacity: 1; transform: translateY(0); } }
.page h1 { margin: 0 0 24px; font-family: var(--display); font-size: clamp(2rem, 3vw, 3rem); font-weight: 700; line-height: 1.08; letter-spacing: -.025em; }
h2 { margin: 0; font-family: var(--display); font-size: 1.22rem; line-height: 1.25; }
h3 { margin: 0 0 16px; font-family: var(--display); font-size: 1.03rem; font-weight: 650; letter-spacing: .01em; }
.eyebrow { display: inline-block; color: var(--accent-light); font: 700 .72rem/1.4 var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.signal-dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 0 4px rgb(131 202 215 / .10), 0 0 16px rgb(131 202 215 / .54); animation: signal 2.7s ease-in-out infinite; }
@keyframes signal { 50% { opacity: .65; box-shadow: 0 0 0 8px rgb(131 202 215 / .04), 0 0 24px rgb(131 202 215 / .7); } }

/* Anmeldung und Ersteinrichtung */
.auth-mode .main { width: min(100%, 1540px); padding-top: clamp(26px, 5vh, 80px); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(470px, 1.02fr); gap: clamp(24px, 3vw, 54px); align-items: stretch; min-height: min(760px, calc(100vh - 180px)); }
.auth-showcase, .auth-card { position: relative; overflow: hidden; border: 1px solid rgb(199 161 108 / .27); border-radius: 14px; box-shadow: 0 24px 90px rgb(0 0 0 / .35), inset 0 1px rgb(255 235 194 / .05); }
.auth-showcase {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 600px; padding: clamp(30px, 3.5vw, 60px);
  background: linear-gradient(180deg, rgb(7 10 12 / .57), rgb(10 12 13 / .64) 44%, rgb(12 12 12 / .94)), url('/visuals/barrier-storm.webp') center top / cover no-repeat, #111718;
}
.auth-showcase::before { content: ""; position: absolute; inset: 0; opacity: .7; background: radial-gradient(circle at 55% 46%, rgb(154 46 31 / .20), transparent 33%), radial-gradient(circle at 50% 13%, rgb(111 188 206 / .14), transparent 40%); animation: ember-glow 5s ease-in-out infinite alternate; }
.auth-showcase::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 110px rgb(0 0 0 / .48), inset 0 0 0 7px rgb(199 161 108 / .04); pointer-events: none; }
@keyframes ember-glow { to { opacity: 1; filter: hue-rotate(-8deg); } }
.auth-showcase-copy, .auth-showcase-footer { position: relative; z-index: 1; }
.auth-showcase-copy h2 { max-width: 13ch; margin: 22px 0 18px; font-size: clamp(2.8rem, 4.2vw, 5.1rem); font-weight: 700; line-height: 1.04; letter-spacing: -.038em; text-wrap: balance; text-shadow: 0 3px 22px rgb(0 0 0 / .6); }
.auth-showcase-copy p { max-width: 35ch; color: #dedbd2; font-size: 1.02rem; line-height: 1.7; text-shadow: 0 2px 12px rgb(0 0 0 / .7); }
.auth-showcase-footer { display: flex; align-items: center; gap: 12px; padding-top: 26px; border-top: 1px solid rgb(199 161 108 / .28); color: #e6dfd1; font: 600 .71rem var(--mono); letter-spacing: .1em; }
.auth-showcase-footer > span:last-child { margin-left: auto; color: #baaa91; }
.auth-card { padding: clamp(26px, 3.5vw, 60px); background: radial-gradient(circle at 100% 0, rgb(119 64 39 / .10), transparent 35%), linear-gradient(155deg, rgb(37 35 31 / .97), rgb(22 23 22 / .99)); }
.auth-card::before { content: ""; position: absolute; top: 0; right: 0; width: 220px; height: 220px; border-radius: 50%; background: rgb(199 90 49 / .09); filter: blur(70px); pointer-events: none; }
.auth-card-head { position: relative; margin-bottom: 20px; }
.auth-card-head h1 { margin: 15px 0 0; font-size: clamp(2.15rem, 3vw, 3.4rem); }
.auth-card > p { margin: 0 0 28px; color: var(--muted); line-height: 1.65; }
.auth-card .form, .auth-card .discord-login { max-width: none; }
.auth-card .form { gap: 18px; }
.auth-card .form:has(input[name="token"]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auth-card .form:has(input[name="token"]) > :first-child,
.auth-card .form:has(input[name="token"]) > :nth-child(4),
.auth-card .form:has(input[name="token"]) > .button { grid-column: 1 / -1; }
.auth-card .button.primary { width: 100%; margin-top: 8px; min-height: 52px; }

/* Formulare und Aktionen */
input, select, textarea {
  min-width: 0; padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; outline: none;
  background: rgb(11 13 13 / .78); color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-bright); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #151716; box-shadow: 0 0 0 4px rgb(199 161 108 / .12); }
input::placeholder { color: #88847b; }
input[type=checkbox] { width: 17px; height: 17px; padding: 0; accent-color: var(--accent); }
.code { max-width: 12ch; font: 600 1.4rem var(--mono); letter-spacing: .25em; }
.language { padding: 8px 12px; border-radius: 10px; font-size: .84rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 7px; background: rgb(199 161 108 / .08); color: var(--text); font: inherit; font-size: .88rem; font-weight: 650; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; transition: transform .2s, border-color .2s, background .2s, box-shadow .2s; }
.button:hover { transform: translateY(-2px); border-color: var(--accent); background: rgb(199 161 108 / .16); box-shadow: 0 9px 25px rgb(0 0 0 / .16); }
.button:active { transform: translateY(0); }
.button:focus-visible, .nav a:focus-visible, .tabs a:focus-visible, .brand:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
.button:disabled { opacity: .5; cursor: wait; transform: none; box-shadow: none; }
.button.primary { border-color: #dec192; background: linear-gradient(115deg, #ead0a0, #c9a168 65%, #a98150); color: #211c17; box-shadow: inset 0 1px rgb(255 255 255 / .3), 0 8px 28px rgb(172 106 47 / .16); font-weight: 760; }
.button.primary:hover { background: linear-gradient(115deg, #f4ddb2, #d7ad73 65%, #ba9057); box-shadow: 0 10px 35px rgb(172 106 47 / .25); }
.button.warn { border-color: rgb(227 189 114 / .43); color: var(--warn); }
.button.danger { border-color: rgb(237 139 135 / .42); color: var(--bad); }
.button.danger:hover { background: rgb(220 121 108 / .12); border-color: var(--bad); }
.button.ghost { border-color: transparent; background: transparent; }
.button.small { padding: 5px 10px; font-size: .78rem; }
.button.discord { border-color: #818cff; background: linear-gradient(110deg, #6876ed, #5865d7); color: #fff; }
.form { display: grid; gap: 14px; max-width: 510px; }
.form.compact { max-width: none; }
.field { display: grid; min-width: 0; gap: 7px; }
.field > span { color: #e5dfd4; font-size: .84rem; font-weight: 650; }
.field small { color: var(--muted); font-size: .76rem; line-height: 1.4; }
.check { display: inline-flex; align-items: center; gap: 7px; }
.inline { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.inline input { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.notice { padding: 14px 18px; border: 1px solid rgb(199 161 108 / .28); border-left: 3px solid var(--accent); border-radius: 7px; background: rgb(199 161 108 / .08); color: #ead9bd; }
.notice.strong { margin-bottom: 20px; border-left-color: var(--warn); }
.secret { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: #111313; font-size: 1rem; word-break: break-all; user-select: all; }
.steps { display: grid; gap: 12px; padding-left: 24px; }
.enroll-qr { display: grid; grid-template-columns: 215px minmax(0, 1fr); align-items: start; gap: 22px; margin-bottom: 24px; }
.qr-frame { width: 215px; padding: 8px; border: 1px solid var(--accent); border-radius: 8px; background: #f4eee2; box-shadow: 0 8px 28px rgb(0 0 0 / .26), 0 0 28px rgb(131 202 215 / .09); }
.qr-frame img { display: block; width: 100%; height: auto; image-rendering: crisp-edges; }
.enroll-guide p { margin: 9px 0 12px; color: var(--muted); }
.enroll-guide a { display: inline-block; margin: 0 0 12px; }
.manual-key { margin: 8px 0 14px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 6px; background: rgb(199 161 108 / .05); }
.manual-key summary { color: var(--accent-light); font-weight: 650; }
.manual-key .secret { max-width: 100%; }
.discord-login { display: grid; gap: 8px; max-width: 510px; margin-bottom: 22px; }
.discord-login p { margin: 0; }
.divider { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Übersicht und Arbeitsflächen */
.dashboard-lead { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: -8px 0 28px; }
.dashboard-lead p { margin: 7px 0 0; color: var(--muted); }
.live-indicator { display: inline-flex; align-items: center; gap: 11px; flex: none; padding: 9px 14px; border: 1px solid rgb(131 202 215 / .25); border-radius: 999px; background: rgb(131 202 215 / .07); color: #c5e8ed; font-size: .8rem; font-weight: 650; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); margin-bottom: 18px; }
.card, .panel { position: relative; border: 1px solid var(--border); border-radius: 10px; background: linear-gradient(155deg, rgb(36 37 34 / .97), rgb(21 23 23 / .98)); box-shadow: 0 16px 42px rgb(0 0 0 / .19), inset 0 1px rgb(255 235 194 / .04); }
.card { display: grid; align-content: start; gap: 22px; min-height: 270px; padding: 26px; overflow: hidden; transition: transform .25s, border-color .25s, box-shadow .25s; }
.card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, #9c4a35, var(--accent), transparent 72%); opacity: .85; }
.card::after { content: ""; position: absolute; top: -75px; right: -75px; width: 180px; height: 180px; border-radius: 50%; background: rgb(162 60 35 / .08); filter: blur(12px); }
.card:hover { transform: translateY(-5px); border-color: rgb(199 161 108 / .57); box-shadow: 0 23px 55px rgb(0 0 0 / .3), 0 0 34px rgb(162 60 35 / .07); }
.card.disabled { opacity: .55; }
.card.disabled:hover { transform: none; border-color: var(--border); box-shadow: 0 16px 42px rgb(0 0 0 / .14); }
.card > .button { justify-self: start; align-self: end; margin-top: auto; }
.card-head { display: flex; align-items: start; flex-wrap: wrap; gap: 12px; }
.card-head h2 { max-width: 22ch; font-size: 1.2rem; line-height: 1.3; }
.flag { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 27px; padding: 0 7px; border: 1px solid rgb(199 161 108 / .42); border-radius: 5px; background: rgb(199 161 108 / .11); color: var(--accent-light); font: 700 .72rem var(--mono); letter-spacing: .06em; }
.panel { margin-bottom: 18px; padding: clamp(19px, 2.5vw, 28px); }
.grid .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.panel-head h3 { margin: 0; }
.status-list, .facts { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 10px 18px; margin: 0; }
.status-list dt, .facts dt { color: var(--muted); }
.status-list dd, .facts dd { margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: .75rem; font-weight: 750; letter-spacing: .02em; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.good { color: var(--good); background: rgb(162 202 159 / .09); }
.badge.warn { color: var(--warn); background: rgb(223 168 106 / .08); }
.badge.bad { color: var(--bad); background: rgb(220 121 108 / .08); }
.badge.muted { color: var(--muted); background: rgb(156 174 187 / .08); }
.badge.discord { color: var(--discord); background: rgb(141 155 255 / .1); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 22px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 14px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); font-size: .87rem; font-weight: 650; text-decoration: none; white-space: nowrap; transition: color .2s, background .2s, border-color .2s; }
.tabs a:hover, .tabs a.active { color: var(--text); background: rgb(199 161 108 / .09); }
.tabs a.active { border-color: rgb(199 161 108 / .28); }

/* Logs, Konsole und Tabellen */
.log { height: 460px; overflow: auto; margin: 0; padding: 16px; border: 1px solid #48443b; border-radius: 7px; background: #0e1112; box-shadow: inset 0 2px 16px rgb(0 0 0 / .25); color: #e0ddd3; font: .8rem/1.65 var(--mono); white-space: pre-wrap; word-break: break-word; }
.log.small { height: auto; max-height: 260px; }
.log.console { height: 320px; margin: 12px 0; }
.log time { color: #a49f93; }
.line.p0, .line.p1, .line.p2, .line.p3 { color: var(--bad); }
.line.p4 { color: var(--warn); }
.log-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.log-filter { width: 220px; }
.entry { padding: 7px 0; border-bottom: 1px dashed #48443b; }
.entry pre { margin: 4px 0 0; white-space: pre-wrap; }
.entry .cmd { color: var(--accent-light); }
.stderr, .entry.failed .cmd { color: var(--bad); }
.table-wrap { overflow-x: auto; }
.table, .matrix { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td, .matrix th, .matrix td { padding: 12px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th, .matrix th { color: #d3c5ad; font-size: .76rem; font-weight: 750; letter-spacing: .04em; }
.table tbody tr:hover, .matrix tbody tr:hover { background: rgb(199 161 108 / .05); }
.table tr.failed td { color: var(--bad); }
.matrix { margin: 15px 0; }
.matrix td, .matrix thead th { text-align: center; }
.matrix tbody th { font-weight: 500; }
.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
details.user > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; cursor: pointer; }
details.user[open] > summary { margin-bottom: 14px; }
details > summary { cursor: pointer; }

/* Rückmeldungen */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: grid; gap: 10px; max-width: min(430px, calc(100vw - 40px)); }
.toast { padding: 13px 17px; border: 1px solid var(--border-bright); border-left: 3px solid var(--accent); border-radius: 7px; background: #282725; box-shadow: 0 15px 40px rgb(0 0 0 / .36); animation: toast-enter .3s ease-out both; }
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--bad); }
@keyframes toast-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1500px) {
  .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 1020px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-showcase { min-height: 340px; }
  .auth-showcase-copy h2 { max-width: none; font-size: clamp(2.3rem, 5vw, 3.5rem); }
  .auth-showcase-footer { margin-top: 54px; }
}
@media (max-width: 1250px) {
  .enroll-qr { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { gap: 12px; min-height: 66px; padding: 10px 18px; }
  .brand { font-size: .95rem; }
  .brand img { width: 33px; height: 33px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
  .topbar-right { margin-left: auto; }
  .whoami { display: none; }
  .main { padding: 28px 18px 70px; }
  .auth-mode .main { padding-top: 18px; }
  .auth-shell { gap: 14px; }
  .auth-showcase { min-height: 250px; padding: 25px; border-radius: 18px; }
  .auth-showcase-copy h2 { margin: 11px 0; max-width: 12ch; font-size: clamp(2rem, 8vw, 3rem); }
  .auth-showcase-copy p { max-width: 26ch; margin: 0; font-size: .87rem; }
  .auth-showcase-footer { margin-top: 28px; font-size: .59rem; }
  .auth-card { padding: 25px 20px; border-radius: 18px; }
  .auth-card .form:has(input[name="token"]) { grid-template-columns: 1fr; }
  .auth-card .form:has(input[name="token"]) > * { grid-column: auto !important; }
  .qr-frame { width: min(100%, 215px); }
  .dashboard-lead { align-items: start; flex-direction: column; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .log { height: 340px; }
  .log-filter { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
