:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface-1: #18181b;
  --surface-2: #202024;
  --surface-3: #2a2a2f;
  --border: #2e2e33;
  --grid: #26262b;
  --text-primary: #f2f2f3;
  --text-secondary: #b3b3ba;
  --text-muted: #85858d;
  --accent: #0074e4;
  --accent-hover: #1a86f0;
  --series-1: #3987e5;
  --ok: #30a46c;
  --warn: #f5a524;
  --danger: #e5484d;
  --radius: 12px;
  --sidebar: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: #5aa9ff; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-muted); }
.hidden { display: none !important; }

/* ─── Buttons & Formulare ───────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--text-primary); font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s;
}
.btn:hover { background: #34343a; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: rgba(229, 72, 77, .14); color: #ff8b8e; border-color: rgba(229, 72, 77, .3); }
.btn.danger:hover { background: rgba(229, 72, 77, .24); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.discord { background: #5865f2; color: #fff; }
.btn.discord:hover { background: #6b77f5; }
.btn svg { width: 18px; height: 18px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #111114; color: var(--text-primary);
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ─── Login ─────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2a44 0%, var(--bg) 55%);
}
.auth-card { width: 100%; max-width: 400px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 30px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.auth-card h1 { font-size: 22px; margin: 4px 0 4px; }
.auth-card .sub { color: var(--text-muted); margin: 0 0 22px; }
.auth-card .btn { width: 100%; height: 42px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.link-btn { background: none; border: 0; color: #5aa9ff; cursor: pointer; padding: 0; font-size: 13px; }
.form-error { background: rgba(229, 72, 77, .12); color: #ff8b8e; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.form-ok { background: rgba(48, 164, 108, .12); color: #6fdba5; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

/* ─── Layout ────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.shell > div { min-width: 0; }
.sidebar { background: var(--surface-1); border-right: 1px solid var(--border); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { padding: 4px 10px 20px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text-secondary); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--surface-2); color: var(--text-primary); }
.nav a.active { background: var(--surface-3); color: var(--text-primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.me .who { flex: 1; min-width: 0; }
.me .who b, .me .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--text-muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; flex: none; object-fit: cover; }
.main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-muted); }
.back { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--text-primary); }
.mobile-bar { display: none; }

/* ─── Karten & Kacheln ──────────────────────────────── */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.stat .label { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.stat .hint { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.two-col { grid-template-columns: 2fr 1fr; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: rgba(245, 165, 36, .1); border: 1px solid rgba(245, 165, 36, .25); color: #f7c36b; margin-bottom: 10px; font-size: 13px; }
.notice b { color: #ffd58f; }
.notice .ico { font-weight: 800; }
.notice.info { background: rgba(57, 135, 229, .08); border-color: rgba(57, 135, 229, .25); color: #8bbcf5; }

/* ─── Chart ─────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap .bar { fill: var(--series-1); }
.chart-wrap .hit { fill: transparent; cursor: default; }
.chart-wrap .hit:hover + .bar, .chart-wrap .bar.on { fill: #5a9dee; }
.chart-wrap .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-wrap .axis-text { fill: var(--text-muted); font-size: 11px; }
.chart-wrap .value-text { fill: var(--text-secondary); font-size: 11px; font-weight: 600; }
.tooltip { position: absolute; pointer-events: none; background: #0b0b0d; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.tooltip b { display: block; font-size: 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.chart-head h2 { margin: 0; }

/* ─── Listen & Tabellen ─────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; background: var(--surface-1); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--text-muted); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell small { display: block; color: var(--text-muted); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { min-width: 0; }
.list-row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--text-muted); text-align: center; padding: 36px 16px; }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-secondary); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: rgba(48, 164, 108, .14); color: #6fdba5; }
.badge.warn { background: rgba(245, 165, 36, .14); color: #f7c36b; }
.badge.danger { background: rgba(229, 72, 77, .14); color: #ff8b8e; }
.badge.info { background: rgba(57, 135, 229, .16); color: #8bbcf5; }
.badge.discord { background: rgba(88, 101, 242, .18); color: #a5adff; }

/* ─── Apps ──────────────────────────────────────────── */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.app-card { display: flex; flex-direction: column; gap: 14px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.app-card:hover { border-color: #3d3d44; transform: translateY(-1px); }
.app-card .top { display: flex; gap: 14px; align-items: center; }
.app-card .meta { min-width: 0; }
.app-card .meta b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card .meta small { color: var(--text-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card .foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.app-card .foot .dl { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.app-icon { width: 56px; height: 56px; border-radius: 13px; object-fit: cover; flex: none; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--text-secondary); }
.app-icon.lg { width: 96px; height: 96px; border-radius: 22px; font-size: 36px; }

.detail { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.media-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.banner-box { aspect-ratio: 16 / 7; border-radius: 10px; background: var(--surface-2) center / cover no-repeat; border: 1px dashed var(--border); display: grid; place-items: center; color: var(--text-muted); margin-bottom: 10px; }
.shots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.shot { position: relative; flex: none; }
.shot img { height: 180px; border-radius: 10px; display: block; border: 1px solid var(--border); }
.shot button { position: absolute; top: 6px; right: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-all; }

/* ─── Upload ────────────────────────────────────────── */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px 16px; text-align: center; color: var(--text-secondary); cursor: pointer; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(0, 116, 228, .06); }
.dropzone b { color: var(--text-primary); }
.progress { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.drop-overlay { position: fixed; inset: 0; background: rgba(0, 20, 50, .7); display: grid; place-items: center; z-index: 60; font-size: 22px; font-weight: 700; border: 3px dashed var(--accent); pointer-events: none; }

/* ─── Modal & Toast ─────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.modal p { color: var(--text-secondary); }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast { background: #1f1f24; border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 11px 14px; border-radius: 10px; max-width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: fade .15s; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ─── Responsiv ─────────────────────────────────────── */
@media (max-width: 960px) {
  .two-col, .detail { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .shell.menu-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .main { padding: 16px 16px 48px; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); position: sticky; top: 0; z-index: 30; }
  .page-head h1 { font-size: 22px; }
}

/* ─── Einstellungen ─────────────────────────────────── */
.setting-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
