body {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    position: relative;
    min-width: 0;
    overflow-x: hidden;
}

.auth-shell {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0 !important;
    box-sizing: border-box;
}

.sidebar-overlay {
    display: none;
}

.sidebar {
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 20px 24px;
    border-right: 1px solid rgba(57, 168, 255, 0.1);
    background:
        linear-gradient(165deg, rgba(57, 168, 255, 0.07) 0%, transparent 38%),
        linear-gradient(215deg, rgba(255, 122, 47, 0.05) 0%, transparent 42%),
        rgba(11, 15, 24, 0.94);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    width: 292px;
    max-width: 292px;
    min-width: 292px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

h1,
h2 {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-top,
.nav-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-top {
    min-height: 52px;
}

.sidebar-top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sidebar-hide-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(57, 168, 255, 0.16);
    background: rgba(16, 20, 31, 0.84);
    color: rgba(148, 163, 184, 0.95);
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sidebar-hide-btn:hover {
    color: var(--text);
    border-color: rgba(57, 168, 255, 0.28);
    background: rgba(57, 168, 255, 0.08);
    transform: translateY(-1px);
}

.sidebar-hide-btn:active {
    transform: translateY(0);
}

.sidebar-hide-btn svg {
    display: block;
}

.sidebar-restore-btn {
    display: none;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 12px;
    top: 18px;
    z-index: 50;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(57, 168, 255, 0.22);
    background: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(14px);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 4px 24px rgba(8, 11, 18, 0.45), var(--shadow-blue);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sidebar-restore-btn:hover {
    background: rgba(57, 168, 255, 0.12);
    border-color: rgba(57, 168, 255, 0.35);
    transform: scale(1.03);
}

.sidebar-restore-btn svg {
    display: block;
}

.sidebar-restore-btn:not([hidden]) {
    display: inline-flex;
}

body.sidebar-hidden {
    grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-hidden .sidebar {
    visibility: hidden;
    width: 0;
    max-width: 0;
    min-width: 0;
    padding: 0;
    border-right-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

@media (min-width: 1025px) {
    body.sidebar-hidden .page-shell {
        padding-left: 72px;
    }
}

.nav-footer {
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    padding-top: 20px;
    border-top: 1px solid rgba(57, 168, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    border-radius: 14px;
    padding: 6px 8px 6px 4px;
    margin: -6px 0 -6px -4px;
    transition: background 0.18s ease;
}

.sidebar-brand:hover {
    background: rgba(57, 168, 255, 0.06);
}

.sidebar-brand__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #0a0d14;
    background: linear-gradient(135deg, var(--blue) 0%, rgba(57, 168, 255, 0.65) 48%, var(--orange) 120%);
    box-shadow: 0 4px 20px rgba(57, 168, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
}

.sidebar-brand__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-brand__title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--text);
}

.sidebar-brand__subtitle {
    font-size: 11px;
    font-weight: 500;
    color: rgba(148, 163, 184, 0.75);
    letter-spacing: 0.04em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    flex: 1;
    min-height: 0;
}

.sidebar-nav__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.5);
    padding: 10px 12px 8px;
}

.sidebar-nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 12px 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(196, 210, 228, 0.82);
    border: 1px solid transparent;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-nav__link:hover {
    color: var(--text);
    background: rgba(57, 168, 255, 0.07);
    border-color: rgba(57, 168, 255, 0.12);
}

.sidebar-nav__link:focus-visible {
    outline: 2px solid rgba(57, 168, 255, 0.45);
    outline-offset: 2px;
}

.sidebar-nav__link.is-active {
    color: var(--text);
    background: linear-gradient(105deg, rgba(57, 168, 255, 0.16), rgba(57, 168, 255, 0.04));
    border-color: rgba(57, 168, 255, 0.22);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.sidebar-nav__link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--blue), var(--orange));
    box-shadow: 0 0 12px rgba(57, 168, 255, 0.45);
}

.sidebar-nav__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(57, 168, 255, 0.05);
    color: rgba(148, 163, 184, 0.95);
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav__icon svg {
    display: block;
}

.sidebar-nav__link:hover .sidebar-nav__icon {
    background: rgba(57, 168, 255, 0.1);
    color: rgba(229, 238, 249, 0.95);
}

