:root {
    color-scheme: light;
    --theme-bg-start: #ffffff;
    --theme-bg-end: #f4f6fb;
    --theme-primary: #0b4ea2;
    --theme-accent: #1a73e8;
    --theme-glass: rgba(255, 255, 255, 0.9);
    --theme-font: 'Inter', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
    --text: #1f2937;
    --muted: #6b7280;
    --border: rgba(209, 213, 219, 0.8);
    --dropdown-bg: #ffffff;
    --dropdown-active-bg: #e0e7ff;
    --dropdown-text: #111827;
    --card: #ffffff;
    --theme-solid-panel: #ffffff;
    --theme-solid-border: rgba(17, 24, 39, 0.08);
    --theme-solid-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    --admin-nav-height: 0px;
}

body {
    margin: 0;
    font-family: var(--theme-font, 'Inter', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif);
    background-color: #ffffff;
    background-image:
        radial-gradient(circle at 20% 18%, rgba(210, 226, 255, 0.5), transparent 32%),
        radial-gradient(circle at 82% 6%, rgba(190, 227, 248, 0.6), transparent 28%),
        linear-gradient(135deg, var(--theme-bg-start), var(--theme-bg-end));
    color: var(--text);
    transition: background 0.4s ease, color 0.25s ease;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.admin-app-body {
    overflow-x: hidden;
}

.admin-scale {
    transform: scale(0.75);
    transform-origin: top center;
    width: calc(100% / 0.75);
    margin: 0 auto;
}

@supports (zoom: 1) {
    .admin-scale {
        transform: none;
        width: 100%;
        zoom: 0.75;
    }
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    body {
        background-image:
            radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--theme-accent) 45%, transparent), transparent 36%),
            radial-gradient(circle at 78% 4%, color-mix(in srgb, var(--theme-primary) 42%, transparent), transparent 28%),
            linear-gradient(135deg, var(--theme-bg-start), var(--theme-bg-end));
    }
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
}

.login-card {
    width: min(400px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 20px;
    backdrop-filter: blur(14px) saturate(130%);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.55);
}

.login-card h1 {
    margin: 0 0 1.5rem;
    font-size: 1.9rem;
    font-weight: 600;
}

