:root {
    --bg: #f7f4ff;
    --surface: #ffffff;
    --surface-raised: #fbf9ff;
    --border: #e6dffb;
    --text: #241b3a;
    --muted: #6e6488;
    --accent: #a78bfa;
    --accent-strong: #7c5ce0;
    --accent-soft: #efe8ff;
    --accent-text: #ffffff;
    --locked: #b7aecb;
    --danger-soft: #fdecef;
    --danger-text: #9b1c3a;
    --shadow: 0 1px 2px rgb(60 30 120 / 0.06), 0 8px 24px rgb(60 30 120 / 0.06);
    --shadow-hover: 0 2px 4px rgb(60 30 120 / 0.08), 0 14px 32px rgb(90 50 180 / 0.14);
    --radius: 16px;
    --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #131019;
        --surface: #1c1726;
        --surface-raised: #221c2e;
        --border: #312842;
        --text: #efe9ff;
        --muted: #a79dc2;
        --accent: #b9a2ff;
        --accent-strong: #a78bfa;
        --accent-soft: #2a2140;
        --accent-text: #160f24;
        --locked: #5c5370;
        --danger-soft: #3a1622;
        --danger-text: #ffb3c4;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
        --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.35), 0 14px 32px rgb(120 80 230 / 0.18);
    }
}

* {
    box-sizing: border-box;
}

/* Elements styled with display (like .account) would otherwise ignore the hidden attribute */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: inherit;
}

button {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px max(16px, calc((100vw - 1120px) / 2));
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--surface) 30%, transparent);
}

.account {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-soft);
    flex-shrink: 0;
}

.account-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.15s,
        border-color 0.15s,
        transform 0.1s;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    background: var(--accent-strong);
    color: var(--accent-text); /* white on the darker light-mode purple, near-black on the lighter dark-mode one */
}

.button-primary:hover {
    background: color-mix(in srgb, var(--accent-strong) 88%, #000000);
}

.button-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.button-ghost:hover {
    background: var(--accent-soft);
}

.button-danger {
    background: #d93855;
    color: #ffffff;
}

.button-danger:hover {
    background: #bf2b47;
}

.button-danger-ghost {
    background: transparent;
    border-color: color-mix(in srgb, var(--danger-text) 45%, transparent);
    color: var(--danger-text);
}

.button-danger-ghost:hover {
    background: var(--danger-soft);
}

.button-large {
    padding: 12px 22px;
    font-size: 1.05rem;
}

/* ---------- Page ---------- */

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 16px 64px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.page-title {
    margin: 0;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.page-header > :first-child {
    flex: 1 1 320px;
}

.toolbar {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
    align-items: center;
}

.search {
    width: min(220px, 100%);
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.search::placeholder {
    color: var(--muted);
}

.banner {
    max-width: 1120px;
    margin: 16px auto 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--danger-soft);
    color: var(--danger-text);
    font-weight: 500;
}

@media (max-width: 1152px) {
    .banner {
        margin: 16px 16px 0;
    }
}

/* ---------- Server picker ---------- */

.section-label {
    margin: 32px 0 14px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-label:first-child {
    margin-top: 0;
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.server {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 22px 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 0.15s,
        box-shadow 0.15s,
        border-color 0.15s;
}

.server:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
}

.server-icon-wrap {
    position: relative;
}

.server-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 24px;
    object-fit: cover;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    transition:
        filter 0.2s,
        opacity 0.2s,
        border-radius 0.2s;
}

.server:hover .server-icon {
    border-radius: 20px;
}

.server-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
    word-break: break-word;
}

.server-status {
    margin-top: -6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-strong);
}

/* Bot not added: greyed out and locked */
.server.locked {
    background: var(--surface-raised);
    box-shadow: none;
}

.server.locked .server-icon {
    filter: grayscale(1);
    opacity: 0.45;
}

.server.locked .server-name {
    color: var(--muted);
}

.server.locked .server-status {
    color: var(--muted);
}

.server.locked:hover .server-icon {
    opacity: 0.7;
}