.sidebar-nav__link.is-active .sidebar-nav__icon {
    background: rgba(57, 168, 255, 0.16);
    color: var(--blue);
}

.sidebar-nav__text {
    letter-spacing: 0.01em;
    min-width: 0;
    line-height: 1.35;
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    border-radius: 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    color: rgba(229, 238, 249, 0.88);
    border: 1px solid rgba(255, 92, 122, 0.22);
    background: rgba(255, 92, 122, 0.05);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.sidebar-logout:hover {
    color: var(--red);
    border-color: rgba(255, 92, 122, 0.38);
    background: rgba(255, 92, 122, 0.1);
    transform: translateY(-1px);
}

.sidebar-logout:active {
    transform: translateY(0);
}

.sidebar-logout__icon {
    display: flex;
    opacity: 0.9;
}

.ghost-btn,
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-align: center;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease,
        opacity 0.18s ease;
}

.ghost-btn {
    border: 1px solid rgba(57, 168, 255, 0.2);
    background: rgba(16, 20, 31, 0.88);
    color: var(--text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.ghost-btn:hover:not(:disabled) {
    border-color: rgba(57, 168, 255, 0.38);
    background: rgba(57, 168, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(8, 11, 18, 0.35);
}

.ghost-btn:active:not(:disabled) {
    transform: translateY(0);
}

.danger-btn {
    border-color: rgba(255, 90, 90, 0.32);
    color: var(--red);
    background: rgba(255, 92, 122, 0.06);
}

.danger-btn:hover:not(:disabled) {
    border-color: rgba(255, 90, 90, 0.45);
    background: rgba(255, 92, 122, 0.12);
    color: #ff8a9a;
}

.primary-btn {
    border: 1px solid rgba(255, 122, 47, 0.35);
    background: linear-gradient(135deg, rgba(255, 122, 47, 0.22), rgba(57, 168, 255, 0.2));
    color: var(--text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, var(--shadow-orange);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(255, 160, 90, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        var(--shadow-orange),
        0 10px 28px rgba(8, 11, 18, 0.4);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ghost-btn:focus-visible,
.primary-btn:focus-visible,
.icon-edit-btn:focus-visible {
    outline: 2px solid rgba(57, 168, 255, 0.45);
    outline-offset: 2px;
}

.ghost-btn:disabled,
.primary-btn:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

button.is-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    opacity: 0.9;
}

.btn-spinner {
    flex-shrink: 0;
    width: 1em;
    height: 1em;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: ui-btn-spin 0.65s linear infinite;
}

@keyframes ui-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading-text {
    white-space: nowrap;
}

.page-shell {
    padding: 28px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.page-shell:not(.auth-shell) {
    max-width: 1420px;
    margin: 0 auto;
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

.page-header,
.with-action {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 16px 20px;
    flex-wrap: wrap;
}

.page-header h1,
.with-action h1 {
    margin: 0;
    line-height: 1.15;
}

.eyebrow,
.muted {
    color: var(--muted);
}

.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.88);
    margin-bottom: 6px;
}

.card {
    background:
        linear-gradient(165deg, rgba(57, 168, 255, 0.07) 0%, transparent 42%),
        linear-gradient(218deg, rgba(255, 122, 47, 0.04) 0%, transparent 48%),
        rgba(12, 16, 24, 0.92);
    border: 1px solid rgba(57, 168, 255, 0.12);
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 4px 32px rgba(8, 11, 18, 0.42),
        0 0 60px rgba(57, 168, 255, 0.04);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.card > .toolbar:first-child {
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(57, 168, 255, 0.08);
}

.auth-card {
    width: min(460px, calc(100vw - 32px));
    margin: 10vh auto 0;
    padding: 32px;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid rgba(57, 168, 255, 0.14);
    border-radius: 24px;
    box-shadow: var(--shadow-blue);
    backdrop-filter: blur(16px);
    box-sizing: border-box;
}

.auth-layout {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 5vw, 40px);
    box-sizing: border-box;
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
}

.auth-layout__ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 100% 80% at 50% -30%, rgba(57, 168, 255, 0.14), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 20%, rgba(255, 122, 47, 0.08), transparent 50%),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(57, 168, 255, 0.06), transparent 45%);
    animation: auth-ambient-shift 14s ease-in-out infinite alternate;
}

@keyframes auth-ambient-shift {
    0% {
        opacity: 1;
        filter: saturate(1);
    }
    100% {
        opacity: 0.92;
        filter: saturate(1.15);
    }
}

.auth-card--login {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    margin: 0;
    padding: clamp(28px, 6vw, 42px) clamp(24px, 5vw, 40px);
    overflow: hidden;
    border: 1px solid rgba(57, 168, 255, 0.2);
    background: linear-gradient(155deg, rgba(20, 26, 40, 0.95) 0%, rgba(12, 16, 26, 0.92) 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 48px rgba(8, 11, 18, 0.55),
        0 0 80px rgba(57, 168, 255, 0.08);
    animation: auth-card-enter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes auth-card-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card--login.is-authenticating {
    pointer-events: none;
    animation: auth-card-pulse 1.4s ease-in-out infinite;
}

@keyframes auth-card-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.04) inset,
            0 24px 48px rgba(8, 11, 18, 0.55),
            0 0 80px rgba(57, 168, 255, 0.08);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.06) inset,
            0 24px 48px rgba(8, 11, 18, 0.55),
            0 0 100px rgba(57, 168, 255, 0.18);
    }
}

