:root {
    color-scheme: dark;

    --bg: #070a12;
    --bg-2: #0b1020;
    --sidebar: #080d19;
    --surface: #101827;
    --surface-2: #121d2f;
    --surface-3: #172238;

    --line: rgba(148, 163, 184, 0.14);
    --line-strong: rgba(148, 163, 184, 0.24);

    --text: #e5e7eb;
    --text-strong: #f8fafc;
    --muted: #94a3b8;
    --muted-soft: #64748b;

    --accent: #3b82f6;
    --accent-2: #14b8a6;
    --accent-soft: rgba(59, 130, 246, 0.14);

    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.12);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);

    --radius: 14px;
    --radius-lg: 18px;

    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.22);
    --focus: 0 0 0 3px rgba(59, 130, 246, 0.24);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.12), transparent 34rem),
        radial-gradient(circle at 80% 0%, rgba(20, 184, 166, 0.08), transparent 28rem),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    color: var(--text);
    letter-spacing: -0.01em;
}

::selection {
    background: rgba(59, 130, 246, 0.35);
    color: #ffffff;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, #090e1a 0%, #070b14 100%);
    border-right: 1px solid var(--line);
}

.sidebar::-webkit-scrollbar,
.log-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.result-box::-webkit-scrollbar,
.modal::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.sidebar::-webkit-scrollbar-thumb,
.log-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.result-box::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.38);
    background-clip: content-box;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.035);
}

.brand-mark {
    position: relative;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 12px 26px rgba(59, 130, 246, 0.24);
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(255, 255, 255, 0.68);
    border-radius: 7px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: var(--text-strong);
    font-size: 15px;
    line-height: 1.15;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

nav {
    display: grid;
    gap: 5px;
}

nav a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 11px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
    transition:
        background 150ms ease,
        color 150ms ease,
        transform 150ms ease;
}

nav a::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-right: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
}

nav a:hover {
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.055);
    color: #ffffff;
}

nav a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(20, 184, 166, 0.78));
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.22);
}

nav a.active::before {
    background: #ffffff;
}

.main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 10, 18, 0.86);
    backdrop-filter: blur(16px);
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    color: var(--text-strong);
    font-size: clamp(24px, 2.4vw, 32px);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

h2 {
    color: var(--text-strong);
    font-size: 15px;
    line-height: 1.25;
}

.topbar p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    white-space: nowrap;
    box-shadow: var(--shadow-soft);
    font-size: 12px;
    font-weight: 700;
}

.status-pill::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 14px currentColor;
}

.status-pill.online {
    border-color: rgba(52, 211, 153, 0.24);
    background: var(--ok-soft);
    color: var(--ok);
}

.status-pill.offline {
    border-color: rgba(251, 113, 133, 0.24);
    background: var(--danger-soft);
    color: var(--danger);
}

.content {
    display: grid;
    gap: 18px;
    padding: 24px 28px;
}

.grid {
    display: grid;
    gap: 18px;
}

.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.panel {
    position: relative;
    overflow: hidden;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(16, 24, 39, 0.88);
    box-shadow: var(--shadow);
}

.panel.narrow {
    max-width: 780px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-head a {
    color: #93c5fd;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.panel-head a:hover {
    color: #bfdbfe;
}

.metric {
    min-height: 112px;
    display: grid;
    align-content: center;
    gap: 8px;
}

.metric::after {
    content: "";
    position: absolute;
    right: -34px;
    bottom: -42px;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.14), transparent 68%);
}

.metric span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric strong {
    color: var(--text-strong);
    font-size: clamp(22px, 2.2vw, 30px);
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto auto auto;
    gap: 10px;
    align-items: center;
}

.toolbar.wide {
    grid-template-columns: minmax(120px, 160px) minmax(180px, 220px) minmax(220px, 1fr) minmax(220px, 1fr) auto auto auto;
}

.stack {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    padding: 9px 11px;
    outline: none;
    background: #0b1220;
    color: var(--text);
    font: inherit;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-soft);
}

input:hover,
select:hover,
textarea:hover {
    border-color: rgba(148, 163, 184, 0.38);
    background: #0d1728;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--focus);
}

.small-input {
    max-width: 260px;
}

.check {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
    color: var(--text);
    white-space: nowrap;
    font-weight: 700;
}

.check input {
    width: 16px;
    min-height: 16px;
    accent-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: #111a2c;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
    transition:
        transform 140ms ease,
        box-shadow 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.44);
    background: #152039;
    box-shadow: var(--shadow-soft);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.btn.primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: #ffffff;
    box-shadow: 0 12px 26px rgba(59, 130, 246, 0.24);
}

.btn.danger {
    border-color: rgba(251, 113, 133, 0.28);
    background: var(--danger-soft);
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0b1220;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 11px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background 140ms ease;
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.055);
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0f172a;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.065em;
}

td {
    color: #dbeafe;
    font-size: 13px;
}

