:root {
    color-scheme: dark;

    --background: #080912;
    --surface: rgba(20, 22, 39, 0.88);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text: #f7f7fb;
    --text-muted: #a9adbd;
    --primary: #5865f2;
    --primary-hover: #6d78f5;
    --accent: #bd75ff;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background:
        radial-gradient(
            circle at 15% 20%,
            rgba(88, 101, 242, 0.22),
            transparent 35%
        ),
        radial-gradient(
            circle at 85% 80%,
            rgba(189, 117, 255, 0.18),
            transparent 35%
        ),
        var(--background);
}

button,
input,
textarea,
select {
    font: inherit;
}

.welcome-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.welcome-card {
    width: min(100%, 620px);
    padding: 56px 44px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
}

.brand-mark {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 28px;
    place-items: center;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(88, 101, 242, 0.35);
}

.eyebrow {
    margin: 0 0 12px;
    color: #bfc3ff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(34px, 6vw, 54px);
    line-height: 1.08;
}

.welcome-text {
    max-width: 510px;
    margin: 24px auto 32px;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1.65;
}

.discord-login {
    display: inline-flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 26px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    background: var(--primary);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(88, 101, 242, 0.3);
    transition:
        transform 160ms ease,
        background-color 160ms ease;
}

.discord-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.discord-login:active {
    transform: translateY(0);
}

.discord-icon {
    font-size: 21px;
}

.login-note {
    margin: 18px 0 0;
    color: #777c91;
    font-size: 13px;
}

@media (max-width: 600px) {
    .welcome-card {
        padding: 42px 24px;
        border-radius: 22px;
    }

    .discord-login {
        width: 100%;
    }
}

/* TIMelessVibes Dashboard */

.discord-login {
    text-decoration: none;
}

.dashboard-header {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px clamp(20px, 5vw, 72px);
    background: rgba(8, 9, 18, 0.86);
    border-bottom: 1px solid var(--surface-border);
    backdrop-filter: blur(18px);
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.dashboard-brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    font-weight: 800;
    background: linear-gradient(
        135deg,
        var(--primary),
        var(--accent)
    );
    border-radius: 13px;
}

.dashboard-brand strong,
.dashboard-brand small {
    display: block;
}

.dashboard-brand small,
.user-details small {
    margin-top: 3px;
    color: var(--text-muted);
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.logout-button,
.refresh-button,
.server-select-button {
    min-height: 42px;
    padding: 0 17px;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--surface-border);
    border-radius: 11px;
}

.logout-button:hover,
.refresh-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.dashboard-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 64px 0;
}

.dashboard-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}

.dashboard-intro h1 {
    margin-bottom: 12px;
}

.dashboard-intro p:not(.eyebrow) {
    max-width: 690px;
    margin: 0;
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1.6;
}

.refresh-button {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.server-status {
    margin: 18px 0;
    color: var(--text-muted);
}

.selected-server {
    margin: 22px 0;
    padding: 16px 18px;
    color: #dfe2ff;
    font-weight: 700;
    background: rgba(88, 101, 242, 0.15);
    border: 1px solid rgba(88, 101, 242, 0.35);
    border-radius: 13px;
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(min(100%, 320px), 1fr)
    );
    gap: 18px;
}