.auth-card__title {
    margin: 0 0 clamp(20px, 4vw, 28px);
    text-align: center;
    font-size: clamp(1.4rem, 4.5vw, 1.85rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: none;
    line-height: 1.2;
    background: linear-gradient(120deg, var(--text) 0%, rgba(229, 238, 249, 0.82) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@supports not (background-clip: text) {
    .auth-card__title {
        color: var(--text);
        background: none;
    }
}

.auth-form__field {
    text-align: left;
}

.auth-form__label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.9);
}

.auth-form .auth-form__field input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form .auth-form__field input:hover {
    border-color: rgba(57, 168, 255, 0.28);
}

.auth-form .auth-form__field input:focus {
    outline: none;
    border-color: rgba(57, 168, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(57, 168, 255, 0.12);
}

.auth-form__submit {
    width: 100%;
    margin-top: 6px;
    min-height: 48px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-form__submit:not(:disabled):hover {
    transform: translateY(-1px);
}

.auth-form__submit:not(:disabled):active {
    transform: translateY(0);
}

.auth-form__error {
    margin: 4px 0 0;
    min-height: 1.25em;
    text-align: center;
    font-size: 13px;
    line-height: 1.4;
}

.auth-form__error:empty {
    margin: 0;
    min-height: 0;
}

@media (prefers-reduced-motion: reduce) {
    .auth-layout__ambient,
    .auth-card--login,
    .auth-card--login.is-authenticating {
        animation: none;
    }

    .auth-form__submit:not(:disabled):hover,
    .primary-btn:hover:not(:disabled),
    .ghost-btn:hover:not(:disabled),
    .icon-edit-btn:hover,
    .sidebar-hide-btn:hover,
    .sidebar-logout:hover {
        transform: none;
    }
}

.stack {
    display: grid;
    gap: 14px;
}

.hidden {
    display: none !important;
}

.account-premium-star {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    color: #3b82f6;
    vertical-align: middle;
    line-height: 1;
}

.account-premium-star__icon {
    display: block;
}

label,
.inline-form {
    display: grid;
    gap: 8px;
}

input,
select,
textarea {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}

input,
select {
    min-height: 48px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(57, 168, 255, 0.2);
    background: rgba(10, 13, 20, 0.94);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(57, 168, 255, 0.2);
    background: rgba(10, 13, 20, 0.94);
    color: var(--text);
    resize: vertical;
    min-height: 180px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: rgba(57, 168, 255, 0.32);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: rgba(57, 168, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(57, 168, 255, 0.14);
}

.toolbar,
.inline-form,
.modal-actions,
.card-header {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.card-header {
    justify-content: space-between;
}

.card-header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.94);
}

.card,
.table-shell {
    padding: 22px 24px;
}

.table-shell {
    min-width: 0;
}

.card > .table-shell,
.modal .table-shell {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-value {
    font-size: 32px;
    color: var(--blue);
    line-height: 1.1;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
    table-layout: auto;
}

.data-table thead th {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.92);
    font-weight: 700;
    white-space: nowrap;
    background: rgba(57, 168, 255, 0.05);
    border-bottom: 1px solid rgba(57, 168, 255, 0.14);
}

.data-table tbody td {
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(57, 168, 255, 0.08);
    text-align: left;
    vertical-align: middle;
}

.data-table tbody tr:hover td {
    background: rgba(57, 168, 255, 0.04);
}

.table-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

html,
.table-scroll,
.modal,
.sidebar,
.import-users-modal-body,
textarea {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar,
.modal::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.import-users-modal-body::-webkit-scrollbar,
textarea::-webkit-scrollbar {
    width: var(--scrollbar-size);
    height: var(--scrollbar-size);
}

html::-webkit-scrollbar-track,
.table-scroll::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.import-users-modal-body::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.import-users-modal-body::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(57, 168, 255, 0.42), rgba(57, 168, 255, 0.18));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: inset 0 0 0 1px rgba(57, 168, 255, 0.12);
}

html::-webkit-scrollbar-thumb:hover,
.table-scroll::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.import-users-modal-body::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--scrollbar-thumb-hover), rgba(57, 168, 255, 0.25));
    background-clip: padding-box;
}

