:root {
    --dash-bg: #07111f;
    --dash-panel: rgba(11, 19, 34, 0.94);
    --dash-panel-alt: rgba(16, 26, 45, 0.88);
    --dash-border: rgba(148, 163, 184, 0.16);
    --dash-cyan: #22d3ee;
    --dash-gold: #f8c866;
    --dash-green: #34d399;
    --dash-red: #fb7185;
    --dash-text-soft: #94a3b8;
}

body {
    background:
        radial-gradient(circle at top left, rgba(34, 211, 238, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(248, 200, 102, 0.14), transparent 28%),
        var(--dash-bg);
}

.dashboard-page {
    max-width: 1380px;
    margin: 0 auto;
    padding: 110px 24px 48px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 28px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--dash-text-soft);
    text-decoration: none;
    font-weight: 700;
}

.back-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.dashboard-kicker,
.panel-label,
.card-label {
    color: var(--dash-gold);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-copy,
.dashboard-mascot-panel,
.sidebar-panel,
.surface {
    border: 1px solid var(--dash-border);
    border-radius: 18px;
    background:
        linear-gradient(145deg, rgba(13, 20, 37, 0.92), rgba(7, 13, 24, 0.96)),
        var(--dash-panel);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.hero-copy {
    padding: 28px;
}

.hero-copy h1 {
    margin: 14px 0 12px;
    color: var(--text-primary);
    font-size: clamp(2.2rem, 5vw, 4.6rem);
    line-height: 1;
}

.hero-copy p {
    max-width: 760px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.hero-status-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-top: 24px;
    padding: 20px;
    border: 1px solid rgba(34, 211, 238, 0.18);
    border-radius: 16px;
    background: rgba(14, 25, 43, 0.92);
}

.hero-status-card strong {
    display: block;
    margin-top: 6px;
    color: var(--text-primary);
    font-size: 1.15rem;
    line-height: 1.15;
}

.hero-status-card p {
    margin-top: 8px;
}

.session-status-prefix {
    display: block;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.session-user-highlight {
    display: block;
    margin-top: 4px;
    color: var(--dash-cyan);
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.05;
}

.discord-login-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
    min-height: 44px;
    border-radius: 10px;
    padding: 0 18px;
    border: 1px solid transparent;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.discord-login-btn,
.primary-btn {
    color: #06111f;
    background: linear-gradient(135deg, var(--dash-gold), #f59e0b);
}

.discord-login-btn {
    min-width: 168px;
    flex-shrink: 0;
}

.secondary-btn {
    color: var(--text-primary);
    background: rgba(30, 41, 59, 0.78);
    border-color: rgba(148, 163, 184, 0.16);
}

.danger-btn {
    color: #fff1f2;
    background: rgba(127, 29, 29, 0.88);
    border-color: rgba(251, 113, 133, 0.22);
}

.dashboard-mascot-panel {
    position: relative;
    padding: 24px;
    overflow: hidden;
}

.dashboard-mascot {
    display: block;
    width: min(270px, 70%);
    margin: 0 auto 16px;
    filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.34));
}

.mascot-welcome-bubble {
    position: absolute;
    top: 28px;
    right: 22px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(290px, calc(100% - 44px));
    padding: 12px 14px;
    border: 1px solid rgba(34, 211, 238, 0.18);
    border-radius: 18px 18px 18px 8px;
    background: rgba(8, 19, 36, 0.92);
    box-shadow: 0 18px 44px rgba(2, 8, 23, 0.42);
}

.mascot-welcome-bubble::after {
    content: "";
    position: absolute;
    right: 34px;
    bottom: -10px;
    width: 18px;
    height: 18px;
    border-right: 1px solid rgba(34, 211, 238, 0.18);
    border-bottom: 1px solid rgba(34, 211, 238, 0.18);
    background: rgba(8, 19, 36, 0.92);
    transform: rotate(45deg);
}

.welcome-avatar-shell {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.28);
    background: rgba(15, 23, 42, 0.92);
}

.welcome-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.welcome-copy {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 4px;
}

.welcome-label {
    color: var(--dash-gold);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.welcome-message {
    color: var(--text-primary);
    font-size: 0.98rem;
    line-height: 1.35;
}

.mini-preview {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.mini-preview-header,
.mini-preview-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.mini-preview span {
    color: var(--dash-text-soft);
    font-size: 0.88rem;
}

.mini-preview strong,
.mini-preview b {
    color: var(--text-primary);
}

.dashboard-shell {
    display: grid;
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.dashboard-sidebar {
    min-width: 0;
}

.sidebar-panel,
.surface {
    padding: 20px;
}

.panel-header h2,
.surface-header h2 {
    margin: 8px 0 0;
    color: var(--text-primary);
    font-size: 1.35rem;
}

.state-banner,
.form-feedback {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    line-height: 1.5;
}

.state-banner[data-state="error"],
.form-feedback.error {
    border-color: rgba(251, 113, 133, 0.3);
    color: #fecdd3;
    background: rgba(127, 29, 29, 0.28);
}

.state-banner[data-state="success"],
.form-feedback.success {
    border-color: rgba(52, 211, 153, 0.28);
    color: #d1fae5;
    background: rgba(6, 78, 59, 0.36);
}

.state-banner[data-state="warning"],
.form-feedback.warning {
    border-color: rgba(248, 200, 102, 0.34);
    color: #fde68a;
    background: rgba(120, 53, 15, 0.26);
}

.guild-list,
.event-list,
.main-grid {
    display: grid;
    gap: 14px;
}

.guild-list {
    margin-top: 14px;
}

.guild-item,
.event-card {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.78);
}

.guild-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.guild-item-main {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.guild-item-topline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.guild-item-topline strong {
    min-width: 0;
}

.guild-item:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 165, 250, 0.24);
    box-shadow: 0 12px 26px rgba(8, 15, 31, 0.28);
}

.guild-item small,
.event-card p,
.surface-header p,
.guild-empty-copy {
    color: var(--text-secondary);
}

.guild-item.active {
    border-color: rgba(34, 211, 238, 0.72);
    background:
        linear-gradient(135deg, rgba(8, 37, 64, 0.96), rgba(12, 30, 56, 0.92)),
        rgba(15, 23, 42, 0.86);
    box-shadow:
        inset 4px 0 0 var(--dash-cyan),
        0 0 0 1px rgba(34, 211, 238, 0.22),
        0 18px 34px rgba(12, 74, 110, 0.28);
    transform: translateY(-1px);
}

.guild-item.active::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.18);
}