.server-card {
    display: flex;
    gap: 18px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.server-icon {
    display: grid;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    place-items: center;
    overflow: hidden;
    font-size: 18px;
    font-weight: 800;
    background: rgba(88, 101, 242, 0.2);
    border-radius: 18px;
}

.server-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.server-card-content {
    min-width: 0;
    flex: 1;
}

.server-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.server-title-row h2 {
    overflow: hidden;
    margin: 2px 0 8px;
    font-size: 19px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-card-content p {
    overflow: hidden;
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.owner-badge {
    padding: 4px 7px;
    color: #e2c7ff;
    font-size: 11px;
    font-weight: 800;
    background: rgba(189, 117, 255, 0.15);
    border-radius: 7px;
}

.server-select-button {
    width: 100%;
    color: white;
    background: var(--primary);
    border-color: transparent;
}

.server-select-button:hover,
.server-select-button.selected {
    background: var(--primary-hover);
}

@media (max-width: 760px) {
    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-user {
        width: 100%;
    }

    .dashboard-user form {
        margin-left: auto;
    }

    .user-details small {
        display: none;
    }

    .dashboard-intro {
        align-items: stretch;
        flex-direction: column;
    }

    .refresh-button {
        justify-content: center;
    }

    .dashboard-main {
        padding-top: 40px;
    }
}

@media (max-width: 480px) {
    .dashboard-brand small {
        display: none;
    }

    .user-details {
        max-width: 110px;
    }

    .user-details strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .logout-button {
        padding: 0 12px;
    }

    .server-card {
        padding: 18px;
    }
}

/* Server overview modules */

.back-link {
    display: inline-flex;
    margin-bottom: 28px;
    color: #bfc3ff;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    color: white;
}

.server-overview-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
}

.server-overview-header h1 {
    margin-bottom: 10px;
}

.server-overview-header p:not(.eyebrow) {
    margin: 0;
    color: var(--text-muted);
}

.server-overview-icon {
    display: grid;
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    place-items: center;
    overflow: hidden;
    font-size: 25px;
    font-weight: 800;
    background: linear-gradient(
        135deg,
        rgba(88, 101, 242, 0.85),
        rgba(189, 117, 255, 0.85)
    );
    border-radius: 26px;
    box-shadow: 0 18px 42px rgba(88, 101, 242, 0.24);
}

.server-overview-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 290px), 1fr)
    );
    gap: 20px;
    margin-top: 26px;
}

.module-card {
    position: relative;
    display: flex;
    min-height: 300px;
    flex-direction: column;
    gap: 18px;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.module-card-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
    background: rgba(88, 101, 242, 0.17);
    border-radius: 15px;
}

.module-card h2 {
    margin: 0 0 10px;
    font-size: 22px;
}

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

.module-badge {
    align-self: flex-start;
    padding: 6px 9px;
    color: #e2c7ff;
    font-size: 11px;
    font-weight: 800;
    background: rgba(189, 117, 255, 0.14);
    border-radius: 8px;
}

.module-button {
    min-height: 44px;
    margin-top: auto;
    padding: 0 16px;
    color: #8d91a3;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--surface-border);
    border-radius: 11px;
}

.module-button:disabled {
    cursor: not-allowed;
    opacity: 0.75;
}

@media (max-width: 600px) {
    .server-overview-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .server-overview-icon {
        width: 76px;
        height: 76px;
        flex-basis: 76px;
        border-radius: 21px;
    }
}

/* Ticket settings page */

.module-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    background: var(--primary);
    border-color: transparent;
}

.module-link-button:hover {
    background: var(--primary-hover);
}

.settings-main {
    max-width: 980px;
}

.settings-heading {
    margin-bottom: 28px;
}

.settings-heading h1 {
    margin-bottom: 10px;
}

.settings-heading p:not(.eyebrow) {
    margin: 0;
    color: var(--text-muted);
    font-size: 17px;
}

.settings-form {
    display: grid;
    gap: 20px;
}

.settings-card {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
}

.settings-card-heading {
    margin-bottom: 24px;
}

.settings-card-heading h2 {
    margin: 0 0 8px;
    font-size: 23px;
}

.settings-card-heading p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.number-field {
    display: grid;
    max-width: 330px;
    gap: 9px;
}

.number-field > span {
    font-weight: 700;
}

.number-field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--surface-border);
    border-radius: 11px;
    outline: none;
}

.number-field input:focus {
    border-color: rgba(88, 101, 242, 0.8);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.14);
}

.number-field small,
.toggle-row small {
    color: var(--text-muted);
}

.toggle-row {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
    cursor: pointer;
    border-bottom: 1px solid var(--surface-border);
}

.toggle-row:last-child {
    border-bottom: 0;
}

.toggle-row > span:first-child {
    display: grid;
    gap: 6px;
}

