/*
 * DarkTPGHub Dashboard – shadcn/ui-Design (Preset b7kBsBkh7b)
 * Stil: Nova · Basis: Zinc · Theme: Green · Diagramme: Zinc
 * Schrift: Geist Mono (Text), Instrument Sans (Überschriften)
 * Radius: Medium · Icons: Remix Icon · Menüs: invertiert, transluzent
 */

@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.627 0.194 149.214);
  --primary-foreground: oklch(0.982 0.018 155.826);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --warning: oklch(0.666 0.179 58.318);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --chart-1: oklch(0.871 0.006 286.286);
  --chart-2: oklch(0.552 0.016 285.938);
  --chart-3: oklch(0.442 0.017 285.786);
  --chart-4: oklch(0.37 0.013 285.805);
  --chart-5: oklch(0.274 0.006 286.033);
  --chart-line: var(--chart-3);
  --chart-fill: var(--chart-1);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.141 0.005 285.823);
  --sidebar-primary: var(--primary);
  --sidebar-primary-foreground: var(--primary-foreground);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
  --sidebar-border: oklch(0.92 0.004 286.32);
  /* Menüs: invertiert + transluzent */
  --menu: oklch(0.21 0.006 285.885 / 0.88);
  --menu-foreground: oklch(0.985 0 0);
  --menu-muted: oklch(0.705 0.015 286.067);
  --menu-accent: oklch(1 0 0 / 0.08);
  --menu-border: oklch(1 0 0 / 0.1);
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-heading: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}

.dark {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.723 0.219 149.579);
  --primary-foreground: oklch(0.266 0.065 152.934);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --warning: oklch(0.769 0.188 70.08);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --chart-line: var(--chart-1);
  --chart-fill: var(--chart-2);
  --sidebar: oklch(0.21 0.006 285.885);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.274 0.006 286.033);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --menu: oklch(0.985 0 0 / 0.9);
  --menu-foreground: oklch(0.141 0.005 285.823);
  --menu-muted: oklch(0.552 0.016 285.938);
  --menu-accent: oklch(0 0 0 / 0.06);
  --menu-border: oklch(0 0 0 / 0.08);
  color-scheme: dark;
}

/* ---------------- Basis ---------------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html, body { height: 100%; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-heading); margin: 0; letter-spacing: -0.01em; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in oklch, var(--primary) 30%, transparent); }
:focus-visible { outline: none; }
.mono { font-family: var(--font-sans); }
.muted { color: var(--muted-foreground); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
.text-success { color: var(--primary); }
.text-destructive { color: var(--destructive); }
.text-warning { color: var(--warning); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 15.5rem; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-header { padding: 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: calc(var(--radius) - 2px); }
.brand-logo {
  width: 32px; height: 32px; border-radius: calc(var(--radius) - 2px); display: grid; place-items: center;
  background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); font-size: 17px;
}
.brand-title { font-family: var(--font-heading); font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub { color: var(--muted-foreground); font-size: 11px; }
.sidebar-content { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.nav-group { padding: 6px 0; }
.nav-label { padding: 0 8px; height: 28px; display: flex; align-items: center; font-size: 11px; color: var(--muted-foreground); font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: calc(var(--radius) - 2px);
  color: var(--sidebar-foreground); font-size: 13px; cursor: pointer; transition: background .12s, color .12s;
}
.nav-item i { font-size: 16px; opacity: .85; }
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav-item.active { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 500; }
.nav-item.active i { color: var(--primary); opacity: 1; }
.nav-item .nav-badge { margin-left: auto; }
.sidebar-footer { padding: 8px; border-top: 1px solid var(--sidebar-border); }
.user-button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px; border: 0; background: transparent;
  border-radius: calc(var(--radius) - 2px); cursor: pointer; text-align: left;
}
.user-button:hover { background: var(--sidebar-accent); }
.user-button .meta { flex: 1; min-width: 0; line-height: 1.25; }
.user-button .name { font-weight: 500; font-size: 13px; }
.user-button .role { font-size: 11px; color: var(--muted-foreground); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: color-mix(in oklch, var(--background) 85%, transparent); backdrop-filter: blur(8px); z-index: 20;
}
.topbar .sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-foreground); min-width: 0; }
.breadcrumb .current { color: var(--foreground); font-weight: 500; }
.topbar .spacer { flex: 1; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-foreground); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 99px; background: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 20%, transparent); }
.content { padding: 20px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; }
.page-desc { color: var(--muted-foreground); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mobile-only { display: none !important; }

/* ---------------- Grid ---------------- */
.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.col-span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap-2 { gap: 4px; } .gap-4 { gap: 12px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }

