:root {
    color-scheme: light;
    --bg: #FBF9FF;
    --bg-elevated: #F7F3FF;
    --surface: #ffffff;
    --surface-2: #F7F3FF;
    --surface-3: #EEE8FF;
    --text: #251B35;
    --text-strong: #251B35;
    --muted: #6D6477;
    --muted-strong: #5E526B;
    --border: #E5DDF3;
    --border-strong: #D4C7EA;
    --primary: #6D3DF5;
    --primary-hover: #5B2ED0;
    --primary-soft: #EEE8FF;
    --primary-soft-strong: #E0D4FF;
    --primary-contrast: #ffffff;
    --accent: #FB923C;
    --navy: #2F1857;
    --navy-soft: #42266F;
    --success: #147451;
    --success-soft: #e4f6ee;
    --warning: #9a5b09;
    --warning-soft: #fff2d9;
    --danger: #b42342;
    --danger-hover: #951d36;
    --danger-soft: #ffeaef;
    --info: #176a9a;
    --info-soft: #e4f3fb;
    --focus: #8B5CF6;
    --shadow-xs: 0 1px 2px rgba(22, 34, 65, 0.05);
    --shadow-sm: 0 8px 24px rgba(23, 38, 75, 0.07);
    --shadow-md: 0 18px 50px rgba(23, 38, 75, 0.11);
    --shadow-lg: 0 30px 80px rgba(14, 25, 56, 0.16);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --content-width: 1180px;
    --transition: 160ms ease;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #171121;
    --bg-elevated: #1D1529;
    --surface: #21182E;
    --surface-2: #2A1F3A;
    --surface-3: #342644;
    --text: #F8F5FC;
    --text-strong: #ffffff;
    --muted: #C5BAD1;
    --muted-strong: #D5CBDF;
    --border: #413451;
    --border-strong: #554367;
    --primary: #A78BFA;
    --primary-hover: #BEA9FF;
    --primary-soft: #36274F;
    --primary-soft-strong: #443162;
    --primary-contrast: #171121;
    --accent: #FACC15;
    --navy: #120D1B;
    --navy-soft: #21182E;
    --success: #61d4a6;
    --success-soft: #163b31;
    --warning: #f5bd62;
    --warning-soft: #45351d;
    --danger: #ff8da2;
    --danger-hover: #ffadba;
    --danger-soft: #4b202c;
    --info: #75c9f4;
    --info-soft: #17364b;
    --focus: #BDA6FF;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 20px 55px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

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

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

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
select {
    cursor: pointer;
}

a {
    color: inherit;
}

img,
svg {
    display: block;
    max-width: 100%;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    color: var(--text-strong);
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: -0.035em;
}

p:last-child {
    margin-bottom: 0;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

::selection {
    color: #ffffff;
    background: #6D3DF5;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--primary-contrast);
    background: var(--primary);
    font-weight: 750;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform var(--transition);
}

.skip-link:focus {
    transform: translateY(0);
}

.shell {
    width: min(var(--content-width), calc(100% - 40px));
    margin-inline: auto;
}

.section-space {
    padding-block: clamp(72px, 9vw, 124px);
}

.eyebrow {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 820;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.text-link,
.back-link {
    color: var(--primary);
    font-weight: 720;
    text-decoration: none;
}

.text-link:hover,
.back-link:hover {
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    font-size: 0.9rem;
}

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

.brand-link {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    width: fit-content;
    color: var(--text-strong);
    font-size: 1.22rem;
    font-weight: 850;
    letter-spacing: -0.035em;
    text-decoration: none;
}

.brand-symbol {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    color: #ffffff;
    background: var(--primary);
    box-shadow: 0 7px 18px rgba(109, 61, 245, 0.25);
}

.brand-symbol svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    stroke: none;
}

.brand-on-dark {
    color: #ffffff;
}

.brand-on-dark .brand-symbol {
    color: #3C206C;
    background: #ffffff;
    box-shadow: none;
}

.button {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-weight: 760;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background-color var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.button:hover {
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
}

.button svg {
    width: 18px;
    height: 18px;
}

.button-primary {
    color: var(--primary-contrast);
    background: var(--primary);
    box-shadow: 0 8px 20px rgba(109, 61, 245, 0.2);
}

.button-primary:hover {
    color: var(--primary-contrast);
    background: var(--primary-hover);
    box-shadow: 0 10px 25px rgba(109, 61, 245, 0.27);
}

.button-secondary {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface);
}

.button-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

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

.button-danger:hover {
    color: #ffffff;
    background: var(--danger-hover);
}

.button-light {
    color: #3C206C;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(5, 10, 30, 0.2);
}

.button-light:hover {
    color: #3C206C;
    background: #EEE8FF;
}

.button-small {
    min-height: 40px;
    padding: 8px 15px;
    font-size: 0.9rem;
}

.button-large {
    min-height: 50px;
    padding: 13px 21px;
}

.button-full {
    width: 100%;
}

.icon-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 0;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted-strong);
    background: var(--surface);
    transition: color var(--transition), border-color var(--transition), background-color var(--transition), transform var(--transition);
}

.icon-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

.language-theme-controls {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.language-options {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 2px;
}
.language-options a {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius-sm) - 3px);
    padding: 0 7px;
    color: var(--muted-strong);
    font-size: .76rem;
    font-weight: 750;
    text-decoration: none;
}
.language-options a:hover,
.language-options a.is-active {
    color: var(--primary-contrast);
    background: var(--primary);
}
.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-icon {
    position: absolute;
    transition: opacity var(--transition), transform var(--transition);
}

.theme-icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.theme-icon-moon {
    opacity: 0;
    transform: rotate(-28deg) scale(0.6);
}