.toggle-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-switch {
    position: relative;
    flex: 0 0 52px;
    width: 52px;
    height: 29px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    transition: background-color 160ms ease;
}

.toggle-switch::after {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 21px;
    height: 21px;
    content: "";
    background: white;
    border-radius: 50%;
    transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-switch {
    background: var(--primary);
}

.toggle-row input:checked + .toggle-switch::after {
    transform: translateX(23px);
}

.settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
}

#settings-save-state {
    color: var(--text-muted);
    font-size: 14px;
}

.primary-action-button {
    min-height: 48px;
    padding: 0 22px;
    color: white;
    font-weight: 800;
    cursor: pointer;
    background: var(--primary);
    border: 0;
    border-radius: 12px;
}

.primary-action-button:hover {
    background: var(--primary-hover);
}

.primary-action-button:disabled {
    cursor: wait;
    opacity: 0.7;
}

.settings-message {
    margin-bottom: 20px;
    padding: 15px 17px;
    font-weight: 700;
    border-radius: 12px;
}

.settings-message-success {
    color: #baf5d3;
    background: rgba(50, 190, 110, 0.13);
    border: 1px solid rgba(50, 190, 110, 0.28);
}

.settings-message-error {
    color: #ffc1c1;
    background: rgba(235, 75, 75, 0.13);
    border: 1px solid rgba(235, 75, 75, 0.28);
}

@media (max-width: 600px) {
    .settings-card {
        padding: 22px 18px;
    }

    .toggle-row {
        align-items: flex-start;
    }

    .settings-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-action-button {
        width: 100%;
    }
}

/* Discord resource selectors */

.role-picker {
    display: grid;
    gap: 12px;
}

.role-picker > label,
.select-field > span {
    font-weight: 750;
}

.resource-search,
.select-field select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--surface-border);
    border-radius: 11px;
    outline: none;
}

.resource-search:focus,
.select-field select:focus {
    border-color: rgba(88, 101, 242, 0.8);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.14);
}

.select-field select option {
    color: #10111a;
}

.selected-resource-list {
    display: flex;
    min-height: 38px;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.selected-resource-chip {
    padding: 8px 11px;
    color: #ebeaff;
    font-weight: 700;
    cursor: pointer;
    background: rgba(88, 101, 242, 0.2);
    border: 1px solid rgba(125, 135, 255, 0.35);
    border-radius: 9px;
}

.selected-resource-chip:hover {
    background: rgba(211, 75, 75, 0.18);
    border-color: rgba(235, 95, 95, 0.35);
}

.resource-results {
    display: grid;
    max-height: 310px;
    gap: 7px;
    overflow-y: auto;
}

.resource-result {
    display: flex;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 13px;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
}

.resource-result:hover {
    background: rgba(88, 101, 242, 0.11);
    border-color: rgba(88, 101, 242, 0.3);
}

.resource-result-selected {
    background: rgba(88, 101, 242, 0.17);
    border-color: rgba(125, 135, 255, 0.43);
}

.resource-result > span:first-child {
    display: grid;
    gap: 4px;
}

.resource-result small,
.select-field small,
.resource-empty {
    color: var(--text-muted);
}

.resource-result-state {
    color: #c5c8ff;
    font-size: 12px;
    font-weight: 800;
}

.resource-empty {
    margin: 0;
    font-size: 14px;
}

.settings-select-grid {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: 20px;
}

.select-field {
    display: grid;
    gap: 9px;
}

@media (max-width: 700px) {
    .settings-select-grid {
        grid-template-columns: 1fr;
    }

    .resource-result {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Panel overview page */

.panel-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.panel-page-heading h1 {
    margin-bottom: 10px;
}

.panel-page-heading p:not(.eyebrow) {
    margin: 0;
    color: var(--text-muted);
}

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

.panel-feature {
    display: grid;
    gap: 5px;
    padding: 17px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
}

.panel-feature span {
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 700px) {
    .panel-page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .panel-feature-grid {
        grid-template-columns: 1fr;
    }
}

/* Ticket panel editor */

.panel-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.ticket-panel-list {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 320px), 1fr)
    );
    gap: 20px;
}

