/*
 * Portal B Shell v1
 *
 * Это намеренно простой технический baseline.
 * Основные visual tokens собраны в :root, чтобы дизайнеру было удобно менять
 * цвета, размеры и отступы без затрагивания backend-кода.
 */
:root {
    --portal-bg: #f4f6f8;
    --portal-surface: #ffffff;
    --portal-sidebar: #18202a;
    --portal-sidebar-text: #f8fafc;
    --portal-text: #18202a;
    --portal-muted: #667085;
    --portal-border: #e4e7ec;
    --portal-accent: #2563eb;
    --portal-success: #15803d;
    --portal-radius: 16px;
    --portal-sidebar-width: 240px;
    --portal-header-height: 76px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--portal-bg);
    color: var(--portal-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
}

.portal-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--portal-sidebar-width) minmax(0, 1fr);
}

.portal-sidebar {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 24px 18px;
    background: var(--portal-sidebar);
    color: var(--portal-sidebar-text);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    color: inherit;
    text-decoration: none;
}

.portal-brand__mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--portal-accent);
    font-size: 18px;
    font-weight: 700;
}

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

.portal-brand small {
    margin-top: 2px;
    color: #aeb8c5;
    font-size: 12px;
}

.portal-nav {
    display: grid;
    gap: 6px;
}

.portal-nav__link {
    display: block;
    padding: 11px 12px;
    border-radius: 10px;
    color: #d8dee8;
    text-decoration: none;
}

.portal-nav__link--active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
}

.portal-nav__link--disabled {
    opacity: 0.48;
    cursor: default;
}

.portal-sidebar__footer {
    margin-top: auto;
    padding: 14px 10px 4px;
    color: #aeb8c5;
    font-size: 12px;
}

.portal-sidebar__footer strong {
    display: block;
    margin-top: 4px;
    color: #ffffff;
}

.portal-main {
    min-width: 0;
}

.portal-header {
    min-height: var(--portal-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--portal-border);
    background: var(--portal-surface);
}

.portal-header__eyebrow,
.page-heading__eyebrow {
    display: block;
    margin: 0 0 4px;
    color: var(--portal-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-header__title {
    font-size: 18px;
}

.portal-header__status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--portal-muted);
    font-size: 14px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--portal-success);
}

.portal-content {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 48px 32px;
}

.page-heading {
    max-width: 760px;
    margin-bottom: 32px;
}

.page-heading h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.1;
}

.page-heading__lead {
    margin: 16px 0 0;
    color: var(--portal-muted);
    font-size: 17px;
    line-height: 1.65;
}

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

.dashboard-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
}