.login-card form {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.login-card form + form {
    margin-top: 0.75rem;
}

label span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

input, textarea, button, select {
    font: inherit;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--theme-glass);
    color: inherit;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select option,
select optgroup {
    background-color: var(--dropdown-bg, #f8fafc);
    color: var(--dropdown-text, #0f172a);
}

select option:checked,
select option:hover,
select option:focus {
    background-color: var(--dropdown-active-bg, #e0e7ff);
    color: var(--dropdown-text, #0f172a);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    input, textarea, button, select {
        background: color-mix(in srgb, var(--theme-glass) 82%, transparent);
    }
}

input:focus, textarea:focus, button:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(11, 78, 162, 0.18);
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
    input:focus, textarea:focus, button:focus {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 35%, transparent);
    }
}

button {
    cursor: pointer;
    font-weight: 600;
}

.login-card {
    background: var(--theme-glass);
    border: 1px solid var(--border);
}

.login-card button:not(.link-button) {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
    border: none;
    color: #0f172a;
}

.link-button {
    background: none;
    border: none;
    color: var(--muted);
    padding: 0;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

.link-button:hover,
.link-button:focus {
    color: var(--text);
    outline: none;
}


.back-link {
    display: inline-block;
    margin-top: 1.5rem;
    color: var(--muted);
    text-decoration: none;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(45, 212, 191, 0.14);
    border: 1px solid rgba(45, 212, 191, 0.4);
    color: #5eead4;
}

.alert-error {
    background: rgba(248, 113, 113, 0.18);
    border: 1px solid rgba(248, 113, 113, 0.45);
    color: #fecdd3;
}

.alert-info {
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #bfdbfe;
}

.alert-warning {
    background: rgba(251, 191, 36, 0.16);
    border: 1px solid rgba(251, 191, 36, 0.45);
    color: #fcd34d;
}

.alert code {
    font-family: 'Fira Code', 'Consolas', 'Menlo', monospace;
    font-size: 0.9rem;
    background: rgba(249, 250, 251, 0.9);
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    display: inline-block;
    margin-top: 0.35rem;
}


.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    display: grid;
    gap: 0.75rem;
    z-index: 100;
    pointer-events: none;
}

html.admin-html .toast-container {
    top: 6rem;
}

.toast {
    min-width: 220px;
    max-width: min(360px, 90vw);
    border-radius: 18px;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 38px rgba(17, 24, 39, 0.14);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: start;
    color: var(--text);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast__content {
    line-height: 1.5;
    font-size: 0.95rem;
}

.toast__close {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0.1rem;
    line-height: 1;
    font-size: 1.2rem;
    opacity: 0.75;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast__close:hover,
.toast__close:focus {
    opacity: 1;
    transform: scale(1.05);
    outline: none;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.toast--success {
    background: rgba(45, 212, 191, 0.18);
    border-color: rgba(45, 212, 191, 0.45);
    color: #0f5132;
}

.toast--error {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.5);
    color: #7f1d1d;
}

@media (max-width: 640px) {
    .toast-container,
    html.admin-html .toast-container {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
    }

    .toast {
        max-width: 100%;
    }
}

.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    backdrop-filter: blur(12px) saturate(150%);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--theme-glass);
    border-bottom: 1px solid var(--border);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .admin-nav {
        background: color-mix(in srgb, var(--theme-glass) 95%, transparent);
    }
}

.admin-nav h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-title {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-site {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.nav-site__label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-site__current {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-site__current strong {
    font-size: 1rem;
    color: var(--text);
}

.nav-site__current span {
    font-size: 0.85rem;
    color: var(--muted);
}

.site-switcher {
    display: flex;
    align-items: center;
}

.site-switcher select {
    background: var(--theme-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 0.9rem;
    color: inherit;
    min-width: 220px;
}

.site-switcher select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px rgba(11, 78, 162, 0.18);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-action {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(148, 163, 184, 0.14);
    color: var(--muted);
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    line-height: 1;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-action:visited {
    color: var(--muted);
}

.nav-action:hover {
    background: rgba(148, 163, 184, 0.24);
    border-color: var(--theme-accent);
    color: var(--text);
}

.nav-action:focus-visible {
    outline: none;
    background: rgba(148, 163, 184, 0.24);
    border-color: var(--theme-accent);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.22);
}

.nav-action__label {
    display: inline-flex;
    align-items: center;
}

.nav-action--toggle[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(148, 163, 184, 0.45);
    color: var(--text);
}

.nav-action--toggle[aria-pressed="true"] .help-icon {
    background: rgba(148, 163, 184, 0.18);
    color: rgba(148, 163, 184, 0.85);
}

.admin-main {
    max-width: 1280px;
    margin: 2rem auto 3rem;
    padding: 0 2rem;
    display: grid;
    gap: 2rem;
}

.admin-layout {
    display: grid;
    gap: 2rem;
}

.admin-content {
    display: grid;
    gap: 2rem;
}

.section-nav-toggle {
    align-self: start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    margin-bottom: 0.75rem;
    position: sticky;
    top: calc(var(--admin-nav-height, 0px) + 0.75rem);
    z-index: 5;
}

.section-nav-toggle:hover,
.section-nav-toggle:focus-visible {
    outline: none;
    border-color: rgba(11, 78, 162, 0.75);
    box-shadow: 0 0 0 3px rgba(11, 78, 162, 0.22);
    background: rgba(11, 78, 162, 0.28);
}

.section-nav {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--theme-glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.16);
    color: var(--muted);
    backdrop-filter: blur(14px) saturate(140%);
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .section-nav {
        background: color-mix(in srgb, var(--theme-glass) 92%, transparent);
    }
}

.section-nav.is-open {
    display: flex;
    position: fixed;
    top: calc(var(--admin-nav-height, 0px) + 1rem);
    left: 1rem;
    right: 1rem;
    bottom: 1.5rem;
    z-index: 70;
    overflow-y: auto;
}

.section-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-nav__title {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
}

.section-nav__close {
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.section-nav__close:hover,
.section-nav__close:focus-visible {
    outline: none;
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(148, 163, 184, 0.15);
}

.section-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.section-nav__link {
    display: block;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid transparent;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-nav__link:hover,
.section-nav__link:focus-visible {
    color: var(--text);
    background: rgba(148, 163, 184, 0.18);
    border-color: rgba(148, 163, 184, 0.38);
    outline: none;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.18);
}

.section-nav__link.is-active {
    color: var(--text);
    background: rgba(11, 78, 162, 0.22);
    border-color: rgba(11, 78, 162, 0.45);
    box-shadow: 0 0 0 2px rgba(11, 78, 162, 0.2);
}

.section-nav__overlay {
    display: none;
}

.section-nav__overlay.is-active {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.28);
    backdrop-filter: blur(6px);
    z-index: 60;
}

@media (min-width: 960px) {
    .admin-layout {
        grid-template-columns: 320px minmax(0, 1fr);
        align-items: start;
    }

    .section-nav {
        display: flex;
        position: sticky;
        top: calc(var(--admin-nav-height, 0px) + 1.5rem);
        left: auto;
        right: auto;
        bottom: auto;
        max-height: calc(100vh - (var(--admin-nav-height, 0px) + 3.5rem));
        overflow-y: auto;
        z-index: 1;
    }

    .section-nav.is-open {
        position: sticky;
    }

    .section-nav__close {
        display: none;
    }

    .section-nav__overlay {
        display: none !important;
    }

    .section-nav-toggle {
        display: none;
    }
}

.config-form {
    display: grid;
    gap: 2rem;
    padding-bottom: 8rem;
}

section {
    background: var(--theme-glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 12px 36px rgba(17, 24, 39, 0.14);
    display: grid;
    gap: 1.25rem;
    align-content: start;
    scroll-margin-top: 6.5rem;
}

.section-title {
    margin: 0;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

.grid label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.font-field {
    display: grid;
    gap: 0.75rem;
}

.font-field > label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-field__custom {
    display: grid;
    gap: 0.5rem;
}

.font-field__custom[hidden] {
    display: none !important;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.toggle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
    color: var(--muted);
}

.toggle input {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 6px;
}

.toggle--compact {
    align-items: flex-start;
    margin: 0;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle--compact:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

.toggle--compact:focus-within {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.18);
}

.toggle--compact input {
    margin-top: 0.2rem;
}

.toggle__body {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.toggle__label {
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.4;
    display: block;
    flex: 1;
}

.toggle__label code {
    font-size: 0.8rem;
}

.toggle__hint {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.compact-options {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.compact-options__toggles {
    display: grid;
    gap: 0.75rem;
}

@media (min-width: 880px) {
    .compact-options__toggles {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.compact-options__note {
    display: grid;
    gap: 0.5rem;
    color: var(--muted);
}

.compact-options__note-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.compact-options__note textarea {
    margin-top: 0;
}

.admin-preview-toggle {
    margin-bottom: 0.75rem;
}

.background-image-field__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.help-trigger {
    appearance: none;
    border: none;
    background: none;
    color: rgba(148, 163, 184, 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 0.35rem;
    transition: color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.help-trigger:hover {
    color: var(--theme-accent);
    transform: translateY(-1px);
}

.help-trigger:focus-visible {
    outline: 2px solid var(--theme-accent);
    outline-offset: 2px;
    color: var(--theme-accent);
}

.help-trigger--inline {
    font-size: 0.66rem;
}

.help-trigger--muted {
    color: rgba(148, 163, 184, 0.6);
}

.help-trigger--muted:hover,
.help-trigger--muted:focus-visible {
    color: var(--theme-accent);
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
    color: rgba(15, 23, 42, 0.92);
    font-weight: 700;
    font-size: 0.85rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.help-icon::before {
    content: '?';
    line-height: 1;
}

.help-icon::after {
    content: none;
}

.help-icon--small {
    width: 1.05rem;
    height: 1.05rem;
    font-size: 0.75rem;
}

.help-trigger:hover .help-icon,
.help-trigger:focus-visible .help-icon,
.nav-action:hover .help-icon,
.nav-action:focus-visible .help-icon {
    background: var(--theme-accent);
    color: rgba(15, 23, 42, 0.92);
}

body.help-hidden .help-trigger {
    display: none !important;
}

body.help-modal-open {
    overflow: hidden;
}

.admin-logs__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.admin-logs__controls label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 240px;
}

body.log-modal-open {
    overflow: hidden;
}

.log-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.log-modal.is-visible {
    display: flex;
}

.log-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    backdrop-filter: blur(4px);
}

.log-modal__dialog {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 22px;
    padding: 2rem;
    width: min(760px, 94vw);
    color: var(--text);
    box-shadow: 0 30px 70px rgba(17, 24, 39, 0.16);
}

.log-modal__title {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.log-modal__subtitle {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.log-modal__content {
    max-height: 60vh;
    overflow: auto;
}

.log-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.log-modal__list li {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(248, 250, 252, 0.92);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
}

.log-modal__empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.log-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.log-modal__close:hover,
.log-modal__close:focus-visible {
    outline: none;
    border-color: var(--theme-accent);
    background: rgba(34, 211, 238, 0.28);
}

.help-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.help-modal.is-visible {
    display: flex;
}

body.help-hidden .help-modal {
    display: none !important;
}

.help-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.32);
    backdrop-filter: blur(4px);
}

.help-modal__dialog {
    position: relative;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 20px;
    padding: 2rem;
    width: min(540px, 92vw);
    color: var(--text);
    box-shadow: 0 30px 70px rgba(17, 24, 39, 0.16);
}

.help-modal__title {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 600;
}

.help-modal__content {
    line-height: 1.6;
    color: var(--muted);
    font-size: 0.98rem;
    white-space: pre-line;
}

.help-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.help-modal__close:hover,
.help-modal__close:focus-visible {
    outline: none;
    border-color: var(--theme-accent);
    background: rgba(34, 211, 238, 0.28);
}

.inline-toggle input {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 6px;
}

.color-field__inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-field__inputs--alpha {
    flex-wrap: wrap;
}

.color-field__inputs--alpha input[type="range"] {
    flex: 1 1 160px;
    min-width: 160px;
    accent-color: var(--theme-accent);
}

.color-field__inputs--alpha .color-field__value {
    flex: 0 0 170px;
}

.color-field__inputs input[type="color"] {
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.35);
    cursor: pointer;
    background: transparent;
}

.color-field__value {
    width: 120px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--theme-glass);
    padding: 0.55rem 0.75rem;
    transition: color 0.2s ease, background 0.2s ease;
    cursor: text;
}

.input-mono {
    font-family: 'Fira Code', 'Consolas', 'SFMono-Regular', Menlo, monospace;
    letter-spacing: 0.01em;
}

.theme-columns {
    display: grid;
    gap: 2rem;
}

.theme-column {
    display: grid;
    gap: 1rem;
}

.theme-column h3 {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.theme-column .grid {
    margin-top: 0.75rem;
}

.field-hint {
    margin: -0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
}

@media (min-width: 960px) {
    .theme-columns {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.section-header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-description {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.section-body {
    display: grid;
    gap: 1.5rem;
}

.auth-provider-grid {
    max-width: 320px;
    margin-bottom: 1.25rem;
}

.auth-provider-panel {
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--theme-glass);
    display: grid;
    gap: 1rem;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .auth-provider-panel {
        background: color-mix(in srgb, var(--theme-glass) 92%, transparent);
    }
}

.auth-provider-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.auth-provider-panel .grid {
    margin: 0;
}

.secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--theme-accent);
    color: var(--theme-accent);
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
    .secondary {
        border-color: color-mix(in srgb, var(--theme-accent) 45%, transparent);
    }
}

.primary {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-accent));
    border: none;
    color: #0f172a;
    padding: 0.9rem 2.2rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(34, 211, 238, 0.28);
}


.form-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    margin: 0;
    width: min(520px, 90vw);
    padding: 0;
    border-radius: 18px;
    background: transparent;
    border: none;
    backdrop-filter: none;
    box-shadow: none;
    z-index: 9;
}

.form-footer .alert {
    margin: 0;
    width: 100%;
}

@supports (zoom: 1) {
    .form-footer {
        zoom: 1;
    }
}

.form-footer .link {
    color: var(--muted);
    text-decoration: none;
}

@media (max-width: 768px) {
    .form-footer {
        left: 1rem;
        right: 1rem;
        bottom: 1.25rem;
        border-radius: 18px;
        align-items: stretch;
        width: auto;
    }

    .form-footer .primary {
        flex: 1 1 auto;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }
}

.role-index {
    display: grid;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(255, 255, 255, 0.94);
}

.role-index__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.role-index__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.role-index__list li {
    margin: 0;
}

.role-index__list a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--theme-accent);
    text-decoration: none;
    font-size: 0.85rem;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.role-index__list a:hover,
.role-index__list a:focus-visible {
    border-color: var(--theme-accent);
    background: rgba(34, 211, 238, 0.12);
    color: var(--theme-accent);
}

.role-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--theme-glass);
    position: relative;
    display: grid;
    gap: 1.25rem;
    scroll-margin-top: 96px;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .role-card {
        background: color-mix(in srgb, var(--theme-glass) 92%, transparent);
    }
}

.role-badge {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.25rem;
    background: rgba(148, 163, 184, 0.08);
    display: grid;
    gap: 0.75rem;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .role-badge {
        background: color-mix(in srgb, var(--theme-glass) 70%, transparent);
    }
}

.role-badge__hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.role-card__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.role-card__header > div {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    flex: 1 1 260px;
    min-width: 0;
}

.role-card__header > .icon-button {
    align-self: flex-start;
    margin-left: auto;
    flex-shrink: 0;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--theme-glass);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@supports (background: color-mix(in srgb, red 50%, blue)) {
    .icon-button {
        background: color-mix(in srgb, var(--theme-glass) 75%, transparent);
    }
}

.icon-button:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    transform: translateY(-1px);
}

.icon-button[disabled] {
    opacity: 0.35;
    pointer-events: none;
}

.icon-button__glyph {
    font-size: 1.25rem;
    line-height: 1;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.link-row {
    position: relative;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.link-row--highlight {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24);
}

@media (prefers-reduced-motion: reduce) {
    .link-row {
        transition: none;
    }
}

.links-empty {
    margin: 0 0 1rem;
    color: var(--muted);
    font-style: italic;
}

.claim-filters {
    display: grid;
    gap: 1rem;
}

.claim-filters__empty {
    margin: 0;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--muted);
    font-style: italic;
}

.claim-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
}

.claim-card__header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.claim-card__fields {
    display: grid;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.claim-card__values {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.claim-values {
    display: grid;
    gap: 0.75rem;
}

.claim-values__empty {
    margin: 0;
    font-style: italic;
    color: var(--muted);
}

.claim-value {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.3);
    background: rgba(248, 250, 252, 0.92);
}

.claim-value__fields {
    display: grid;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.claim-values__add {
    align-self: flex-start;
}

.link-filter-group {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-filter-group--empty {
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
    padding-top: 0.75rem;
}

.link-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.link-filter-claims {
    display: grid;
    gap: 0.75rem;
}

.link-filter-claims[hidden] {
    display: none;
}

.link-filter-claim {
    display: grid;
    gap: 0.5rem;
}

.link-filter-claim select {
    min-height: 6rem;
}

.link-filter-claim__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.link-filter-claim__controls select {
    flex: 1 1 220px;
}

.link-filter-claim__clear {
    background: none;
    border: 1px solid transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.link-filter-claim__clear:hover,
.link-filter-claim__clear:focus-visible {
    color: var(--theme-accent);
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(148, 163, 184, 0.12);
}

.link-row:last-child {
    margin-bottom: 0;
}

.link-row__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.link-row__drag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.link-row__summary {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-row__summary[data-empty="true"] {
    color: var(--muted);
    font-style: italic;
}

.link-row__actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.link-row__handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    background: rgba(148, 163, 184, 0.08);
    color: var(--muted);
    cursor: grab;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.link-row__handle:hover,
.link-row__handle:focus-visible {
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.8);
    background: rgba(148, 163, 184, 0.16);
    outline: none;
}

.link-row__handle:active {
    cursor: grabbing;
}

.link-row__handle-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.link-row__move {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(148, 163, 184, 0.12);
    color: inherit;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.link-row__move:hover,
.link-row__move:focus-visible {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    background: rgba(34, 211, 238, 0.12);
    outline: none;
}

.link-row__move[disabled] {
    opacity: 0.45;
    pointer-events: none;
}

.link-row--dragging {
    opacity: 0.65;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.45);
    cursor: grabbing;
}

.link-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.link-grid label {
    font-size: 0.9rem;
    gap: 0.35rem;
}

.link-grid > .icon-control {
    grid-column: 1 / -1;
}

.icon-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem 1rem;
    padding: 1rem;
    border-radius: 14px;
    border: 1px dashed var(--border);
    background: rgba(255, 255, 255, 0.04);
    align-items: start;
}

.icon-control__fields {
    display: grid;
    gap: 0.75rem;
}

.icon-control__options {
    display: grid;
    gap: 0.6rem;
}

.icon-image-options {
    display: grid;
    gap: 0.6rem;
}

.icon-image-dimensions {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.icon-image-dimensions label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.icon-control__preview {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.95);
    display: grid;
    place-items: center;
    color: var(--theme-accent);
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    justify-self: end;
}

.icon-control__preview svg {
    width: 28px;
    height: 28px;
}

.icon-control__preview img {
    width: auto;
    height: auto;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    border-radius: 12px;
}

.portal-management__grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.portal-card {
    display: grid;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 20px;
    padding: 1.5rem;
}

.portal-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.portal-card__description {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--muted);
}

.portal-card__meta {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
}

.portal-card__meta div {
    display: grid;
    gap: 0.25rem;
}

.admin-mfa-status {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    background: rgba(248, 250, 252, 0.96);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.admin-mfa-status__details {
    display: grid;
    gap: 0.35rem;
    min-width: 220px;
}

.admin-mfa-status__label {
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-mfa-status__value {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.admin-mfa-status__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
}

@media (min-width: 640px) {
    .admin-mfa-status__actions {
        flex-direction: row;
        align-items: center;
    }
}

.admin-mfa-status__form {
    margin: 0;
}

.admin-mfa-status__hint {
    margin: 0;
    font-size: 0.88rem;
    color: var(--muted);
    max-width: 420px;
}

.portal-card__meta dt {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    color: var(--muted);
}

.portal-card__meta dd {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
}

.portal-form {
    display: grid;
    gap: 1rem;
}

.portal-form label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.portal-form select {
    width: 100%;
}

.portal-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.portal-form__actions .primary {
    padding: 0.6rem 2.2rem;
}

.portal-missing-preview {
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 16px;
}

.portal-missing-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.16);
}

.portal-listing {
    margin-top: 2rem;
}

.portal-listing__current {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.portal-listing__current-label {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.portal-listing__details {
    border: 1px solid rgba(209, 213, 219, 0.7);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    overflow: hidden;
    backdrop-filter: blur(6px);
}

.portal-listing__summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.25rem;
    cursor: pointer;
}

.portal-listing__summary::-webkit-details-marker {
    display: none;
}

.portal-listing__summary::after {
    content: '';
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.portal-listing__details[open] .portal-listing__summary::after {
    transform: rotate(-135deg);
}

.portal-listing__summary-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
}

.portal-listing__summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    align-items: baseline;
}

.portal-listing__count {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.portal-listing__hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.portal-listing__active {
    font-size: 0.8rem;
    color: var(--muted);
}

.portal-listing__panel {
    border-top: 1px solid rgba(209, 213, 219, 0.65);
    padding: 0.85rem 0.9rem 1rem;
    max-height: 320px;
    overflow-y: auto;
}

.portal-listing__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.portal-listing__item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(209, 213, 219, 0.6);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-listing__item:hover {
    border-color: rgba(148, 163, 184, 0.4);
}

.portal-listing__item.is-active {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35);
}

.portal-listing__name {
    font-weight: 600;
    color: var(--text);
}

.portal-listing__domain {
    font-family: 'Fira Code', 'Consolas', 'SFMono-Regular', Menlo, monospace;
    font-size: 0.8rem;
    color: var(--muted);
}

.portal-listing__badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    background: rgba(34, 211, 238, 0.18);
    border: 1px solid rgba(34, 211, 238, 0.4);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    color: #99f6e4;
}

@media (max-width: 720px) {
    .admin-nav {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .admin-main {
        padding: 0 1rem;
    }
    section {
        padding: 1.5rem;
    }
}