/* ---------------- Card ---------------- */
.card {
  background: var(--card); color: var(--card-foreground); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; min-width: 0;
}
.card-header { padding: 16px 16px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-title { font-family: var(--font-heading); font-weight: 600; font-size: 15px; line-height: 1.3; }
.card-desc { color: var(--muted-foreground); font-size: 12px; margin-top: 2px; }
.card-content { padding: 16px; }
.card-content.flush { padding: 12px 0 0; }
.card-footer { padding: 0 16px 16px; display: flex; align-items: center; gap: 8px; }
.card-action { display: flex; gap: 6px; }

.kpi .card-content { padding-top: 6px; }
.kpi-label { color: var(--muted-foreground); font-size: 12px; display: flex; align-items: center; justify-content: space-between; }
.kpi-label i { font-size: 15px; }
.kpi-value { font-family: var(--font-heading); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin-top: 6px; }
.kpi-sub { color: var(--muted-foreground); font-size: 12px; margin-top: 4px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, border-color .12s, box-shadow .12s; user-select: none;
  background: var(--primary); color: var(--primary-foreground);
}
.btn i { font-size: 15px; }
.btn:hover { background: color-mix(in oklch, var(--primary) 90%, transparent); }
.btn:focus-visible, .input:focus-visible, .select:focus-visible, .textarea:focus-visible, .switch:focus-visible, .checkbox:focus-visible, .tab:focus-visible, .nav-item:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent); border-color: var(--ring);
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-xs); }
.dark .btn-outline { background: color-mix(in oklch, var(--input) 30%, transparent); border-color: var(--input); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in oklch, var(--secondary) 80%, var(--foreground) 6%); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-destructive:hover { background: color-mix(in oklch, var(--destructive) 90%, transparent); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 4px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; gap: 4px; border-radius: calc(var(--radius) - 4px); }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn .spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  border: 1px solid transparent; background: var(--primary); color: var(--primary-foreground); white-space: nowrap;
}
.badge i { font-size: 12px; }
.badge-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.badge-destructive { background: color-mix(in oklch, var(--destructive) 12%, transparent); color: var(--destructive); }
.badge-success { background: color-mix(in oklch, var(--primary) 14%, transparent); color: var(--primary); }
.badge-warning { background: color-mix(in oklch, var(--warning) 15%, transparent); color: var(--warning); }
.dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; background: var(--muted-foreground); flex-shrink: 0; }
.dot-success { background: var(--primary); }
.dot-destructive { background: var(--destructive); }
.dot-warning { background: var(--warning); }

/* ---------------- Form ---------------- */
.label { font-size: 12px; font-weight: 500; display: block; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 0; }
.field + .field { margin-top: 12px; }
.help { color: var(--muted-foreground); font-size: 11px; margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px);
  background: transparent; font-size: 13px; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
.dark .input, .dark .select, .dark .textarea { background: color-mix(in oklch, var(--input) 30%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.select { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14' fill='%2371717a'%3E%3Cpath d='M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.select option { background: var(--popover); color: var(--popover-foreground); }
.textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.code-editor {
  width: 100%; min-height: 60vh; padding: 12px 14px; font-family: var(--font-sans); font-size: 12.5px; line-height: 1.6; tab-size: 2;
  border: 1px solid var(--input); border-radius: calc(var(--radius) - 2px); background: var(--muted); resize: vertical; white-space: pre; overflow: auto;
}
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); font-size: 14px; pointer-events: none; }
.input-icon .input { padding-left: 32px; }

.switch {
  position: relative; width: 32px; height: 18px; border-radius: 99px; border: 1px solid transparent; background: var(--input);
  cursor: pointer; flex-shrink: 0; transition: background .15s; padding: 0;
}
.dark .switch { background: color-mix(in oklch, var(--input) 80%, transparent); }
.switch::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 99px; background: var(--background);
  box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s;
}
.dark .switch::after { background: var(--foreground); }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }
.dark .switch[aria-checked="true"]::after { background: var(--primary-foreground); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

.checkbox {
  appearance: none; width: 16px; height: 16px; border: 1px solid var(--input); border-radius: 4px; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; margin: 0; box-shadow: var(--shadow-xs);
}
.checkbox:checked { background: var(--primary); border-color: var(--primary); }
.checkbox:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--primary-foreground); border-bottom: 2px solid var(--primary-foreground); transform: rotate(-45deg) translate(1px, -1px); }
.checkbox:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- Tabs ---------------- */
.tabs { display: inline-flex; align-items: center; padding: 3px; gap: 2px; background: var(--muted); border-radius: var(--radius); height: 34px; }
.tab {
  height: 28px; padding: 0 10px; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; background: transparent;
  color: var(--muted-foreground); font-size: 12px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab:hover { color: var(--foreground); }
.tab.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-xs); }
.dark .tab.active { background: color-mix(in oklch, var(--input) 30%, transparent); border-color: var(--input); }