html::-webkit-scrollbar-corner,
.table-scroll::-webkit-scrollbar-corner,
.modal::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

.filename-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
}

.filename-cell span {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filename-cell a {
    font-weight: 600;
    min-width: 0;
}

.entity-ref-cell {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text);
}

.table-scroll--dense .data-table--dense .entity-ref-cell {
    font-size: 11px;
}

.admin-id-cell {
    display: block;
    font-family: ui-monospace, "Cascadia Code", "Consolas", "SF Mono", monospace;
    font-size: 11px;
    line-height: 1.35;
    color: rgba(196, 210, 228, 0.9);
    word-break: break-all;
    max-width: min(280px, 36vw);
}

.table-scroll--dense .data-table--dense .admin-id-cell {
    font-size: 10px;
    max-width: min(260px, 40vw);
}

.admin-id-cell--inline {
    display: inline;
    max-width: none;
    word-break: break-all;
}

.table-scroll--dense .data-table--dense {
    min-width: 640px;
    font-size: 12px;
}

.table-scroll--dense .data-table--dense th,
.table-scroll--dense .data-table--dense td {
    padding: 5px 8px;
    line-height: 1.2;
}

.table-scroll--dense .data-table--dense th {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom-color: rgba(57, 168, 255, 0.14);
}

.table-scroll--dense .data-table--dense tbody tr {
    border-bottom: 1px solid rgba(57, 168, 255, 0.06);
}

.table-scroll--dense .data-table--dense tbody tr:hover td {
    background: rgba(57, 168, 255, 0.04);
}

.table-scroll--dense .data-table--dense .status-badge {
    padding: 2px 7px;
    font-size: 10px;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.table-scroll--dense .data-table--dense .ghost-btn.inline-action-btn,
.table-scroll--dense .data-table--dense td .ghost-btn,
.table-scroll--dense .data-table--dense .icon-edit-btn {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 8px;
    min-height: 0;
    width: auto;
    height: auto;
}

.table-scroll--dense .data-table--dense td .ghost-btn.metric-link-btn {
    min-width: 36px;
    padding: 2px 10px;
}

.table-scroll--dense .data-table--dense .icon-edit-btn {
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
}

.table-scroll--dense .filename-cell {
    gap: 6px;
}

.table-scroll--dense .task-cell-membership {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.table-scroll--dense .task-cell-hint {
    font-size: 10px;
    color: var(--muted);
    line-height: 1.15;
    max-width: 140px;
}

.table-scroll--dense .data-table--dense td[data-label="Error"] {
    font-size: 11px;
    color: rgba(230, 235, 245, 0.82);
    max-width: 260px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(57, 168, 255, 0.14);
    background: rgba(16, 20, 31, 0.9);
    white-space: nowrap;
    line-height: 1.2;
}

.status-badge.active,
.status-badge.success,
.status-badge.completed {
    color: var(--green);
}

.status-badge.error,
.status-badge.failed,
.error-text {
    color: var(--red);
}

.status-badge.running,
.status-badge.pending,
.status-badge.queued {
    color: var(--orange);
}

.log-list {
    display: grid;
    gap: 10px;
}

.log-entry {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(10, 13, 20, 0.9);
}

.progress {
    height: 12px;
    border-radius: 999px;
    background: rgba(16, 20, 31, 0.9);
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--blue), var(--orange));
}