.lock-badge {
    position: absolute;
    right: -6px;
    bottom: -6px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 3px solid var(--surface-raised);
    border-radius: 50%;
    background: var(--locked);
    color: #ffffff;
}

.lock-badge svg {
    width: 13px;
    height: 13px;
}

/* Initials avatars for servers without an icon */
.hue-0 {
    background: #8b5cf6;
}
.hue-1 {
    background: #a855f7;
}
.hue-2 {
    background: #6366f1;
}
.hue-3 {
    background: #c084fc;
}
.hue-4 {
    background: #7c3aed;
}
.hue-5 {
    background: #9333ea;
}

/* Loading placeholders */
.server.skeleton {
    cursor: default;
    pointer-events: none;
}

.skeleton .server-icon,
.skeleton .server-name {
    background: var(--accent-soft);
    animation: pulse 1.4s ease-in-out infinite;
}

.skeleton .server-name {
    width: 70%;
    height: 1em;
    border-radius: 6px;
}

@keyframes pulse {
    50% {
        opacity: 0.5;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Empty / logged out ---------- */

.hero {
    max-width: 520px;
    margin: 48px auto;
    padding: 40px 28px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.hero-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.hero h1 {
    margin: 0 0 8px;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
}

.hero p {
    margin: 0 0 24px;
    color: var(--muted);
}

.empty {
    padding: 32px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

/* ---------- Server page (temporary) ---------- */

.server-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent-strong);
}

.card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* ---------- Invite dialog ---------- */

.dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-hover);
}

.dialog::backdrop {
    background: rgb(20 10 40 / 0.45);
    backdrop-filter: blur(3px);
}

.dialog-body {
    padding: 28px 24px 22px;
    text-align: center;
}

.dialog-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.dialog-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.dialog-text {
    margin: 0 0 22px;
    color: var(--muted);
}

.dialog-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

@media (max-width: 480px) {
    .account-name {
        display: none;
    }

    .toolbar {
        flex: 1 1 100%;
    }

    .search {
        flex: 1;
        width: auto;
    }

    .server-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
}

/* ---------- Server layout with sidebar ---------- */

.page-wide {
    max-width: 1280px;
}

.server-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    padding: 18px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.sidebar .back-link {
    margin: 0 0 14px 8px;
    font-size: 0.9rem;
}

.sidebar-server {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-server .server-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-server-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-group {
    margin-top: 14px;
}

.sidebar-heading {
    margin: 0 8px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.sidebar-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 500;
    text-decoration: none;
}

a.sidebar-link:hover {
    background: var(--accent-soft);
}

.sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--accent-strong);
}

.sidebar-link-soon {
    color: var(--muted);
    cursor: default;
}