/* ---------------- Table ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted-foreground); height: 36px; padding: 0 12px; white-space: nowrap; border-bottom: 1px solid var(--border); font-size: 12px; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: color-mix(in oklch, var(--muted) 50%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table .right, .right { text-align: right; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------------- Avatar ---------------- */
.avatar { position: relative; width: 28px; height: 28px; border-radius: calc(var(--radius) - 4px); background: var(--muted); flex-shrink: 0; overflow: hidden; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted-foreground); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.avatar-lg { font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; border-radius: var(--radius); }
.avatar-sm { width: 22px; height: 22px; }
.player-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-cell .n { font-weight: 500; }

/* ---------------- Liste / Misc ---------------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.separator { height: 1px; background: var(--border); margin: 12px 0; border: 0; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted-foreground); }
.empty i { font-size: 26px; display: block; margin-bottom: 8px; opacity: .6; }
.empty .t { color: var(--foreground); font-weight: 500; margin-bottom: 2px; }
.progress { height: 6px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.warn > span { background: var(--warning); }
.progress.bad > span { background: var(--destructive); }
.alert { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--card); }
.alert i { font-size: 16px; margin-top: 1px; }
.alert-title { font-weight: 500; }
.alert.destructive { color: var(--destructive); border-color: color-mix(in oklch, var(--destructive) 35%, transparent); }
.alert.warning { border-color: color-mix(in oklch, var(--warning) 40%, transparent); }
.alert.warning i { color: var(--warning); }
.kbd { font-size: 11px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted); }
.skeleton { background: var(--muted); border-radius: calc(var(--radius) - 2px); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.color-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* Server-Karten */
.server-card .card-content { padding-top: 12px; }
.server-name { font-family: var(--font-heading); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.metric { padding: 8px 10px; border-radius: calc(var(--radius) - 2px); background: var(--muted); }
.metric .l { font-size: 11px; color: var(--muted-foreground); }
.metric .v { font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Rechte-Auswahl */
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.perm-group + .perm-group { margin-top: 10px; }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--muted); font-weight: 500; font-size: 12px; }
.perm-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.perm-item:hover { background: color-mix(in oklch, var(--muted) 50%, transparent); }
.perm-item .t { font-weight: 500; font-size: 12.5px; }
.perm-item .d { color: var(--muted-foreground); font-size: 11px; }
.perm-item code { font-size: 10.5px; color: var(--muted-foreground); }

/* Einstellungen */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); }
.setting:first-child { border-top: 0; }
.setting .k { font-weight: 500; font-size: 12.5px; }
.setting .p { color: var(--muted-foreground); font-size: 11px; }
.setting .control { width: min(380px, 50%); display: flex; justify-content: flex-end; gap: 6px; }
.setting .control .input, .setting .control .textarea { max-width: 380px; }
.section-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 68px; }
.section-nav a { padding: 6px 10px; border-radius: calc(var(--radius) - 2px); color: var(--muted-foreground); font-size: 12.5px; }
.section-nav a:hover { background: var(--accent); color: var(--foreground); }