:root[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(30deg) scale(0.6);
}

:root[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 25px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--info);
    background: var(--info-soft);
    font-size: 0.68rem;
    font-weight: 840;
    letter-spacing: 0.045em;
}

.status-active,
.status-success {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    background: var(--success-soft);
}

.status-pending,
.status-invited,
.status-warning {
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 25%, transparent);
    background: var(--warning-soft);
}

.status-suspended,
.status-banned,
.status-rejected,
.status-error {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 24%, transparent);
    background: var(--danger-soft);
}

.status-retired,
.status-tc {
    color: var(--muted-strong);
    border-color: var(--border-strong);
    background: var(--surface-3);
}

.alert {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 13px 14px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.alert > span:first-child {
    display: grid;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    font-weight: 850;
}

.alert p {
    margin: 0;
}

.alert-error {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    background: var(--danger-soft);
}

.alert-success {
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    background: var(--success-soft);
}

.form-field {
    display: grid;
    gap: 7px;
}

.form-field label {
    color: var(--text-strong);
    font-size: 0.87rem;
    font-weight: 720;
}

.form-field > small {
    color: var(--muted);
    font-size: 0.77rem;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 16%, transparent);
}

.input-wrap > svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    margin-left: 14px;
    color: var(--muted);
}

.input-wrap input,
.input-wrap select,
.input-wrap textarea {
    width: 100%;
    min-width: 0;
    padding: 12px 14px 12px 11px;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
}

.input-wrap input::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.input-wrap.input-error {
    border-color: var(--danger);
}

.field-error {
    color: var(--danger) !important;
    font-weight: 680;
}

.password-wrap input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 5px;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    background: transparent;
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.password-toggle svg {
    width: 19px;
    height: 19px;
}

select,
textarea,
.form-control {
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    color: var(--text);
    background: var(--surface);
}

.dropdown-menu {
    min-width: 210px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 9px;
    color: var(--text);
    background: transparent;
    text-decoration: none;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.toast-region {
    position: fixed;
    z-index: 900;
    top: 20px;
    right: 20px;
    display: grid;
    width: min(390px, calc(100% - 32px));
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: 34px 1fr 28px;
    gap: 11px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
    animation: toast-in 220ms ease both;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateX(16px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

.toast-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 9px;
    color: var(--info);
    background: var(--info-soft);
    font-weight: 850;
}

.toast-success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast-error .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast-warning .toast-icon { color: var(--warning); background: var(--warning-soft); }

.toast strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-strong);
    font-size: 0.88rem;
}

.toast p {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.toast-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    color: var(--muted);
    background: transparent;
    font-size: 1.2rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text);
    background: var(--surface-2);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) translateX(12px); }
    to { opacity: 1; transform: translate(0); }
}

.modal-backdrop {
    position: fixed;
    z-index: 950;
    inset: 0;
    display: grid;
    padding: 20px;
    place-items: center;
    background: rgba(4, 9, 24, 0.66);
    backdrop-filter: blur(6px);
}

.confirm-modal {
    width: min(470px, 100%);
    padding: clamp(24px, 5vw, 34px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.confirm-modal-mark {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    place-items: center;
    border-radius: 14px;
    color: var(--warning);
    background: var(--warning-soft);
    font-size: 1.25rem;
    font-weight: 850;
}

.confirm-modal h2 {
    margin-bottom: 10px;
    font-size: 1.45rem;
}

.confirm-modal-copy > p:last-child {
    color: var(--muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
}

.empty-state {
    display: grid;
    justify-items: center;
    max-width: 620px;
    margin-inline: auto;
    padding: clamp(34px, 6vw, 58px) 24px;
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 18px;
    color: var(--primary);
    background: var(--primary-soft);
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state h3 {
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.empty-state p {
    max-width: 520px;
    margin-bottom: 20px;
    color: var(--muted);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    color: var(--muted-strong);
    background: var(--surface-2);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.error-page {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 34%),
        var(--bg);
}

.error-shell {
    display: grid;
    grid-template-rows: auto 1fr auto;
    width: min(1080px, 100%);
    min-height: calc(100vh - 48px);
    margin-inline: auto;
}

.error-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.error-content {
    display: grid;
    max-width: 650px;
    place-self: center;
    justify-items: center;
    padding-block: 50px;
    text-align: center;
}

.error-visual {
    position: relative;
    display: grid;
    width: 220px;
    height: 170px;
    margin-bottom: 30px;
    place-items: center;
    color: var(--primary);
}

.error-visual > span {
    position: absolute;
    color: var(--primary-soft-strong);
    font-size: 8rem;
    font-weight: 900;
    letter-spacing: -0.09em;
    line-height: 1;
}

.error-visual svg {
    z-index: 1;
    width: 112px;
    height: 112px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 32px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.error-content h1 {
    margin-bottom: 14px;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.error-content > p:not(.eyebrow) {
    max-width: 570px;
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 1.05rem;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.error-footnote {
    align-self: end;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 28px, var(--content-width));
    }

    .section-space {
        padding-block: 70px;
    }

    .button-large {
        min-height: 48px;
        padding: 12px 17px;
    }

    .toast-region {
        top: 12px;
        right: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .button {
        width: 100%;
    }

    .error-page {
        padding: 16px;
    }

    .error-shell {
        min-height: calc(100vh - 32px);
    }

    .error-visual {
        width: 180px;
        height: 135px;
    }

    .error-visual > span {
        font-size: 6.2rem;
    }

    .error-visual svg {
        width: 90px;
        height: 90px;
    }

    .error-actions {
        width: 100%;
    }

    .error-actions .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