.ticket-panel-card {
    display: flex;
    min-height: 330px;
    flex-direction: column;
    gap: 18px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
}

.ticket-panel-card h2 {
    margin: 12px 0 5px;
}

.ticket-panel-description,
.panel-internal-name {
    color: var(--text-muted);
}

.ticket-panel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ticket-panel-meta span,
.panel-status {
    padding: 7px 9px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 750;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.panel-status-active {
    color: #b8f2cf;
    background: rgba(50, 190, 110, 0.15);
}

.ticket-panel-card .module-link-button {
    margin-top: auto;
}

.panel-input-grid {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: 18px;
}

.text-field {
    display: grid;
    gap: 9px;
    margin-bottom: 20px;
}

.text-field > span {
    font-weight: 750;
}

.text-field input,
.text-field textarea {
    width: 100%;
    padding: 13px 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--surface-border);
    border-radius: 11px;
    outline: none;
    resize: vertical;
}

.text-field input:focus,
.text-field textarea:focus {
    border-color: rgba(88, 101, 242, 0.8);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.14);
}

@media (max-width: 700px) {
    .panel-input-grid {
        grid-template-columns: 1fr;
    }
}

/* Discord modal fields */

.modal-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.secondary-action-button {
    min-height: 42px;
    padding: 0 16px;
    color: white;
    font-weight: 750;
    cursor: pointer;
    background: rgba(88, 101, 242, 0.16);
    border: 1px solid rgba(125, 135, 255, 0.35);
    border-radius: 11px;
}

.secondary-action-button:hover {
    background: rgba(88, 101, 242, 0.26);
}

.secondary-action-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.modal-field-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--text-muted);
}

.modal-field-summary > span {
    color: #d9daff;
    font-weight: 750;
}

.modal-fields-list {
    display: grid;
    gap: 16px;
}

.modal-field-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.033);
    border: 1px solid var(--surface-border);
    border-radius: 15px;
}

.modal-field-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-field-key {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0 11px;
    color: #d9daff;
    background: rgba(88, 101, 242, 0.17);
    border-radius: 8px;
}

.modal-field-remove {
    padding: 8px 11px;
    color: #ffc1c1;
    font-weight: 700;
    cursor: pointer;
    background: rgba(225, 70, 70, 0.1);
    border: 1px solid rgba(225, 70, 70, 0.23);
    border-radius: 9px;
}

.modal-field-remove:hover {
    background: rgba(225, 70, 70, 0.18);
}

.modal-required-row {
    min-height: auto;
    padding-bottom: 0;
    border-bottom: 0;
}

.text-field small {
    color: var(--text-muted);
}

@media (max-width: 700px) {
    .modal-heading,
    .modal-field-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .secondary-action-button {
        width: 100%;
    }
}

/* Discord embed previews */

.discord-preview {
    display: grid;
    gap: 10px;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--surface-border);
}

.discord-preview-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.discord-embed-preview {
    position: relative;
    display: grid;
    max-width: 580px;
    gap: 12px;
    padding: 18px 18px 18px 22px;
    overflow: hidden;
    background: #2b2d31;
    border-radius: 4px;
}

.discord-embed-preview::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    content: "";
    background: #5865f2;
}

.discord-embed-preview h3 {
    margin: 0;
    color: #f2f3f5;
    font-size: 17px;
}

.discord-embed-preview p {
    margin: 0;
    color: #dbdee1;
    white-space: pre-wrap;
    line-height: 1.45;
}

.discord-embed-preview img {
    width: 100%;
    max-height: 280px;
    margin-top: 4px;
    object-fit: cover;
    border-radius: 4px;
}

.discord-embed-preview small {
    color: #b5bac1;
    padding-top: 5px;
}

.discord-preview-button {
    justify-self: start;
    min-height: 40px;
    padding: 0 15px;
    color: white;
    font-weight: 700;
    pointer-events: none;
    background: #5865f2;
    border: 0;
    border-radius: 3px;
}
