:root {
    color-scheme: dark;

    --bg: #0d0914;
    --bg-secondary: #151020;

    --surface: #1b1428;
    --surface-hover: #241a35;
    --surface-raised: #21182f;

    --primary: #a855f7;
    --primary-hover: #c084fc;
    --primary-dark: #7e22ce;
    --accent: #d8b4fe;

    --text: #f5f3ff;
    --text-secondary: #c4b5d9;
    --text-muted: #8f83a3;

    --border: #342645;
    --border-hover: #543a70;

    --success: #86efac;
    --danger: #fca5a5;

    --shadow: 0 10px 35px rgba(0, 0, 0, 0.35);

    --radius: 12px;
    --radius-small: 8px;

    --transition: 0.2s ease;
}

html[data-theme="light"] {
    color-scheme: light;

    --bg: #f7f3fc;
    --bg-secondary: #eee7f7;

    --surface: #ffffff;
    --surface-hover: #f4edfb;
    --surface-raised: #faf7fd;

    --primary: #9333ea;
    --primary-hover: #a855f7;
    --primary-dark: #6b21a8;
    --accent: #7e22ce;

    --text: #24152f;
    --text-secondary: #594568;
    --text-muted: #806f8e;

    --border: #e4d8ed;
    --border-hover: #cbb3dc;

    --success: #15803d;
    --danger: #dc2626;

    --shadow: 0 10px 35px rgba(68, 30, 96, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at top right,
            rgba(168, 85, 247, 0.08),
            transparent 35%
        ),
        var(--bg);

    color: var(--text);

    transition:
        background var(--transition),
        color var(--transition);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* =========================
   Layout
   ========================= */

.app {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;

    height: 68px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 24px;

    background: rgba(13, 9, 20, 0.88);
    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(16px);
}

html[data-theme="light"] .topbar {
    background: rgba(247, 243, 252, 0.88);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    font-size: 19px;
    font-weight: 700;

    color: var(--text);
}

.brand-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            var(--primary),
            var(--primary-dark)
        );

    color: white;

    box-shadow:
        0 6px 20px rgba(168, 85, 247, 0.3);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.username {
    color: var(--text-secondary);
    font-size: 14px;
}

/* =========================
   Dashboard
   ========================= */

.dashboard-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);

    min-height: calc(100vh - 68px);
}

.sidebar {
    padding: 22px 16px;

    border-right: 1px solid var(--border);

    background: var(--bg-secondary);
}

.sidebar-title {
    margin: 0 10px 12px;

    color: var(--text-muted);

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.server-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.server-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 11px;

    padding: 10px 12px;

    border: 1px solid transparent;
    border-radius: var(--radius-small);

    background: transparent;

    color: var(--text-secondary);

    text-align: left;

    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition);
}

.server-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.server-item.active {
    background: rgba(168, 85, 247, 0.13);
    border-color: rgba(168, 85, 247, 0.28);
    color: var(--text);
}

.server-icon {
    width: 34px;
    height: 34px;

    flex: 0 0 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    background: var(--surface);

    color: var(--accent);

    font-weight: 700;
}

.server-name {
    overflow: hidden;

    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 14px;
    font-weight: 600;
}

.main {
    width: 100%;
    max-width: 1500px;

    margin: 0 auto;
    padding: 32px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 28px;
}

.page-title {
    margin: 0 0 6px;

    font-size: clamp(25px, 4vw, 34px);
    line-height: 1.1;
}

.page-description {
    margin: 0;

    color: var(--text-secondary);

    font-size: 14px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================
   Cards
   ========================= */

.grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(260px, 1fr)
        );

    gap: 18px;
}

.card {
    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);

    overflow: hidden;

    transition:
        border-color var(--transition),
        background var(--transition),
        transform var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    padding: 18px 20px;

    border-bottom: 1px solid var(--border);
}

.card-title {
    margin: 0;

    font-size: 16px;
    font-weight: 700;
}

.card-subtitle {
    margin: 5px 0 0;

    color: var(--text-muted);

    font-size: 13px;
}

.card-body {
    padding: 20px;
}

/* =========================
   Stats
   ========================= */

.stat-card {
    padding: 20px;
}

.stat-label {
    color: var(--text-muted);

    font-size: 12px;
    font-weight: 600;

    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    margin-top: 8px;

    font-size: 30px;
    font-weight: 800;

    color: var(--text);
}

.stat-accent {
    color: var(--primary);
}

/* =========================
   Forms
   ========================= */

.form-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(220px, 1fr)
        );

    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;

    padding: 11px 13px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: var(--bg-secondary);

    color: var(--text);

    outline: none;

    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-hover);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px
        rgba(168, 85, 247, 0.14);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.form-help {
    color: var(--text-muted);
    font-size: 12px;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 20px;
}

/* =========================
   Buttons
   ========================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 40px;

    padding: 9px 15px;

    border: 1px solid transparent;
    border-radius: var(--radius-small);

    font-size: 14px;
    font-weight: 700;

    transition:
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;

    box-shadow:
        0 5px 18px rgba(168, 85, 247, 0.22);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: transparent;
    border-color: rgba(248, 113, 113, 0.35);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

.btn-small {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
}

/* =========================
   Theme Toggle
   ========================= */

.theme-toggle {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--surface);

    color: var(--text);

    font-size: 17px;

    transition:
        background var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.theme-toggle:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);

    transform: rotate(8deg);
}