/* ---------------- Diagramme ---------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .axis { fill: var(--muted-foreground); font-size: 10.5px; font-family: var(--font-sans); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#fill); }
.chart .bar { fill: var(--chart-line); }
.chart .bar:hover, .chart .bar.hover { fill: var(--primary); }
.chart .cursor { stroke: var(--muted-foreground); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .pt { fill: var(--background); stroke: var(--chart-line); stroke-width: 2; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 120px; padding: 6px 10px; font-size: 11.5px;
  border-radius: calc(var(--radius) - 2px); background: var(--menu); color: var(--menu-foreground); border: 1px solid var(--menu-border);
  backdrop-filter: blur(10px) saturate(1.4); -webkit-backdrop-filter: blur(10px) saturate(1.4); box-shadow: var(--shadow-lg); transform: translate(-50%, -110%); white-space: nowrap;
}
.chart-tooltip .tt-title { color: var(--menu-muted); margin-bottom: 2px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart-tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: minmax(80px, 140px) 1fr auto; align-items: center; gap: 10px; font-size: 12px; padding: 5px 0; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--chart-line); border-radius: 99px; }

/* ---------------- Menüs (invertiert, transluzent) ---------------- */
.menu {
  position: fixed; z-index: 60; min-width: 200px; padding: 4px; border-radius: var(--radius);
  background: var(--menu); color: var(--menu-foreground); border: 1px solid var(--menu-border);
  backdrop-filter: blur(12px) saturate(1.5); -webkit-backdrop-filter: blur(12px) saturate(1.5);
  box-shadow: var(--shadow-lg); animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.menu-label { padding: 6px 8px; font-size: 11px; color: var(--menu-muted); }
.menu-item { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: calc(var(--radius) - 4px); cursor: pointer; font-size: 12.5px; border: 0; background: transparent; width: 100%; text-align: left; color: inherit; }
.menu-item i { font-size: 15px; color: var(--menu-muted); }
.menu-item:hover { background: var(--menu-accent); }
.menu-item.destructive, .menu-item.destructive i { color: var(--destructive); }
.menu-sep { height: 1px; background: var(--menu-border); margin: 4px -4px; }

/* ---------------- Dialog ---------------- */
.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .5); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow: hidden; display: flex; flex-direction: column; background: var(--background); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); box-shadow: var(--shadow-lg); animation: dialog-in .15s ease-out;
}
.dialog.wide { max-width: 720px; }
@keyframes dialog-in { from { opacity: 0; transform: scale(.97); } }
.dialog-header { padding: 18px 18px 0; }
.dialog-title { font-family: var(--font-heading); font-size: 17px; font-weight: 600; }
.dialog-desc { color: var(--muted-foreground); margin-top: 4px; font-size: 12.5px; }
.dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-body { padding: 16px 18px; overflow-y: auto; min-height: 0; }
.dialog-footer { padding: 12px 18px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- Toasts ---------------- */
.toaster { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: var(--menu); color: var(--menu-foreground); border: 1px solid var(--menu-border);
  backdrop-filter: blur(12px) saturate(1.5); -webkit-backdrop-filter: blur(12px) saturate(1.5); box-shadow: var(--shadow-lg);
  font-size: 12.5px; animation: toast-in .2s ease-out;
}
.toast i { font-size: 16px; margin-top: 1px; }
.toast.success i { color: var(--primary); }
.toast.error i { color: var(--destructive); }
.toast .tt { font-weight: 500; }
.toast .td { color: var(--menu-muted); margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Login ---------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side {
  background: var(--sidebar); border-right: 1px solid var(--border); padding: 32px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(ellipse at 30% 70%, black, transparent 70%);
}
.login-side > * { position: relative; z-index: 1; }
.login-quote { font-family: var(--font-heading); font-size: 20px; line-height: 1.4; max-width: 420px; }
.login-main { display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { font-size: 24px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted-foreground); margin: 4px 0 24px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 25; }
  .mobile-only { display: inline-flex !important; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .content { padding: 16px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .setting { flex-direction: column; align-items: stretch; }
  .setting .control { width: 100%; justify-content: flex-start; }
  .hide-sm { display: none; }
  .card-header { flex-wrap: wrap; }
  .tabs { max-width: 100%; overflow-x: auto; }
}
.grid-2 { align-items: start; }
@media (max-width: 520px) {
  .grid-kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 22px; }
  .metric-row { grid-template-columns: 1fr 1fr; }
}