.soon-pill {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.server-content {
    min-width: 0;
    padding-bottom: 96px; /* room for the save bar */
}

.section-header {
    margin-bottom: 24px;
}

.loading {
    padding: 24px 0;
}

@media (max-width: 900px) {
    .server-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    /* Sidebar becomes a horizontal, scrollable strip */
    .sidebar {
        position: static;
        max-height: none;
        padding: 12px;
    }

    .sidebar-nav {
        display: flex;
        gap: 18px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .sidebar-group {
        flex-shrink: 0;
        margin-top: 4px;
    }

    .sidebar-list {
        display: flex;
        gap: 4px;
    }

    .sidebar-link {
        white-space: nowrap;
    }
}

/* ---------- Settings cards and fields ---------- */

.settings-card {
    margin-bottom: 18px;
}

.card-title {
    margin: 0;
    font-size: 1.1rem;
}

.card-description {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.field,
.log-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.card-title + .field,
.card-title + .log-row,
.card-description + .field,
.card-description + .log-row,
.card-description + .rewards {
    margin-top: 14px;
}

.field-stacked {
    flex-direction: column;
    align-items: stretch;
}

.field-text {
    flex: 1 1 260px;
    min-width: 0;
}

.field-label {
    font-weight: 600;
}

.field-description {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.field-control {
    flex: 0 1 auto;
    min-width: 0;
}

.field-stacked .field-text {
    flex: 0 0 auto; /* in a column, the row layout's 260px basis would become a height */
}

.field-stacked .field-control {
    width: 100%;
}

.log-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* ---------- Inputs ---------- */

.select,
.input {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.select {
    min-width: 220px;
    max-width: 100%;
}

.select-small {
    min-width: 180px;
}

.select:focus,
.input:focus {
    border-color: var(--accent);
}

.input-number {
    width: 110px;
}

.input:invalid {
    border-color: #e5484d;
}

.input-suffix-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.input-suffix {
    color: var(--muted);
}

.textarea-wrap {
    position: relative;
}

.textarea {
    width: 100%;
    resize: vertical;
    min-height: 84px;
}

.counter {
    position: absolute;
    right: 10px;
    bottom: 8px;
    color: var(--muted);
    font-size: 0.8rem;
    pointer-events: none;
}

/* Toggle switch: a real checkbox styled as a switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.toggle-input:disabled {
    cursor: not-allowed;
}

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--locked);
    transition: background 0.15s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
    transition: transform 0.15s;
}

.toggle-input:checked + .toggle-track {
    background: var(--accent-strong);
}

.toggle-input:checked + .toggle-track::after {
    transform: translateX(20px);
}

.toggle-input:disabled + .toggle-track {
    opacity: 0.45;
}

.toggle-input:focus-visible + .toggle-track {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ---------- Chips ---------- */

.chips-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.9rem;
}

.chip-remove {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.chip-remove:hover {
    background: color-mix(in srgb, var(--accent-strong) 18%, transparent);
}

.chip-remove svg {
    width: 12px;
    height: 12px;
}

.chips-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ---------- Level rewards ---------- */

.rewards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding-bottom: 14px;
}

.reward-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.reward-label {
    color: var(--muted);
    font-weight: 600;
}

.button-small {
    padding: 7px 12px;
    font-size: 0.9rem;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---------- Save bar ---------- */

.savebar {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 20;
    width: min(760px, calc(100vw - 32px));
    transform: translateX(-50%);
    animation: rise 0.2s ease-out;
}

.savebar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 16px 14px 20px;
    border: 1px solid var(--accent);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-hover);
}

.savebar-message {
    font-weight: 600;
}

.savebar-errors {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--danger-text);
    font-size: 0.9rem;
}

.savebar-errors:empty {
    display: none;
}

.savebar-has-errors .savebar-inner {
    border-color: var(--danger-text);
}

.savebar-actions {
    display: flex;
    gap: 10px;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translate(-50%, 12px);
    }
}

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    top: 76px;
    right: 16px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--accent-strong);
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--shadow-hover);
    animation: fade-in 0.2s ease-out;
}

.toast-error {
    background: var(--danger-text);
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
}

@media (max-width: 600px) {
    .log-controls {
        width: 100%;
        justify-content: space-between;
    }

    .select {
        min-width: 0;
        flex: 1;
    }
}

/* ---------- Reset card ---------- */

.reset-card {
    border-color: color-mix(in srgb, var(--danger-text) 30%, var(--border));
}

.reset-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.reset-row .card-description {
    margin-bottom: 0;
}

/* ---------- Bot Settings ---------- */

/* Preview shaped like a Discord profile card */
.profile-card {
    max-width: 360px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-raised);
}

.profile-banner {
    height: 120px;
    background: var(--accent-soft);
}