dialog.modal {
    width: min(560px, calc(100vw - 24px));
    max-width: 100%;
    max-height: min(calc(100vh - 24px), 92vh);
    padding: 26px 28px 28px;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--text);
    border: 1px solid rgba(57, 168, 255, 0.16);
    border-radius: 22px;
    background:
        linear-gradient(155deg, rgba(57, 168, 255, 0.09) 0%, transparent 44%),
        linear-gradient(220deg, rgba(255, 122, 47, 0.06) 0%, transparent 46%),
        rgba(11, 15, 22, 0.98);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 28px 64px rgba(6, 8, 14, 0.75),
        0 0 100px rgba(57, 168, 255, 0.07);
    backdrop-filter: blur(20px);
    box-sizing: border-box;
}

dialog.modal::backdrop {
    background: rgba(4, 7, 12, 0.78);
    backdrop-filter: blur(10px);
}

.modal form.stack {
    gap: 16px;
}

.modal h2 {
    margin: 0 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(57, 168, 255, 0.1);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.96);
    line-height: 1.3;
}

#importUsersModal.modal {
    width: min(920px, calc(100vw - 24px));
}

.modal label > span:first-child,
.modal .stack > label > span:first-child {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.92);
}

.modal .modal-actions {
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid rgba(57, 168, 255, 0.1);
    gap: 10px;
    justify-content: flex-end;
}

.modal .modal-actions--split {
    justify-content: space-between;
    align-items: center;
}

.modal .helper-text {
    font-size: 12px;
    line-height: 1.45;
}

.icon-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    border: 1px solid rgba(57, 168, 255, 0.22);
    background: rgba(16, 20, 31, 0.9);
    color: var(--text);
    cursor: pointer;
    flex: 0 0 auto;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.icon-edit-btn:hover {
    border-color: rgba(57, 168, 255, 0.4);
    background: rgba(57, 168, 255, 0.12);
    color: rgba(125, 211, 252, 0.98);
    transform: translateY(-1px);
}

dialog.modal > .modal-toast-anchor {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    gap: 10px;
    margin: 0 0 10px;
    padding: 0;
}

.registration-bg-banner {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9998;
    max-width: min(360px, calc(100vw - 40px));
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: rgba(226, 232, 240, 0.95);
    background: rgba(11, 16, 28, 0.94);
    border: 1px solid rgba(57, 168, 255, 0.35);
    box-shadow: 0 8px 24px rgba(4, 9, 20, 0.35);
}

.registration-bg-banner:hover {
    border-color: rgba(57, 168, 255, 0.55);
    color: #fff;
}

.toast-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    display: grid;
    gap: 10px;
}

