:root {
    --canvas: #f7f2ff;
    --blue: #8b16f5;
    --blue-dark: #6f0dcc;
}

body,
.app-shell,
.admin-page {
    background: #f7f2ff;
}

.admin-page {
    background-image: none;
}

.auth-shell,
.auth-panel {
    background: #f7f2ff;
}

.auth-art {
    color: #1f2a44;
    background:
        radial-gradient(circle at 77% 73%, #ead7ff 0, #f7f2ff 34%, transparent 56%),
        linear-gradient(135deg, #f8f3ff 0%, #f6efff 100%);
}

.auth-art::after {
    background-image:
        linear-gradient(#8b16f50c 1px, transparent 1px),
        linear-gradient(90deg, #8b16f50c 1px, transparent 1px);
}

.brand-light,
.brand-light .brand-muted {
    color: #6f18cd;
}

.brand-light .brand-mark {
    background: linear-gradient(145deg, #a31cff, #7b13de);
    color: #fff;
}

.auth-copy .eyebrow,
.auth-copy em {
    color: #8b16f5;
}

.auth-copy > p:last-child,
.auth-note {
    color: #5b6280;
}

.signal,
.signal-center {
    border-color: #b880fa55;
    background: #ffffffb3;
    box-shadow: 0 16px 30px #8133bf20;
}

.signal-center {
    color: #8b16f5;
}

.line {
    background: linear-gradient(90deg, transparent, #a349ec, transparent);
}

.onboarding-card {
    background: linear-gradient(145deg, #8c1cf4, #55109e);
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    display: flex;
    position: sticky;
    top: 0;
    width: 258px;
    height: 100vh;
    flex: 0 0 258px;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid #e8def7;
    padding: 22px 14px 16px;
    background: #fff;
    box-shadow: 10px 0 30px #5c36820a;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 22px;
    color: #77819a;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.admin-sidebar-brand b {
    color: #1f3154;
}

.admin-sidebar-brand span,
.admin-profile > span {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(145deg, #a01aff, #7e13dc);
    color: #fff;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 5px 17px;
    border: 1px solid #eee5fb;
    border-radius: 12px;
    padding: 10px;
    background: #fbf8ff;
}

.admin-profile > span {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: .72rem;
}

.admin-profile b,
.admin-profile small {
    display: block;
}

.admin-profile b {
    color: #263957;
    font-size: .75rem;
}

.admin-profile small {
    margin-top: 2px;
    color: #8a93a7;
    font-size: .64rem;
}

.admin-sidebar nav {
    flex: 1;
}

.admin-nav-label {
    margin: 17px 11px 6px;
    color: #a0a7b7;
    font-size: .61rem;
    font-weight: 700;
    letter-spacing: .08rem;
}

.admin-side-link {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    border-radius: 10px;
    padding: 10px 12px;
    color: #626e88;
    font-size: .77rem;
    font-weight: 700;
}

.admin-icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.admin-nav-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: #8055c6;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.admin-side-link:hover,
.admin-side-link.active {
    background: linear-gradient(105deg, #9220f8, #7114dc);
    box-shadow: 0 8px 16px #7914d129;
    color: #fff;
}

.admin-side-link:hover .admin-nav-icon,
.admin-side-link.active .admin-nav-icon {
    color: #fff;
}

.admin-sidebar-footer {
    display: grid;
    gap: 7px;
    margin: 14px 5px 0;
    border-top: 1px solid #eee8f6;
    padding: 14px 5px 0;
}

.admin-sidebar-footer > span {
    color: #78839a;
    font-size: .67rem;
}

.admin-sidebar-footer > span b {
    float: right;
    color: #243854;
}

.admin-sidebar-footer a,
.admin-sidebar-footer button {
    border: 0;
    border-radius: 8px;
    padding: 8px;
    background: #f4effc;
    color: #6e16c9;
    font-size: .69rem;
    font-weight: 700;
    text-align: left;
}

.admin-sidebar-footer form {
    margin: 0;
}

.admin-sidebar-footer button {
    width: 100%;
    background: #fff2f4;
    color: #d83b58;
}

.admin-content {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 47px clamp(22px, 4vw, 64px) 70px;
}

.admin-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    max-width: 850px;
    padding: 25px;
}

.admin-form label {
    color: #526078;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    margin-top: 7px;
    border: 1px solid #dedfeb;
    border-radius: 9px;
    padding: 10px 11px;
    background: #fff;
    color: #26354f;
    font: inherit;
    outline-color: #8b16f5;
}

.admin-form textarea {
    min-height: 95px;
    resize: vertical;
}

.admin-form .form-span {
    grid-column: 1 / -1;
}

.admin-form .product-active-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: end;
    min-height: 42px;
    border: 1px solid #e7dffc;
    border-radius: 9px;
    padding: 10px 12px;
    background: #faf7ff;
    color: #6e16c9;
    text-transform: none;
}

.admin-form .product-active-toggle input {
    width: 16px;
    margin: 0;
    accent-color: #8b16f5;
}

.admin-form .form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
}

.admin-form .form-actions > a {
    color: #68758d;
    font-size: .75rem;
    font-weight: 700;
}

.admin-main {
    min-width: 0;
    flex: 1;
}

.admin-topbar {
    display: flex;
    position: sticky;
    z-index: 3;
    top: 0;
    height: 70px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee7f8;
    padding: 0 clamp(22px, 4vw, 64px);
    background: #fffdfdf0;
    backdrop-filter: blur(12px);
}

.admin-topbar-start,
.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-sidebar-toggle {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: #f1e9ff;
    color: #7416cd;
    font-size: .95rem;
}

.admin-crumb {
    color: #7d879b;
    font-size: .72rem;
    font-weight: 700;
}

.admin-crumb b {
    margin: 0 5px;
    color: #c2c7d0;
}

.admin-topbar-title {
    max-width: min(52vw, 680px);
    overflow: hidden;
    margin: 0;
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(.92rem, 1.35vw, 1.12rem);
    font-weight: 800;
    letter-spacing: -.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Page titles live in the persistent purple bar; content headers retain actions only. */
.admin-content > .admin-heading > div:first-child,
.admin-content > .plan-admin-head > div:first-child {
    display: none;
}

.admin-content > .admin-heading,
.admin-content > .plan-admin-head {
    min-height: 0;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.admin-content > .admin-heading:not(:has(> :nth-child(2))),
.admin-content > .plan-admin-head:not(:has(> :nth-child(2))) {
    display: none;
}

.admin-dashboard-content {
    padding-top: 18px;
}

.admin-dashboard-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(16px, 1.6vw, 24px);
    align-items: center;
    margin-bottom: 18px;
}

.admin-dashboard-summary-row .admin-metrics {
    margin: 0;
}

.admin-dashboard-summary-row > .admin-primary {
    margin: 0;
    white-space: nowrap;
}

.admin-topbar-balance {
    border: 1px solid #e3d8f6;
    border-radius: 999px;
    padding: 7px 10px;
    color: #31435f;
    font-size: .69rem;
    font-weight: 700;
}

.admin-topbar-actions a {
    border-radius: 999px;
    padding: 8px 11px;
    background: #283956;
    color: #fff;
    font-size: .67rem;
    font-weight: 700;
}

.admin-avatar {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    border-radius: 10px;
    background: #8b16f5;
    color: #fff;
    font-size: .71rem;
    font-weight: 700;
}

.admin-shell.sidebar-collapsed .admin-sidebar {
    width: 76px;
    flex-basis: 76px;
    padding-right: 10px;
    padding-left: 10px;
}

.admin-shell.sidebar-collapsed .admin-sidebar-brand {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
    font-size: 0;
}

.admin-shell.sidebar-collapsed .admin-profile {
    justify-content: center;
    margin-right: 0;
    margin-left: 0;
    padding: 8px;
}

.admin-shell.sidebar-collapsed .admin-profile div,
.admin-shell.sidebar-collapsed .admin-nav-label,
.admin-shell.sidebar-collapsed .admin-side-link:not(.active)::after,
.admin-shell.sidebar-collapsed .admin-sidebar-footer > span,
.admin-shell.sidebar-collapsed .admin-sidebar-footer a {
    display: none;
}

.admin-shell.sidebar-collapsed .admin-side-link {
    justify-content: center;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0;
}

.admin-shell.sidebar-collapsed .admin-nav-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.admin-shell.sidebar-collapsed .admin-sidebar-footer {
    margin-right: 0;
    margin-left: 0;
}

.admin-shell.sidebar-collapsed .admin-sidebar-footer button {
    font-size: 0;
    text-align: center;
}

.admin-shell.sidebar-collapsed .admin-sidebar-footer button::before {
    content: "⇥";
    font-size: .9rem;
}

.user-filter {
    grid-template-columns: minmax(260px, 2fr) minmax(150px, .8fr) minmax(150px, .8fr) auto;
}

.user-directory {
    overflow: hidden;
}

.user-directory-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 25px;
    border-bottom: 1px solid #eee8f6;
}

.user-directory-head span,
.user-directory-head small,
.user-directory-head b {
    display: block;
}

.user-directory-head span {
    color: #293b59;
    font-size: .87rem;
    font-weight: 800;
}

.user-directory-head small {
    margin-top: 4px;
    color: #8a94a6;
    font-size: .66rem;
}

.user-directory-head b {
    border-radius: 999px;
    padding: 7px 10px;
    background: #f1e7ff;
    color: #7914dc;
    font-size: .65rem;
    white-space: nowrap;
}

.user-directory-columns,
.user-directory-row {
    display: grid;
    grid-template-columns: minmax(270px, 1.45fr) minmax(190px, 1fr) minmax(115px, .56fr) minmax(245px, .95fr);
    gap: 22px;
}

.user-directory-columns {
    padding: 13px 25px 11px;
    background: #fcfaff;
    color: #8b94a7;
    font-size: .61rem;
    font-weight: 800;
    letter-spacing: .07rem;
    text-transform: uppercase;
}

.user-directory-row {
    align-items: center;
    padding: 20px 25px;
    border-top: 1px solid #f0ebf6;
    transition: background .16s ease;
}

.user-directory-row:hover {
    background: #fcfaff;
}

.user-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 1px solid #e8dbfa;
    border-radius: 13px;
    background: linear-gradient(145deg, #f4eaff, #e9d5ff);
    color: #7416cd;
    font-size: .88rem;
    font-weight: 800;
}

.user-identity small,
.user-identity strong,
.user-identity p,
.user-identity span {
    display: block;
}

.user-id {
    margin-bottom: 3px;
    color: #9ba2b2;
    font-size: .59rem;
    font-weight: 700;
}

.user-identity strong {
    overflow: hidden;
    color: #243654;
    font-size: .79rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-identity p,
.user-identity span {
    overflow: hidden;
    margin: 4px 0 0;
    color: #77839a;
    font-size: .67rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-identity span {
    margin-top: 2px;
    color: #8e97a9;
}

.user-service-summary small,
.user-service-summary strong,
.user-service-summary span {
    display: block;
}

.user-service-summary small {
    color: #9aa1b0;
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .03rem;
    text-transform: uppercase;
}

.user-service-summary strong {
    overflow: hidden;
    margin-top: 5px;
    color: #364a69;
    font-size: .73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-service-summary span {
    margin-top: 5px;
    color: #16806b;
    font-size: .65rem;
    font-weight: 700;
}

.user-access-summary {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.user-role-pill {
    border-radius: 999px;
    padding: 5px 8px;
    background: #e6f5ec;
    color: #178153;
    font-size: .58rem;
    font-weight: 800;
    text-transform: uppercase;
}

.user-role-pill.admin {
    background: #eee4ff;
    color: #7817cf;
}

.user-activity {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #728097;
    font-size: .65rem;
    font-weight: 700;
}

.user-activity i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #98a2b3;
}

.user-activity.active { color: #168153; }
.user-activity.active i { background: #1aae73; box-shadow: 0 0 0 3px #dcf8e9; }
.user-activity.inactive { color: #b25b67; }
.user-activity.inactive i { background: #db6274; }

.user-list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
}

.user-list-actions form { margin: 0; }

.user-list-link {
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    border: 1px solid #e5ddf2;
    border-radius: 8px;
    padding: 6px 8px;
    background: #fff;
    color: #506686;
    font-family: inherit;
    font-size: .63rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.user-list-link:hover { border-color: #cdb6ef; color: #7416cd; }

.user-list-link-primary {
    border-color: #8b16f5;
    background: linear-gradient(105deg, #9220f8, #7114dc);
    color: #fff;
}

.user-list-link-primary:hover { border-color: #7416cd; color: #fff; }

.user-list-link-danger { color: #cf4660; }
.user-list-link-danger:hover { border-color: #f2b9c4; color: #bd2d4b; }

.user-directory-empty {
    padding: 47px 25px;
    text-align: center;
}

.user-directory-empty span,
.user-directory-empty strong,
.user-directory-empty p { display: block; }
.user-directory-empty span { color: #9d6dd3; font-size: 1.35rem; }
.user-directory-empty strong { margin-top: 9px; color: #41516c; font-size: .8rem; }
.user-directory-empty p { margin: 5px 0 0; color: #8b95a7; font-size: .7rem; }

.return-admin-form { margin: 0; }

.return-admin-button {
    border: 1px solid #e0cef9;
    border-radius: 9px;
    padding: 8px 10px;
    background: #faf6ff;
    color: #7416cd;
    font-family: inherit;
    font-size: .67rem;
    font-weight: 800;
    cursor: pointer;
}

.return-admin-button:hover { background: #f0e4ff; }

@media (max-width: 820px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        position: static;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 14px;
    }

    .admin-sidebar nav {
        display: flex;
        gap: 5px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .admin-nav-label,
    .admin-profile,
    .admin-sidebar-footer > span {
        display: none;
    }

    .admin-side-link {
        flex: 0 0 auto;
        margin: 0;
    }

    .admin-sidebar-footer {
        display: flex;
        margin: 10px 0 0;
        border-top: 0;
        padding: 0;
    }

    .admin-sidebar-footer a,
    .admin-sidebar-footer form {
        flex: 1;
    }

    .admin-sidebar-footer button {
        text-align: center;
    }

    .admin-content {
        width: 100%;
        padding-top: 32px;
    }

    .admin-dashboard-content {
        padding-top: 16px;
    }

    .admin-dashboard-summary-row {
        grid-template-columns: 1fr;
        margin-bottom: 14px;
    }

    .admin-dashboard-summary-row > .admin-primary {
        width: 100%;
        text-align: center;
    }

    .admin-form {
        grid-template-columns: 1fr;
        padding: 19px;
    }

    .admin-form .form-span {
        grid-column: auto;
    }

    .user-filter {
        grid-template-columns: 1fr 1fr;
    }

    .user-filter > :first-child,
    .user-filter .admin-primary {
        grid-column: 1 / -1;
    }

    .user-directory-columns {
        display: none;
    }

    .user-directory-row {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }

    .user-identity,
    .user-list-actions {
        grid-column: 1 / -1;
    }

    .admin-topbar {
        height: 60px;
        padding: 0 15px;
    }

    .admin-topbar-title {
        max-width: calc(100vw - 145px);
        font-size: .86rem;
    }

    .admin-crumb,
    .admin-topbar-balance,
    .admin-topbar-actions a {
        display: none;
    }

    .admin-shell.sidebar-collapsed .admin-sidebar {
        width: 100%;
        flex-basis: auto;
        padding: 14px;
    }

    .admin-shell.sidebar-collapsed .admin-sidebar-brand,
    .admin-shell.sidebar-collapsed .admin-profile,
    .admin-shell.sidebar-collapsed .admin-side-link {
        display: flex;
    }

    .admin-shell.sidebar-collapsed .admin-sidebar-brand {
        justify-content: flex-start;
        font-size: .83rem;
    }

    .admin-shell.sidebar-collapsed .admin-side-link {
        padding: 9px 11px;
        font-size: .76rem;
    }

    .admin-shell.sidebar-collapsed .admin-nav-icon {
        width: 17px;
        height: 17px;
        flex-basis: 17px;
    }
}

@media (max-width: 520px) {
    .user-directory-head,
    .user-directory-row {
        padding-right: 17px;
        padding-left: 17px;
    }

    .user-directory-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .user-identity,
    .user-list-actions {
        grid-column: auto;
    }

    .user-list-actions { gap: 5px; }
}