.profile-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-banner-empty {
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.profile-content {
    padding: 0 16px 16px;
}

.profile-avatar {
    display: block;
    width: 80px;
    height: 80px;
    margin-top: -40px;
    margin-bottom: 8px;
    border: 5px solid var(--surface-raised);
    border-radius: 50%;
    background: var(--surface-raised);
    object-fit: cover;
}

.profile-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.profile-name {
    font-weight: 700;
    font-size: 1.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-bio {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bot-preview-tag {
    padding: 0 5px;
    border-radius: 4px;
    background: var(--accent-strong);
    color: var(--accent-text);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.5;
}

.bot-preview-username {
    color: var(--muted);
    font-size: 0.85rem;
}

.image-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.input-counter-wrap {
    position: relative;
    flex: 1 1 260px;
}

.input-wide {
    width: 100%;
    padding-right: 56px;
}

.input-counter {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.input-counter-over {
    color: #e5484d;
}

.notice {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, #f5a524 45%, transparent);
    background: color-mix(in srgb, #f5a524 12%, transparent);
    font-size: 0.92rem;
}

.colour-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.colour-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.colour-input {
    width: 44px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
}

.colour-value {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    color: var(--muted);
}

/* A Discord embed, to preview the colour */
.embed-preview {
    max-width: 420px;
    padding: 10px 14px;
    border-left: 4px solid;
    border-radius: 4px;
    background: var(--surface-raised);
    font-size: 0.9rem;
}

.embed-preview-title {
    margin-bottom: 6px;
    font-weight: 700;
}

.embed-preview-field {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
}

/* ---------- Welcome & Goodbye ---------- */

.placeholder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.placeholder-chip {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--text);
    font: inherit;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8rem;
    cursor: pointer;
}

.placeholder-chip:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.preview-label {
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Shaped like a message in Discord */
.preview-message {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-raised);
}

.preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.preview-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-name {
    font-weight: 700;
}

.preview-text,
.preview-embed-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.preview-mention {
    padding: 0 3px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--accent-strong);
    font-weight: 600;
}

.preview-embed {
    display: flex;
    gap: 12px;
    max-width: 440px;
    padding: 10px 14px;
    border-left: 4px solid;
    border-radius: 4px;
    background: var(--surface);
    font-size: 0.92rem;
}

.preview-embed-text {
    flex: 1;
    min-width: 0;
}

.preview-embed-title {
    margin-bottom: 6px;
    font-weight: 700;
}

.preview-embed-thumb {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    flex-shrink: 0;
}

/* ---------- Ticket types ---------- */

.ticket-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.type-card {
    position: relative;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-raised);
}

.type-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.type-label {
    flex: 1 1 180px;
    min-width: 0;
}

.type-colour.select {
    flex: 0 0 120px;
    width: 120px;
    min-width: 0;
}

.type-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.icon-button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.icon-button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--text);
}

.icon-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.emoji-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font-size: 1.2rem;
    cursor: pointer;
}

.emoji-button:hover {
    border-color: var(--accent);
}

.emoji-placeholder {
    color: var(--muted);
    font-size: 1rem;
}

.emoji-image {
    width: 1.3em;
    height: 1.3em;
    object-fit: contain;
    vertical-align: -0.25em;
}

.emoji-picker {
    position: absolute;
    z-index: 15;
    top: 56px;
    left: 12px;
    width: min(340px, calc(100% - 24px));
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
}

.emoji-picker-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.emoji-input {
    flex: 1;
    min-width: 0;
}

.emoji-picker-heading {
    margin: 8px 0 4px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 2px;
    max-height: 170px;
    overflow-y: auto;
}

.emoji-choice {
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
}

.emoji-choice:hover {
    background: var(--accent-soft);
}

.type-details {
    margin-top: 10px;
}

.type-details summary {
    color: var(--accent-strong);
    font-weight: 600;
    cursor: pointer;
}

.type-details[open] summary {
    margin-bottom: 6px;
}

.ticket-types-add .select {
    width: auto;
}

/* Panel preview: buttons in Discord's colours */
.preview-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.preview-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    background: #5865f2;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
}

.preview-button-secondary {
    background: #4e5058;
}

.preview-button-success {
    background: #248046;
}

.preview-button-danger {
    background: #da373c;
}

.preview-embed-list {
    margin-top: 8px;
}

/* ---------- Stream notifications ---------- */

.stream-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.stream-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-soft);
    flex-shrink: 0;
    object-fit: cover;
}

.stream-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 160px;
}