.guild-item.active strong {
    color: #f8fdff;
}

.guild-item.active small {
    color: #d7f4ff;
}

.guild-warning {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--dash-gold);
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.guild-warning::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--dash-gold);
    box-shadow: 0 0 12px rgba(248, 200, 102, 0.48);
}

.main-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
    align-items: start;
}

.selected-guild-surface {
    grid-column: 1 / -1;
}

.event-surface {
    grid-column: 1;
    grid-row: 2 / span 2;
    min-width: 0;
}

.editor-surface {
    grid-column: 2;
    grid-row: 2;
}

.settings-surface {
    grid-column: 2;
    grid-row: 3;
}

.surface-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 14px;
}

.surface-actions,
.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.event-card {
    padding: 16px;
}

.event-card-header,
.event-card-meta,
.event-card-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.event-card-header strong,
.event-card-meta b {
    color: var(--text-primary);
}

.event-card-meta {
    margin-top: 12px;
}

.event-card-actions {
    margin-top: 14px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    color: var(--dash-cyan);
    font-size: 0.82rem;
    font-weight: 800;
}

.pill.off {
    color: #fecdd3;
    background: rgba(251, 113, 133, 0.12);
}

.editor-form,
.settings-form {
    display: grid;
    gap: 14px;
}

.editor-form label,
.settings-form label {
    display: grid;
    gap: 8px;
}

.editor-form span,
.settings-form span {
    color: var(--text-primary);
    font-weight: 700;
}

.editor-form input,
.editor-form select,
.editor-form textarea,
.settings-form input,
.settings-form select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    padding: 12px 14px;
    font: inherit;
}

.editor-form select:disabled,
.settings-form select:disabled {
    color: var(--dash-text-soft);
    opacity: 0.85;
    cursor: not-allowed;
}

.editor-form textarea {
    resize: vertical;
}

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

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.checkbox-row span {
    font-weight: 600;
    color: var(--text-secondary);
}

.empty-card {
    padding: 18px;
    border-radius: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.44);
}

.guild-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 8, 18, 0.62);
    backdrop-filter: blur(8px);
}

.guild-loading-overlay[hidden] {
    display: none !important;
}

.guild-loading-card {
    width: min(420px, 100%);
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(34, 211, 238, 0.16);
    background: rgba(10, 18, 33, 0.96);
    box-shadow: 0 28px 72px rgba(2, 8, 23, 0.42);
    text-align: center;
}

.guild-loading-card strong {
    color: var(--text-primary);
    font-size: 1.08rem;
}

.guild-loading-card span {
    color: var(--text-secondary);
    line-height: 1.5;
}

.guild-loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 3px solid rgba(34, 211, 238, 0.18);
    border-top-color: var(--dash-cyan);
    animation: guild-spin 0.9s linear infinite;
}

@keyframes guild-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1080px) {
    .dashboard-hero,
    .dashboard-shell,
    .main-grid,
    .form-row {
        grid-template-columns: 1fr;
    }

    .event-surface,
    .editor-surface,
    .settings-surface {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 720px) {
    .dashboard-page {
        padding: 92px 16px 32px;
    }

    .hero-status-card,
    .surface-header,
    .event-card-header,
    .event-card-meta,
    .event-card-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .discord-login-btn,
    .primary-btn,
    .secondary-btn,
    .danger-btn {
        width: 100%;
    }

    .mascot-welcome-bubble {
        position: static;
        max-width: 100%;
        margin: 0 auto 16px;
    }

    .mascot-welcome-bubble::after {
        display: none;
    }
}
