:root {
    color-scheme: dark;
    --bg: #0c0314;
    --panel: #150a22;
    --panel-soft: #221033;
    --text: #fbf7ff;
    --muted: #b8a6ce;
    --line: #37224d;
    --accent: #8b45ff;
    --accent-strong: #a869ff;
    --accent-deep: #5c2aa6;
    --success: #b98cff;
    --danger: #ff4f7b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
            radial-gradient(circle at 78% 8%, rgba(154, 92, 255, .28), transparent 30rem),
            radial-gradient(circle at 8% 12%, rgba(92, 42, 166, .32), transparent 28rem),
            linear-gradient(145deg, #08020d 0%, #160722 42%, #0c0314 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
    animation: pageIn .18s ease-out;
}

@keyframes pageIn {
    from {
        opacity: .85;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem clamp(1rem, 5vw, 4rem);
    border-bottom: 1px solid rgba(185, 140, 255, .14);
    background: rgba(12, 3, 20, .84);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-icon {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(139, 69, 255, .38);
}

nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
}

nav a:hover {
    color: var(--text);
}

.hero,
.page {
    width: min(1180px, calc(100% - 2.5rem));
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: clamp(2rem, 6vw, 5rem);
    align-items: center;
    min-height: calc(100vh - 73px);
    padding: 4rem 0;
}

.hero-copy h1,
.page-heading h1 {
    margin: .4rem 0 1rem;
    font-size: clamp(2rem, 5vw, 4.4rem);
    line-height: 1.02;
}

.hero-mark {
    display: inline-grid;
    place-items: center;
    width: 4.75rem;
    height: 4.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(185, 140, 255, .44);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(139, 69, 255, .18), rgba(5, 0, 8, .34));
    box-shadow: 0 24px 80px rgba(139, 69, 255, .28);
}

.hero-mark img {
    width: 3.25rem;
    height: 3.25rem;
}

.page-heading h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.hero-copy p,
.page-heading p,
.empty p {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.65;
}

.eyebrow {
    color: var(--accent-strong);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0 1.05rem;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-deep), var(--accent-strong));
    color: white;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.button:hover,
button.button:hover {
    background: linear-gradient(135deg, #7434d6, #bb8aff);
    color: white;
}

.button.small {
    min-height: 2.25rem;
    padding: 0 .8rem;
    font-size: .9rem;
}

.button.ghost {
    background: rgba(34, 16, 51, .9);
    color: var(--text);
}

.button.danger {
    background: var(--danger);
}

.button.danger:hover {
    background: #ff6688;
}

.preview-panel,
.settings-form,
.table-panel,
.empty {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(185, 140, 255, .09), rgba(255, 255, 255, .018));
    box-shadow: 0 24px 90px rgba(0, 0, 0, .34);
}

.preview-panel {
    padding: 1.35rem;
}

.preview-header {
    display: flex;
    gap: .45rem;
    margin-bottom: 1rem;
}

.preview-header span {
    width: .65rem;
    height: .65rem;
    border-radius: 999px;
    background: var(--line);
}

.metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.metric-row div,
.voice-card,
.guild-card,
.stats div {
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 8px;
    background: var(--panel);
}

.metric-row div {
    padding: 1rem;
}

small,
.metric-row small,
.voice-card small {
    display: block;
    color: var(--muted);
}

.voice-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
    padding: 1rem;
}

.voice-card.muted {
    opacity: .72;
}

.status-dot {
    width: .8rem;
    height: .8rem;
    border-radius: 999px;
    background: var(--accent-strong);
    box-shadow: 0 0 18px rgba(168, 105, 255, .58);
}

.status-dot.blue {
    background: var(--success);
}

.page {
    padding: 5rem 0 7.5rem;
}

.page.narrow {
    width: min(980px, calc(100% - 3rem));
}

.guild-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 2.5rem;
}

.guild-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.15rem;
    align-items: center;
    padding: 1.25rem;
}

.guild-card.editable {
    border-color: rgba(168, 105, 255, .68);
    background: linear-gradient(180deg, rgba(139, 69, 255, .18), var(--panel));
}

.guild-icon {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--panel-soft);
    font-weight: 800;
    overflow: hidden;
}

.guild-icon.big {
    width: 4.4rem;
    height: 4.4rem;
    font-size: 1.45rem;
}

.guild-icon img,
.user-pill img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.guild-info h2 {
    margin: 0 0 .25rem;
    font-size: 1.05rem;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin: .4rem 0 1rem;
}

.title-with-icon h1 {
    margin: 0;
}