.stream-name a {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.stream-name a:hover {
    color: var(--accent-strong);
}

.stream-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Web Logs ---------- */

.section-header-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.section-header-actions > .button {
    flex-shrink: 0;
}

.audit-card {
    padding: 0;
    overflow: hidden;
}

.audit-scroll {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.audit-table th {
    padding: 14px 16px 12px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.audit-table th > span {
    display: block;
    margin-bottom: 8px;
}

.audit-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.audit-table tbody tr:last-child td {
    border-bottom: 0;
}

.audit-table tbody tr:hover td {
    background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.col-executed {
    width: 150px;
    white-space: nowrap;
    color: var(--muted);
}

.col-user {
    width: 260px;
}

.search-column {
    width: 100%;
    padding: 7px 12px;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

.audit-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.audit-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    flex-shrink: 0;
}

.audit-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-username {
    color: var(--muted);
    font-size: 0.85rem;
}

.audit-action {
    font-weight: 600;
}

.audit-action-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.audit-source {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.audit-source-command {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-weight: 500;
    background: var(--surface-raised);
    color: var(--muted);
    border: 1px solid var(--border);
}

.audit-changes {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.audit-changes li {
    margin: 2px 0;
}

.audit-status {
    margin: 0;
    padding: 24px 16px;
    color: var(--muted);
    text-align: center;
}

.audit-status:empty {
    display: none;
}

.audit-more {
    display: flex;
    justify-content: center;
    padding: 0 16px 16px;
}

.audit-more:has(> [hidden]) {
    display: none;
}

/* Phones: each entry becomes a small card; the search boxes stay at the top */
@media (max-width: 700px) {
    .audit-table,
    .audit-table thead,
    .audit-table tbody,
    .audit-table tr,
    .audit-table th,
    .audit-table td {
        display: block;
        width: 100%;
    }

    .audit-table thead tr {
        display: grid;
        gap: 4px;
        padding: 8px 0;
        background: var(--surface-raised);
        border-bottom: 1px solid var(--border);
    }

    .audit-table th {
        padding: 6px 16px;
        border: 0;
    }

    .audit-table th.col-executed {
        display: none;
    }

    .audit-table th > span {
        margin-bottom: 4px;
    }

    .audit-table tbody tr {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .audit-table td {
        padding: 4px 0;
        border: 0;
    }

    .col-executed {
        font-size: 0.85rem;
    }
}

/* ---------- Top bar links (logged out) ---------- */

.topnav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topnav-link {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.topnav-link:hover {
    color: var(--text);
    background: var(--accent-soft);
}

@media (max-width: 560px) {
    .topnav-link {
        display: none;
    }
}

/* ---------- Landing page ---------- */

.landing-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: 56px;
    padding: 32px 0 72px;
}

.eyebrow {
    display: inline-block;
    margin: 0 0 18px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.landing-title {
    margin: 0 0 18px;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.accent-text {
    background: linear-gradient(120deg, var(--accent), var(--accent-strong));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.landing-lead {
    max-width: 34em;
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 1.15rem;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.landing-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 36px;
    margin: 36px 0 0;
    padding: 0;
    list-style: none;
}

.landing-stats li {
    display: flex;
    flex-direction: column;
}

.landing-stats strong {
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.landing-stats span {
    color: var(--muted);
    font-size: 0.9rem;
}

/* The pretend Discord channel */

.landing-preview {
    position: relative;
    isolation: isolate;
}

.landing-preview::before {
    content: '';
    position: absolute;
    inset: -10% -12px; /* sideways, stays inside the 16px page gutter so phones don't scroll sideways */
    z-index: -1;
    border-radius: 40%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 35%, transparent), transparent);
    filter: blur(20px);
}

.mock-window {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-hover);
    transform: rotate(1deg);
}

.mock-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-raised);
}

.mock-dots,
.mock-dots::before,
.mock-dots::after {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.mock-dots {
    position: relative;
    margin-left: 16px;
}

.mock-dots::before,
.mock-dots::after {
    content: '';
    position: absolute;
    top: 0;
}

.mock-dots::before {
    left: -16px;
}

.mock-dots::after {
    left: 16px;
}

.mock-channel {
    margin-left: 14px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.mock-body {
    display: grid;
    gap: 18px;
    padding: 18px 18px 22px;
}

.mock-message {
    display: flex;
    gap: 12px;
}

.mock-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

.mock-content {
    min-width: 0;
    flex: 1;
}

.mock-author {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.mock-name {
    font-weight: 700;
    color: var(--accent-strong);
}

.mock-tag {
    padding: 0 5px;
    border-radius: 4px;
    background: var(--accent-strong);
    color: var(--accent-text);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.5;
}

.mock-time {
    color: var(--muted);
    font-size: 0.75rem;
}

.mock-text {
    margin: 0 0 8px;
}

.mock-embed {
    display: grid;
    gap: 2px;
    padding: 10px 14px;
    border-left: 4px solid var(--accent-strong);
    border-radius: 6px;
    background: var(--surface-raised);
    box-shadow: inset 0 0 0 1px var(--border);
}

.mock-embed p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.mock-embed-live {
    border-left-color: #9146ff;
}

.mock-live {
    justify-self: start;
    padding: 0 6px;
    border-radius: 4px;
    background: #e5354f;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.mock-progress {
    height: 8px;
    max-width: 240px;
    border-radius: 999px;
    background: var(--accent-soft);
}

.mock-progress span {
    display: block;
    width: 68%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.mock-button {
    display: inline-block;
    margin-top: 8px;
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--border);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Sections */

.landing-section {
    padding: 56px 0;
    scroll-margin-top: 72px;
}

.landing-heading {
    margin: 0 0 10px;
    font-size: clamp(1.6rem, 3.2vw, 2.2rem);
    letter-spacing: -0.025em;
    text-align: center;
}

.landing-subheading {
    max-width: 36em;
    margin: 0 auto 36px;
    color: var(--muted);
    text-align: center;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.feature-card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-card h3,
.step h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.feature-card p,
.step p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
}

.step {
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.step-number {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    font-weight: 800;
}

.landing-cta {
    margin: 56px 0 0;
    padding: 48px 28px;
    border-radius: 28px;
    background: linear-gradient(135deg, #a78bfa, #7c5ce0 60%, #6a48d4);
    color: #ffffff;
    text-align: center;
}

.landing-cta h2 {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    letter-spacing: -0.02em;
}

.landing-cta p {
    margin: 0 0 26px;
    opacity: 0.9;
}

.landing-cta .landing-actions {
    justify-content: center;
}

.button-light {
    background: #ffffff;
    color: #4b2fb0;
}

.button-light:hover {
    background: #f1ecff;
}

.button-outline-light {
    border-color: rgb(255 255 255 / 0.6);
    color: #ffffff;
}

.button-outline-light:hover {
    background: rgb(255 255 255 / 0.12);
}

@media (max-width: 900px) {
    .landing-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
        padding-top: 8px;
    }

    .mock-window {
        transform: none;
    }

    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .steps {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .feature-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 480px) {
    .landing-actions .button {
        flex: 1 1 100%;
    }
}

/* ---------- Legal pages ---------- */

.legal {
    max-width: 720px;
    margin: 0 auto;
}

.legal-updated {
    margin: 6px 0 24px;
    color: var(--muted);
}

.legal-intro {
    font-size: 1.08rem;
}

.legal h2 {
    margin: 32px 0 8px;
    font-size: 1.2rem;
}

.legal p,
.legal li {
    color: color-mix(in srgb, var(--text) 85%, var(--muted));
}

.legal a {
    color: var(--accent-strong);
    font-weight: 600;
}

.legal-closing {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.legal-signoff {
    font-weight: 700;
}

/* ---------- Footer ---------- */

/* Keeps the footer at the bottom of short pages */
body {
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1 0 auto;
    width: 100%;
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 24px max(16px, calc((100vw - 1120px) / 2));
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--accent-strong);
}