.toast {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    background:
        linear-gradient(145deg, rgba(57, 168, 255, 0.08) 0%, transparent 55%),
        rgba(14, 18, 28, 0.96);
    border: 1px solid rgba(57, 168, 255, 0.2);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 12px 40px rgba(8, 11, 18, 0.55);
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.segment {
    border-radius: 14px;
    border: 1px solid rgba(57, 168, 255, 0.2);
    background: rgba(10, 13, 20, 0.88);
    color: var(--muted);
    padding: 12px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.segment:hover:not(.is-active) {
    border-color: rgba(57, 168, 255, 0.32);
    background: rgba(57, 168, 255, 0.07);
    color: rgba(226, 232, 240, 0.88);
}

.segment.is-active {
    color: var(--text);
    border-color: rgba(57, 168, 255, 0.48);
    background: linear-gradient(135deg, rgba(57, 168, 255, 0.14), rgba(57, 168, 255, 0.05));
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        var(--shadow-blue);
    transform: translateY(-1px);
}

.segment:focus-visible {
    outline: 2px solid rgba(57, 168, 255, 0.45);
    outline-offset: 2px;
}

.helper-text {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.form-error {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 90, 90, 0.22);
    background: rgba(255, 90, 90, 0.08);
    color: var(--red);
}

.auth-flow-card {
    padding: 16px;
    border: 1px solid rgba(255, 122, 47, 0.18);
    border-radius: 18px;
    background: rgba(10, 13, 20, 0.7);
}

.auth-flow-card h3 {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mobile-topbar,
.close-sidebar-btn {
    display: none;
}

.icon-btn {
    min-width: 48px;
}

.search-input {
    width: 100%;
    min-width: min(260px, 100%);
    min-height: 46px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(57, 168, 255, 0.22);
    background: rgba(10, 13, 20, 0.92);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
}

.search-input::placeholder {
    color: rgba(148, 163, 184, 0.65);
}

.search-input:hover {
    border-color: rgba(57, 168, 255, 0.34);
}

.search-input:focus-visible {
    outline: none;
    border-color: rgba(57, 168, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(57, 168, 255, 0.12);
}

.inline-action-btn {
    display: inline-flex;
    align-items: center;
    min-width: 92px;
    justify-content: center;
}

.align-center {
    text-align: center !important;
}

.align-right {
    text-align: right !important;
}

@media (max-width: 1279px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .two-column {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    body,
    body.sidebar-hidden {
        grid-template-columns: 1fr;
    }

    body.sidebar-hidden .sidebar {
        visibility: visible;
        opacity: 1;
        width: min(320px, 85vw);
        max-width: none;
        min-width: 0;
        padding: 28px 20px 24px;
        border-right: 1px solid rgba(57, 168, 255, 0.1);
        overflow: visible;
        pointer-events: auto;
    }

    .sidebar-hide-btn,
    .sidebar-restore-btn {
        display: none !important;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 20;
        margin-bottom: 20px;
        padding: 12px 16px;
        border: 1px solid rgba(57, 168, 255, 0.16);
        border-radius: 18px;
        background:
            linear-gradient(135deg, rgba(57, 168, 255, 0.08) 0%, transparent 50%),
            rgba(12, 16, 24, 0.92);
        backdrop-filter: blur(18px);
        box-shadow: 0 4px 24px rgba(8, 11, 18, 0.35);
    }

    .mobile-topbar-title {
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(320px, 85vw);
        max-width: min(320px, 85vw);
        min-width: 0;
        min-height: 100vh;
        min-height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 40;
    }

    .close-sidebar-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(10, 13, 20, 0.6);
        backdrop-filter: blur(2px);
        z-index: 30;
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .page-shell {
        padding: 18px;
    }

    .toolbar,
    .inline-form,
    .modal-actions,
    .card-header,
    .page-header {
        align-items: stretch;
    }

    .search-input,
    .toolbar > *,
    .with-action > .primary-btn {
        width: 100%;
    }

    dialog.modal,
    .modal {
        width: calc(100vw - 20px);
        padding: 18px;
    }
}

@media (max-width: 767px) {
    .auth-card--login {
        margin-top: 0;
        padding: 24px 18px;
    }

    .page-shell {
        padding: 14px;
    }

    .card,
    .table-shell {
        padding: 16px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 28px;
    }

    .data-table {
        min-width: 0;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        padding: 12px 0;
        border-bottom: 1px solid rgba(57, 168, 255, 0.1);
    }

    .data-table td {
        border: 0;
        padding: 8px 0;
        display: grid;
        grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        word-break: break-word;
    }

    .table-scroll--dense .data-table--dense tr {
        padding: 8px 0;
    }

    .table-scroll--dense .data-table--dense td {
        padding: 4px 0;
        gap: 6px;
    }

    .data-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .modal-actions > *,
    .inline-form > *,
    .toolbar > *,
    .page-header .toolbar > * {
        width: 100%;
    }

    .registration-bg-banner {
        left: 14px;
        bottom: 72px;
        max-width: calc(100vw - 28px);
    }

    .toast-root {
        left: 14px;
        right: 14px;
        bottom: 14px;
    }

    .segmented-control {
        grid-template-columns: 1fr;
    }
}