td input,
td select {
    min-height: 36px;
    padding: 7px 9px;
    border-radius: 9px;
}

td code,
.kv-item code {
    display: inline-flex;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f172a;
    color: #bfdbfe;
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        monospace;
    font-size: 0.9em;
    overflow-wrap: anywhere;
}

.actions,
td:last-child {
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.10);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
}

.badge.ok {
    border-color: rgba(52, 211, 153, 0.22);
    background: var(--ok-soft);
    color: var(--ok);
}

.badge.warn {
    border-color: rgba(251, 191, 36, 0.24);
    background: var(--warning-soft);
    color: var(--warning);
}

.log-list {
    display: grid;
    gap: 10px;
    max-height: 680px;
    overflow: auto;
    padding-right: 4px;
}

.log-list.compact {
    max-height: 420px;
}

.log-item {
    position: relative;
    overflow: hidden;
    padding: 13px 14px 13px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #0b1220;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease,
        box-shadow 140ms ease;
}

.log-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.log-item:hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.28);
    background: #0e1728;
    box-shadow: var(--shadow-soft);
}

.log-item strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-strong);
    font-size: 13px;
}

.log-item p {
    color: #cbd5e1;
    line-height: 1.5;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.log-meta {
    margin-top: 8px;
    color: var(--muted-soft);
    font-size: 11px;
    font-weight: 650;
}

.kv-list {
    display: grid;
    gap: 6px;
}

.kv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.kv-item:last-child {
    border-bottom: 0;
}

.kv-item span {
    color: var(--muted);
    text-align: right;
    overflow-wrap: anywhere;
}

.result-box {
    min-height: 120px;
    margin-top: 14px;
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #050914;
    color: #dbeafe;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1100;
    max-width: min(360px, calc(100vw - 44px));
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #0f172a;
    color: #ffffff;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 750;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 24px;
    pointer-events: none;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(10px);
}

.modal-backdrop.is-open {
    display: grid;
    pointer-events: auto;
}

.modal-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
}

.modal {
    position: relative;
    width: min(780px, 100%);
    max-height: 84vh;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

body.modal-open {
    overflow: hidden;
}

.muted {
    color: var(--muted);
}

@media (max-width: 1180px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .toolbar.wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar .btn,
    .toolbar.wide .btn {
        width: 100%;
    }
}

@media (max-width: 960px) {
    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }

    .brand {
        margin-bottom: 14px;
    }

    nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    nav a {
        justify-content: center;
        text-align: center;
    }

    nav a::before {
        display: none;
    }

    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .content {
        padding: 20px;
    }
}

@media (max-width: 680px) {
    .metrics,
    .toolbar,
    .toolbar.wide {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 15px;
        border-radius: 16px;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .small-input {
        max-width: none;
    }

    nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kv-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .kv-item span {
        text-align: left;
    }

    .toast {
        right: 14px;
        bottom: 14px;
        max-width: calc(100vw - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

.music-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.music-controls .btn {
    min-width: 96px;
}

/* Economy Page */
.economy-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 24rem),
        radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.12), transparent 22rem),
        rgba(16, 24, 39, 0.9);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.economy-hero .eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    margin-bottom: 10px;
    padding: 4px 9px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.economy-hero h2 {
    margin: 0;
    color: var(--text-strong);
    font-size: clamp(22px, 2.4vw, 32px);
    letter-spacing: -0.045em;
}

.economy-hero p {
    max-width: 760px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.economy-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.economy-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
}

.economy-card {
    min-height: 100%;
}

.economy-card-primary {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 18rem),
        rgba(16, 24, 39, 0.88);
}

.panel-subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.economy-form {
    margin-top: 12px;
}

.economy-form-inline {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.economy-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.economy-full {
    grid-column: 1 / -1;
}

.economy-divider {
    height: 1px;
    margin: 16px 0;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.economy-user-card {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #0b1220;
}

.economy-user-card:empty::before {
    content: "Noch kein User geladen.";
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.economy-leaderboard {
    counter-reset: leaderboard;
}

.economy-leaderboard .kv-item {
    position: relative;
    padding-left: 42px;
}

.economy-leaderboard .kv-item::before {
    counter-increment: leaderboard;
    content: counter(leaderboard);
    position: absolute;
    left: 0;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0b1220;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 900;
}

.economy-transactions .log-item {
    border-left: 0;
}

.economy-transactions:empty::before {
    content: "Keine Transaktionen vorhanden.";
    display: block;
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
}

.economy-table td input,
.economy-table td select {
    min-width: 88px;
}

.economy-table td:last-child {
    text-align: right;
}

@media (max-width: 1180px) {
    .economy-grid {
        grid-template-columns: 1fr;
    }

    .economy-form-inline {
        grid-template-columns: 1fr;
    }

    .economy-form-inline .btn {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .economy-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

    .economy-hero-actions,
    .economy-hero-actions .btn {
        width: 100%;
    }

    .economy-form-grid {
        grid-template-columns: 1fr;
    }
}