:root {
    --bg: #0b0f14;
    --panel: #111827;
    --panel-2: #0f172a;
    --border: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #2b59ff;
    --accent-dim: rgba(43, 89, 255, 0.15);
    --accent-soft: rgba(43, 89, 255, 0.35);
    --accent-strong: rgba(43, 89, 255, 0.45);
    --danger: #f87171;
    --ok: #34d399;
    --radius: 10px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(43, 89, 255, 0.14), transparent),
                radial-gradient(900px 500px at 90% 0%, rgba(99, 102, 241, 0.1), transparent),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    border-right: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 4px 6px 8px;
}

.brand-link {
    display: block;
    line-height: 0;
    border-radius: 10px;
}

.brand-link:hover {
    text-decoration: none;
    opacity: 0.92;
}

.brand-logo {
    display: block;
    height: auto;
    width: min(100%, 220px);
    max-height: 52px;
    object-fit: contain;
    object-position: left center;
}

.brand-team-pill {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--accent-soft);
    background: var(--accent-dim);
}

.brand--staff .brand-logo {
    max-height: 48px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.nav-link.active {
    background: var(--accent-dim);
    border-color: var(--accent-soft);
}

.userbox {
    margin-top: auto;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.2);
}

.user-name {
    font-weight: 600;
}

.user-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    padding: 22px 28px 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(17, 24, 39, 0.65);
    backdrop-filter: blur(8px);
}

.page-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.content {
    padding: 22px 28px 40px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(17, 24, 39, 0.85);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    color: var(--muted);
}

.badge-open {
    border-color: rgba(52, 211, 153, 0.45);
    color: var(--ok);
}

.badge-pending {
    border-color: rgba(251, 191, 36, 0.45);
    color: #fbbf24;
}

.badge-closed {
    border-color: rgba(248, 113, 113, 0.45);
    color: var(--danger);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.07);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(43, 89, 255, 0.28), rgba(99, 102, 241, 0.22));
    border-color: var(--accent-strong);
}

.card-accent-hint {
    border-color: var(--accent-strong);
    margin-bottom: 14px;
}

.btn-ghost {
    background: transparent;
}

.btn-small {
    padding: 6px 10px;
    font-size: 13px;
}

label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    width: fit-content;
    max-width: min(100%, 22rem);
    min-width: 11.5rem;
    padding: 10px 40px 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-color: rgba(15, 23, 42, 0.95);
    background-image: var(--select-arrow);
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    min-height: 44px;
    cursor: pointer;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:hover {
    border-color: var(--accent-soft);
}

select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Liste der Optionen (Browser-unterschiedlich, hilft wo unterstützt) */
select option {
    background-color: var(--panel);
    color: var(--text);
    padding: 10px 12px;
    font-weight: 500;
}

select option:checked {
    background: linear-gradient(0deg, rgba(43, 89, 255, 0.35), rgba(43, 89, 255, 0.35)), var(--panel);
}

.toolbar select {
    min-width: auto;
    max-width: min(100%, 18rem);
}

@media (max-width: 480px) {
    select {
        width: 100%;
        max-width: 100%;
    }
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: rgba(0, 0, 0, 0.18);
    margin-bottom: 12px;
}

.thread-meta {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.thread-body {
    white-space: pre-wrap;
    line-height: 1.45;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

@media (max-width: 960px) {
    .app {
        grid-template-columns: 1fr;
    }
    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .userbox {
        margin-top: 0;
        width: 100%;
    }
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }
}