.dashboard-card__label {
    color: var(--portal-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-card h2 {
    margin: 14px 0 10px;
    font-size: 20px;
}

.dashboard-card p {
    margin: 0;
    color: var(--portal-muted);
    line-height: 1.55;
}

.dashboard-card__state {
    align-self: flex-start;
    margin-top: auto;
    padding-top: 24px;
    color: var(--portal-muted);
    font-size: 13px;
    font-weight: 600;
}

.dashboard-card__state--ready {
    color: var(--portal-success);
}

@media (max-width: 960px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

    .portal-sidebar {
        min-height: auto;
        gap: 18px;
        padding: 18px;
    }

    .portal-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
    }

    .portal-nav__link {
        white-space: nowrap;
    }

    .portal-sidebar__footer {
        display: none;
    }

    .portal-header {
        min-height: auto;
        padding: 16px 20px;
    }

    .portal-header__status {
        display: none;
    }

    .portal-content {
        padding: 32px 20px;
    }
}
/*
 * Authentication baseline.
 *
 * Эти стили технические и намеренно используют существующие Portal tokens.
 * Дизайнер сможет позже заменить visual presentation, не меняя auth-логику.
 */
.portal-header__account {
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-header__account form {
    margin: 0;
}

.portal-user {
    min-width: 0;
    text-align: right;
}

.portal-user__label {
    display: block;
    margin-bottom: 2px;
    color: var(--portal-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portal-user strong {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.portal-button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.portal-button--primary {
    background: var(--portal-accent);
    color: #ffffff;
}

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

.auth-panel {
    width: min(520px, 100%);
    margin: 32px auto;
    padding: 32px;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    background: var(--portal-surface);
}

.auth-panel__heading {
    margin-bottom: 28px;
}

.auth-panel__heading h1 {
    margin: 0;
    font-size: 32px;
}

.auth-panel__heading p,
.auth-panel__note {
    color: var(--portal-muted);
    line-height: 1.6;
}

.auth-panel__heading p {
    margin: 12px 0 0;
}

.auth-panel__note {
    margin: 24px 0 0;
    font-size: 13px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.form-field {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--portal-text);
    font: inherit;
}

.form-field input:focus {
    outline: 2px solid color-mix(in srgb, var(--portal-accent) 30%, transparent);
    border-color: var(--portal-accent);
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--portal-muted);
    font-size: 14px;
}

.auth-validation,
.field-validation {
    color: #b42318;
    font-size: 13px;
}

.auth-validation:empty,
.field-validation:empty {
    display: none;
}
/* Auth-11 protected admin UI
 *
 * Визуальные идеи адаптированы из design/portal-shell:
 * синий градиент sidebar, компактные nav items и светлая рабочая поверхность.
 * Реализация остаётся обычным Razor Pages/CSS текущего Portal B.
 */
.portal-sidebar {
    gap: 24px;
    padding: 22px 14px 16px;
    background:
        linear-gradient(
            180deg,
            #073d85 0%,
            #052f6c 48%,
            #032454 100%
        );
}

.portal-brand {
    padding: 0 8px 10px;
}

.portal-brand small,
.portal-sidebar__footer {
    color: rgba(255, 255, 255, 0.58);
}

.portal-nav {
    gap: 4px;
}

.portal-nav__link {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.76);
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        color 0.16s ease;
}

.portal-nav__link:hover:not(.portal-nav__link--disabled) {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.portal-nav__link--active {
    border-color: rgba(76, 144, 255, 0.38);
    background:
        linear-gradient(
            90deg,
            rgba(30, 111, 230, 0.72),
            rgba(29, 101, 205, 0.48)
        );
    color: #ffffff;
    font-weight: 600;
}

.portal-nav__icon {
    width: 24px;
    flex: 0 0 24px;
    color: #a8ccff;
    font-size: 18px;
    line-height: 1;
    text-align: center;
}

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

.admin-page__heading {
    max-width: 900px;
}

.admin-summary {
    display: grid;
    grid-template-columns:
        minmax(180px, 0.7fr)
        minmax(260px, 1.3fr);
    gap: 16px;
    margin-bottom: 20px;
}

.admin-summary__item {
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    background: var(--portal-surface);
}

.admin-summary__item span,
.admin-summary__item strong {
    display: block;
}

.admin-summary__item span {
    margin-bottom: 8px;
    color: var(--portal-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-summary__item strong {
    overflow-wrap: anywhere;
    font-size: 20px;
}

.admin-table-card {
    overflow: hidden;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    background: var(--portal-surface);
}

.admin-table-scroll {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 17px 18px;
    border-bottom: 1px solid var(--portal-border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    background: #f8fafc;
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-user__name,
.admin-user__email,
.admin-user__id,
.admin-email-state {
    display: block;
}

.admin-user__name {
    margin-bottom: 5px;
    font-size: 14px;
}

.admin-user__id {
    max-width: 230px;
    overflow: hidden;
    color: var(--portal-muted);
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-user__email {
    margin-bottom: 7px;
    font-size: 13px;
}

.admin-email-state {
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 600;
}

.admin-email-state--confirmed {
    color: var(--portal-success);
}

.admin-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.35;
}

.admin-chip--role {
    background: #eef4ff;
    color: #1849a9;
}

.admin-chip--permission {
    background: #f2f4f7;
    color: #344054;
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;
}

.admin-muted,
.admin-empty {
    color: var(--portal-muted);
}

.admin-muted {
    font-size: 12px;
}

.admin-empty {
    padding: 28px;
}

@media (max-width: 760px) {
    .portal-nav {
        display: flex;
        gap: 8px;
    }

    .portal-nav__link {
        min-height: 44px;
        white-space: nowrap;
    }

    .admin-summary {
        grid-template-columns: 1fr;
    }
}
/* Auth-12 role editor
 *
 * Продолжаем визуальный язык Auth-11/design prototype:
 * компактные controls внутри светлой административной таблицы.
 */
.admin-summary {
    grid-template-columns:
        repeat(3, minmax(180px, 1fr));
}

.admin-table--roles {
    min-width: 1080px;
}

.admin-alert {
    margin: -12px 0 20px;
    padding: 13px 15px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: var(--portal-surface);
    font-size: 13px;
    line-height: 1.5;
}

.admin-alert--success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: #067647;
}

.admin-alert--error {
    border-color: #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.admin-alert--info {
    border-color: #b2ddff;
    background: #eff8ff;
    color: #175cd3;
}

.admin-role-form {
    min-width: 270px;
}

.admin-role-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.admin-role-legend {
    margin-bottom: 8px;
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-role-options {
    display: grid;
    gap: 7px;
}

.admin-role-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    padding: 8px 9px;
    border: 1px solid var(--portal-border);
    border-radius: 7px;
    background: #ffffff;
    cursor: pointer;
}

.admin-role-option:hover {
    border-color: #b2ccff;
    background: #f8faff;
}

.admin-role-option input {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
}

.admin-role-option strong,
.admin-role-option code {
    display: block;
}

.admin-role-option strong {
    margin-bottom: 2px;
    font-size: 12px;
}

.admin-role-option code {
    color: var(--portal-muted);
    font-size: 10px;
}

.admin-role-save {
    width: 100%;
    min-height: 36px;
    margin-top: 10px;
    padding: 7px 11px;
    font-size: 12px;
}

.admin-permission-note {
    display: block;
    margin-top: 8px;
    color: var(--portal-muted);
    font-size: 10px;
    line-height: 1.45;
}

@media (max-width: 760px) {
    .admin-summary {
        grid-template-columns: 1fr;
    }
}
/* Auth-13 account lifecycle */
.portal-header__account {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.auth-forced-note {
    margin: -8px 0 22px;
    padding: 12px 14px;
    border: 1px solid #fedf89;
    border-radius: 8px;
    background: #fffaeb;
    color: #93370d;
    font-size: 13px;
    line-height: 1.5;
}

.admin-page__heading--actions {
    max-width: none;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.admin-page__heading--actions > div {
    max-width: 900px;
}

.admin-table--accounts {
    min-width: 1280px;
}

.admin-password-state {
    display: block;
    margin-top: 8px;
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 600;
}

.admin-password-state--temporary {
    color: #b54708;
}

.admin-account-action {
    min-height: 36px;
    padding: 7px 11px;
    font-size: 12px;
    white-space: nowrap;
}

.admin-editor-page {
    max-width: 920px;
    margin: 0 auto;
}

.admin-editor-card {
    padding: 24px;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    background: var(--portal-surface);
}

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

.admin-form-grid--password {
    max-width: 680px;
}

.admin-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.admin-password-note {
    margin: 18px 0 0;
    color: var(--portal-muted);
    font-size: 12px;
    line-height: 1.55;
}

.admin-target-user {
    display: grid;
    gap: 4px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: #f8fafc;
}

.admin-target-user span {
    color: var(--portal-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-target-user code {
    color: var(--portal-muted);
    font-size: 12px;
}

@media (max-width: 760px) {
    .admin-page__heading--actions {
        display: block;
    }

    .admin-page__heading--actions .portal-button {
        margin-top: 18px;
    }

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

    .portal-header__account {
        gap: 8px;
    }
}
/* Auth-14 account status */
.admin-account-state {
    display: block;
    margin: 8px 0 5px;
    font-size: 11px;
    font-weight: 700;
}

.admin-account-state--active {
    color: var(--portal-success);
}

.admin-account-state--disabled {
    color: #b42318;
}

.admin-user-row--disabled {
    background: #fffbfa;
}

.admin-user-row--disabled .admin-user__name {
    color: #912018;
}

.admin-account-actions {
    display: grid;
    gap: 8px;
    min-width: 150px;
}

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

.portal-button--danger {
    border-color: #fecdca;
    background: #fff;
    color: #b42318;
}

.portal-button--danger:hover {
    border-color: #f04438;
    background: #fef3f2;
}
/* Auth-16 role catalog management
 *
 * Продолжаем визуальный язык design/portal-shell:
 * компактные действия, светлые карточки, технические machine keys
 * и чёткое разделение editable/read-only authorization data.
 */
.admin-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.admin-role-create-card {
    display: grid;
    grid-template-columns:
        minmax(240px, 1.2fr)
        minmax(180px, 0.8fr)
        minmax(220px, 1fr)
        auto;
    gap: 16px;
    align-items: end;
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #c7d7f5;
    border-radius: 12px;
    background:
        linear-gradient(
            135deg,
            #f7faff 0%,
            #ffffff 58%
        );
}

.admin-role-create-card__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #175cd3;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.admin-role-create-card strong,
.admin-role-create-card p {
    display: block;
}

.admin-role-create-card p {
    margin: 7px 0 0;
    color: var(--portal-muted);
    font-size: 12px;
    line-height: 1.5;
}

.admin-table--role-management {
    min-width: 1120px;
}

.admin-role-title,
.admin-role-key,
.admin-built-in-badge,
.admin-role-count,
.admin-role-delete-note {
    display: block;
}

.admin-role-title {
    margin-bottom: 5px;
    font-size: 14px;
}

.admin-role-key {
    color: #344054;
    font-size: 11px;
}

.admin-built-in-badge {
    width: fit-content;
    margin-top: 8px;
    padding: 3px 7px;
    border-radius: 999px;
    background: #eef4ff;
    color: #1849a9;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-role-count {
    min-width: 36px;
    font-size: 20px;
    font-weight: 700;
}

.admin-role-management-form {
    display: flex;
    min-width: 290px;
    gap: 8px;
    align-items: center;
}

.admin-role-management-form input[type="text"] {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--portal-text);
    font: inherit;
    font-size: 13px;
}

.admin-role-management-form input[type="text"]:focus {
    outline: 2px solid color-mix(in srgb, var(--portal-accent) 25%, transparent);
    border-color: var(--portal-accent);
}

.admin-role-delete-note {
    max-width: 220px;
    color: var(--portal-muted);
    font-size: 11px;
    line-height: 1.45;
}

@media (max-width: 980px) {
    .admin-role-create-card {
        grid-template-columns: 1fr 1fr;
    }

    .admin-role-create-card > div:first-child {
        grid-column: 1 / -1;
    }
}

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

    .admin-heading-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-role-create-card {
        grid-template-columns: 1fr;
    }

    .admin-role-create-card > div:first-child {
        grid-column: auto;
    }
}
/* Auth-16 visual review refinement
 *
 * Реальный browser review показал, что исходная таблица ролей имела
 * горизонтальный overflow в обычном desktop viewport и обрезала правую
 * колонку удаления. Эти override-правила оставляют ту же таблицу, но
 * позволяют ей укладываться в рабочую область Portal.
 */
.admin-table--role-management {
    min-width: 920px;
    table-layout: fixed;
}

.admin-table--role-management th,
.admin-table--role-management td {
    padding-right: 12px;
    padding-left: 12px;
}

.admin-table--role-management th:nth-child(1),
.admin-table--role-management td:nth-child(1) {
    width: 18%;
}

.admin-table--role-management th:nth-child(2),
.admin-table--role-management td:nth-child(2) {
    width: 10%;
}

.admin-table--role-management th:nth-child(3),
.admin-table--role-management td:nth-child(3) {
    width: 20%;
}

.admin-table--role-management th:nth-child(4),
.admin-table--role-management td:nth-child(4) {
    width: 34%;
}

.admin-table--role-management th:nth-child(5),
.admin-table--role-management td:nth-child(5) {
    width: 18%;
}

.admin-role-management-form {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.admin-role-delete-note {
    max-width: none;
    overflow-wrap: anywhere;
}

@media (max-width: 1080px) {
    .admin-table--role-management {
        min-width: 860px;
    }
}
/* Auth-16 final column spacing */
.admin-table--role-management th:nth-child(2),
.admin-table--role-management td:nth-child(2) {
    padding-right: 18px;
}

.admin-table--role-management th:nth-child(3),
.admin-table--role-management td:nth-child(3) {
    padding-left: 18px;
}
/* Auth-17 local permission editor */
.admin-table--role-management th:nth-child(1),
.admin-table--role-management td:nth-child(1) { width: 16%; }

.admin-table--role-management th:nth-child(2),
.admin-table--role-management td:nth-child(2) { width: 9%; }

.admin-table--role-management th:nth-child(3),
.admin-table--role-management td:nth-child(3) { width: 34%; }

.admin-table--role-management th:nth-child(4),
.admin-table--role-management td:nth-child(4) { width: 25%; }

.admin-table--role-management th:nth-child(5),
.admin-table--role-management td:nth-child(5) { width: 16%; }

.admin-permission-editor {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.admin-permission-options {
    display: grid;
    gap: 7px;
}

.admin-permission-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    padding: 9px 10px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.admin-permission-option:hover {
    border-color: #b2ccff;
    background: #f8faff;
}

.admin-permission-option--required {
    border-color: #c7d7f5;
    background: #f7faff;
    cursor: default;
}

.admin-permission-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
}

.admin-permission-option strong,
.admin-permission-option code,
.admin-permission-option small,
.admin-permission-option em { display: block; }

.admin-permission-option strong { margin-bottom: 3px; font-size: 12px; }
.admin-permission-option code { margin-bottom: 4px; color: #344054; font-size: 10px; }
.admin-permission-option small { color: var(--portal-muted); font-size: 10px; line-height: 1.4; }
.admin-permission-option em {
    margin-top: 5px;
    color: #175cd3;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
}

.admin-permission-save {
    width: fit-content;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
}

.admin-external-permissions {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--portal-border);
}

.admin-external-permissions__title {
    color: #344054;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

@media (max-width: 1080px) {
    .admin-table--role-management { min-width: 980px; }
}
/* Auth-18 own profile
 *
 * Profile остаётся обычной server-side Razor Page.
 * Email пока read-only; самостоятельное подтверждение email появится в Auth-21.
 */
.profile-page {
    width: min(980px, 100%);
    margin: 0 auto;
}

.profile-status {
    margin: 0 0 20px;
    padding: 13px 16px;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: var(--portal-surface);
    font-size: 14px;
}

.profile-status--success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.profile-status--error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
    gap: 20px;
    align-items: start;
}

.profile-card {
    padding: 24px;
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    background: var(--portal-surface);
}

.profile-card__heading {
    margin-bottom: 22px;
}

.profile-card__heading h2 {
    margin: 4px 0 8px;
    font-size: 20px;
}

.profile-card__heading p {
    margin: 0;
    color: var(--portal-muted);
    line-height: 1.55;
}

.profile-card__eyebrow {
    color: var(--portal-accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.profile-readonly {
    display: grid;
    gap: 5px;
    padding: 14px 16px;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: #f8fafc;
}

.profile-readonly__label {
    color: var(--portal-muted);
    font-size: 12px;
    font-weight: 600;
}

.profile-readonly strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.profile-readonly small {
    color: var(--portal-muted);
    line-height: 1.45;
}

.profile-card--security .portal-button {
    width: 100%;
}

@media (max-width: 820px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

/* TRIAL-02: layout страницы администрирования trial.
 *
 * Таблица trial имеет три колонки, а общий admin-table--role-management
 * рассчитан на таблицу ролей с пятью колонками. Эти правила ограничены
 * только страницей /Admin/Trials.
 */
.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management {
    min-width: 900px;
    table-layout: fixed;
}

.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management th:nth-child(1),
.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management td:nth-child(1) {
    width: 28%;
}

.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management th:nth-child(2),
.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management td:nth-child(2) {
    width: 54%;
}

.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management th:nth-child(3),
.admin-page[aria-labelledby="admin-trials-title"]
.admin-table--role-management td:nth-child(3) {
    width: 18%;
}

/* Настройки trial идут вертикально, чтобы поле длительности,
 * checkbox и кнопка не накладывались друг на друга.
 */
.admin-page[aria-labelledby="admin-trials-title"]
.admin-role-management-form {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.admin-page[aria-labelledby="admin-trials-title"]
.admin-role-management-form .form-field,
.admin-page[aria-labelledby="admin-trials-title"]
.admin-role-management-form .admin-permission-option {
    min-width: 0;
}

.admin-page[aria-labelledby="admin-trials-title"]
.admin-role-management-form .portal-button {
    justify-self: start;
}