.guild-info p {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.guild-card .button,
.guild-card .badge {
    grid-column: 1 / -1;
}

.badge {
    justify-self: start;
    padding: .35rem .65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.badge.muted {
    opacity: .7;
}

.badge.danger-soft {
    background: rgba(239, 71, 111, .14);
    color: #ff9ab0;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .6rem .25rem .25rem;
    border-radius: 999px;
    background: var(--panel-soft);
}

.user-pill img {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
}

.settings-form {
    display: grid;
    gap: 2.15rem;
    padding: 2.35rem;
}

.settings-form h2 {
    margin: 0;
}

.muted-text,
.admin-note {
    color: var(--muted);
}

.admin-note {
    padding: .75rem 1rem;
    border: 1px solid rgba(168, 105, 255, .35);
    border-radius: 8px;
    background: rgba(139, 69, 255, .12);
}

label {
    display: grid;
    gap: .75rem;
    color: var(--text);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 3.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    padding: 0 1rem;
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(168, 105, 255, .52);
    border-color: var(--accent);
}

textarea {
    min-height: 7rem;
    padding: 1rem;
    resize: vertical;
}

.toggle-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.8rem;
    padding: 1.7rem 1.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
}

.toggle-line input {
    appearance: none;
    width: 3.25rem;
    min-height: 1.75rem;
    position: relative;
    border: 1px solid rgba(185, 140, 255, .24);
    border-radius: 999px;
    background: rgba(15, 7, 24, .88);
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.toggle-line input::before {
    content: "";
    position: absolute;
    top: .22rem;
    left: .22rem;
    width: 1.18rem;
    height: 1.18rem;
    border-radius: 999px;
    background: #b8a6ce;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
    transition: transform .18s ease, background .18s ease;
}

.toggle-line input:checked {
    border-color: rgba(168, 105, 255, .7);
    background: linear-gradient(135deg, var(--accent-deep), var(--accent-strong));
    box-shadow: 0 0 0 3px rgba(168, 105, 255, .13);
}

.toggle-line input:checked::before {
    transform: translateX(1.48rem);
    background: #fff;
}

.toggle-line input:focus-visible {
    outline: 2px solid rgba(168, 105, 255, .52);
    outline-offset: 3px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.9rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.25rem;
    padding-top: .4rem;
}

.notice {
    margin: 1rem 0;
    padding: .85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.notice.success {
    border-color: rgba(185, 140, 255, .38);
    background: rgba(139, 69, 255, .12);
}

.danger-note {
    border-color: rgba(239, 71, 111, .35);
    background: rgba(239, 71, 111, .1);
    color: #ffb3c2;
}

.tabs {
    display: grid;
    gap: 2.45rem;
}

.tab-list {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .45rem;
    margin: 1.15rem 0 1.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
}

.tab-button {
    min-height: 2.65rem;
    padding: 0 1.15rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.tab-button:hover,
.tab-button.active {
    background: var(--panel-soft);
    color: var(--text);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.settings-form > .tab-panel.active {
    display: grid;
    gap: 2.1rem;
}

.settings-form > .tab-panel.active > label,
.settings-form > .tab-panel.active > .form-grid,
.settings-form > .tab-panel.active > .toggle-line {
    margin: 0;
}

.settings-form > .tab-panel.active .form-grid {
    gap: 2rem;
}

.tab-panel .settings-form,
.tab-panel .table-panel {
    margin-top: .8rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.55rem;
    margin: 3rem 0;
}

.dashboard-stats,
.stats:has(div:nth-child(4)) {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.1rem;
}

.mini-grid div {
    display: grid;
    gap: .25rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.mini-grid span {
    color: var(--muted);
}

.stats div {
    padding: 1.4rem;
}

.stats strong {
    display: block;
    font-size: 2rem;
}

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

.table-panel {
    padding: 1.7rem;
    overflow-x: auto;
}

.table-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 190px 100px 130px;
    gap: 1.15rem;
    padding: 1rem .9rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.table-row.admin {
    grid-template-columns: minmax(170px, 1fr) 190px 140px 180px 280px;
}

.table-row.banned {
    grid-template-columns: minmax(160px, 1fr) 190px minmax(160px, 1fr) 160px 130px;
}

.table-row.staff {
    grid-template-columns: 190px 120px minmax(180px, 1fr) 160px 130px;
}

.table-row.head {
    border-top: 0;
    color: var(--text);
    font-weight: 800;
}

.empty {
    margin-top: 2rem;
    padding: 2rem;
}

.legal-page .settings-form {
    line-height: 1.75;
}

.legal-card h2 {
    margin-top: .35rem;
}

.legal-card p {
    margin: 0;
    color: var(--muted);
}

.site-footer {
    display: flex;
    justify-content: center;
    gap: 1.4rem;
    padding: 2rem 1rem 3rem;
    color: var(--muted);
}

.site-footer a:hover {
    color: var(--text);
}

.empty-inline {
    padding: 1rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1.25rem;
    align-items: end;
}

.action-stack {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
}

.action-stack.roomy {
    gap: .85rem;
}

.action-stack form,
.table-row form {
    margin: 0;
}

.support-card {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.support-card p {
    margin: 0;
    color: var(--text);
    line-height: 1.6;
}

.support-meta {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    color: var(--muted);
}

.support-meta strong {
    color: var(--text);
}

.support-reply {
    display: grid;
    gap: .75rem;
}

@media (max-width: 760px) {
    .hero,
    .form-grid,
    .stats {
        grid-template-columns: 1fr;
    }

    .topbar,
    nav {
        flex-wrap: wrap;
    }

    .table-row {
        grid-template-columns: minmax(180px, 1fr) 170px 90px 120px;
    }

    .table-row.admin,
    .table-row.banned,
    .table-row.staff {
        grid-template-columns: minmax(180px, 1fr) 180px 130px 160px 240px;
    }

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