/* =========================
   Lists
   ========================= */

.item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 13px 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: var(--surface-raised);

    transition:
        border-color var(--transition),
        background var(--transition);
}

.list-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.list-item-main {
    min-width: 0;
}

.list-item-title {
    margin: 0;

    font-size: 14px;
    font-weight: 700;
}

.list-item-description {
    margin: 4px 0 0;

    color: var(--text-muted);

    font-size: 12px;
}

.list-item-actions {
    display: flex;
    align-items: center;
    gap: 7px;

    flex-shrink: 0;
}

/* =========================
   Accommodation
   ========================= */

.accommodation-item {
    display: flex;
    align-items: center;

    gap: 12px;
}

.accommodation-emoji {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: rgba(168, 85, 247, 0.12);

    font-size: 20px;
}

.accommodation-info {
    flex: 1;
    min-width: 0;
}

/* =========================
   Events
   ========================= */

.event-item {
    display: grid;

    grid-template-columns: 1fr auto;

    gap: 16px;
}

.event-date {
    color: var(--primary);

    font-size: 12px;
    font-weight: 700;
}

.event-name {
    margin: 4px 0;

    font-size: 15px;
    font-weight: 700;
}

.event-meta {
    color: var(--text-muted);

    font-size: 12px;
}

.event-stats {
    display: flex;
    align-items: center;

    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;

    border-radius: 999px;

    background: rgba(168, 85, 247, 0.12);

    color: var(--accent);

    font-size: 12px;
    font-weight: 700;
}

.badge-success {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

/* =========================
   Status
   ========================= */

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    font-size: 13px;
    font-weight: 600;
}

.status::before {
    content: "";

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: currentColor;
}

.status-success {
    color: var(--success);
}

.status-danger {
    color: var(--danger);
}

.status-muted {
    color: var(--text-muted);
}

/* =========================
   Empty States
   ========================= */

.empty {
    padding: 35px 20px;

    text-align: center;

    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 10px;

    font-size: 28px;
}

.empty-title {
    margin: 0 0 5px;

    color: var(--text-secondary);

    font-size: 15px;
    font-weight: 700;
}

.empty-text {
    margin: 0;

    font-size: 13px;
}

/* =========================
   Login / Landing
   ========================= */

.auth-page {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 430px;
}

.auth-brand {
    text-align: center;

    margin-bottom: 25px;
}

.auth-brand .brand-icon {
    width: 56px;
    height: 56px;

    margin: 0 auto 14px;

    border-radius: 15px;

    font-size: 25px;
}

.auth-brand h1 {
    margin: 0 0 7px;

    font-size: 29px;
}

.auth-brand p {
    margin: 0;

    color: var(--text-muted);

    font-size: 14px;
}

.auth-card {
    padding: 25px;
}

.auth-divider {
    display: flex;
    align-items: center;

    gap: 12px;

    margin: 20px 0;

    color: var(--text-muted);

    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: var(--border);
}

.auth-footer {
    margin-top: 20px;

    text-align: center;

    color: var(--text-muted);

    font-size: 12px;
}

/* =========================
   Landing Page
   ========================= */

.landing {
    min-height: 100vh;

    display: flex;
    flex-direction: column;
}

.landing-nav {
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 30px;

    border-bottom: 1px solid var(--border);

    background: rgba(13, 9, 20, 0.7);

    backdrop-filter: blur(15px);
}

html[data-theme="light"] .landing-nav {
    background: rgba(247, 243, 252, 0.7);
}

.hero {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 80px 24px;
}

.hero-content {
    width: 100%;
    max-width: 850px;

    text-align: center;
}

.hero-badge {
    display: inline-flex;

    padding: 7px 12px;

    margin-bottom: 20px;

    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 999px;

    background: rgba(168, 85, 247, 0.1);

    color: var(--accent);

    font-size: 12px;
    font-weight: 700;
}

.hero h1 {
    margin: 0;

    font-size: clamp(42px, 8vw, 76px);
    line-height: 0.98;

    letter-spacing: -0.04em;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    max-width: 650px;

    margin: 24px auto 0;

    color: var(--text-secondary);

    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    margin-top: 30px;
}

.hero-actions .btn {
    min-width: 150px;
}

/* =========================
   Alerts
   ========================= */

.alert {
    padding: 12px 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: var(--surface-raised);

    color: var(--text-secondary);

    font-size: 13px;
}

.alert-success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.08);
    color: var(--success);
}

.alert-danger {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

/* =========================
   Utilities
   ========================= */

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.divider {
    height: 1px;
    margin: 20px 0;

    background: var(--border);
}

/* =========================
   Responsive
   ========================= */

@media (max-width: 850px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);

        padding: 12px;
    }

    .server-list {
        flex-direction: row;

        overflow-x: auto;

        padding-bottom: 3px;
    }

    .server-item {
        width: auto;
        min-width: 150px;
    }

    .main {
        padding: 22px 16px;
    }

    .page-header {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .topbar {
        height: 60px;
        padding: 0 14px;
    }

    .brand {
        font-size: 16px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
    }

    .username {
        display: none;
    }

    .hero {
        padding: 55px 18px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .auth-page {
        padding: 15px;
    }

    .auth-card {
        padding: 20px;
    }

    .event-item {
        grid-template-columns: 1fr;
    }

    .list-item {
        align-items: flex-start;
    }
}

/* =========================
   Accessibility
   ========================= */

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}