:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --bg-softer: #020617;
    --border: #1e293b;
    --accent: #0ea5e9;
    --accent-soft: rgba(14, 165, 233, 0.1);
    --accent-strong: #0369a1;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --danger-soft: rgba(248, 113, 113, 0.1);
    --radius: 0.75rem;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, #0f172a, #020617 60%);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.nav-link {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    color: var(--text-muted);
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
}

.nav-link-active {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.6);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-chip {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    color: var(--text);
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.08s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: rgba(56, 189, 248, 0.8);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.4);
}

.btn-ghost {
    border-color: var(--border);
    background: rgba(15, 23, 42, 0.7);
}

.btn-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.5);
    background: var(--danger-soft);
    color: #fecaca;
}

/* Layout */

.page {
    width: 100%;
    max-width: 100%;
    margin: 1.5rem 0 2.5rem;
    padding: 0 1rem;
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .page-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Card */

.card {
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), var(--bg-soft));
    border-radius: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.9);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem 1.5rem;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.12), transparent 60%);
    opacity: 0.8;
    pointer-events: none;
}

.card > * {
    position: relative;
    z-index: 1;
}

.card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

/* Tabelle */

.table-wrapper {
    margin-top: 0.75rem;
    border-radius: 0.9rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.8);
    overflow-x: auto;   /* horizontales Scrollen statt Abschneiden */
    overflow-y: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 900px;
}

.data-table thead {
    background: rgba(15, 23, 42, 0.95);
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid rgba(30, 64, 175, 0.35);
    text-align: left;
}

/* Filter-Zeile */

.data-table thead .filter-row th {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid rgba(30, 64, 175, 0.35);
}

.data-table .column-filter {
    width: 100%;
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.2rem 0.6rem;
    background: rgba(15, 23, 42, 0.95);
    color: var(--text);
    font-size: 0.75rem;
    outline: none;
}

.data-table .column-filter::placeholder {
    color: var(--text-muted);
}

.data-table .column-filter:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

/* Header */

.data-table th {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    user-select: none;
}

/* Zebra & Hover */

.data-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.4);
}

.data-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.9);
}

.data-table td code {
    font-size: 0.8rem;
    color: var(--accent);
}

/* ID-Spalte (letzte Spalte, schmal und sichtbar) */

.data-table th:last-child,
.data-table td:last-child {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 0.6rem;
}

/* Aktionen */

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

/* Formulare */

.form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.form-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
}

.form-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Checkbox-/Radio-Labels inline ausrichten */
.form-label-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.form-label-inline input[type="checkbox"],
.form-label-inline input[type="radio"] {
    width: auto;
    margin: 0;
}

.form-input {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.45rem 0.9rem;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-input:focus {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Alerts */

.alert {
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.alert-info {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.6);
    color: #e0f2fe;
}

.alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(248, 113, 113, 0.7);
    color: #fecaca;
}

/* Auth-Layout */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    padding: 2rem 2.25rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(15, 23, 42, 0.9);
    box-shadow: var(--shadow);
    background: radial-gradient(circle at 0% -20%, rgba(56, 189, 248, 0.32), transparent 60%),
                radial-gradient(circle at 100% 130%, rgba(244, 63, 94, 0.24), transparent 50%),
                #020617;
}

.auth-card h1 {
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
}

/* Mobile */

@media (max-width: 600px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        max-width: 100%;
    }

    .data-table {
        min-width: 700px;
    }
}