.organization-modal__dialog {
    width: min(100% - 1.5rem, 640px);
    max-width: 640px;
    min-width: 0;
    overflow-x: hidden;
}

.organization-modal {
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--fc-color-palette-dfe7f2);
    border-radius: 20px;
    background: var(--fc-color-surface);
    box-shadow: 0 24px 70px rgba(var(--fc-color-shadow-rgb), 0.2);
}

.fc-dropdown-section-label {
    display: block;
    padding: .35rem .85rem .25rem;
    color: var(--fc-color-text-muted);
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.fc-account-context-item {
    align-items: center;
    gap: .6rem;
}

.fc-account-context-item__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: .1rem;
}

.fc-account-context-item__name {
    display: block;
    max-width: 100%;
}

.fc-account-context-item__role {
    display: block;
    max-width: 100%;
    color: var(--fc-color-text-muted);
    font-weight: 500;
}

.fc-account-context-item.is-current {
    background: var(--fc-color-success-soft);
}

.fc-dropdown-submenu {
    position: relative;
}

.fc-dropdown-item--has-submenu {
    justify-content: flex-start;
}

.fc-dropdown-submenu-caret {
    font-size: .8rem;
    opacity: .55;
}

.fc-dropdown-submenu-panel {
    position: absolute;
    top: -6px;
    left: calc(100% + 6px);
    z-index: 1080;
    display: none;
    min-width: 220px;
    max-width: 280px;
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: 16px;
    border: 1px solid var(--fc-color-palette-rgba-15-23-42-0p07);
    box-shadow:
        0 8px 32px rgba(var(--fc-color-shadow-rgb), .1),
        0 2px 8px rgba(var(--fc-color-shadow-rgb), .04);
    background: var(--fc-color-palette-rgba-255-255-255-0p98);
    backdrop-filter: blur(16px);
}

.fc-dropdown-submenu.is-open .fc-dropdown-submenu-panel {
    display: block;
}

.fc-dropdown-submenu.fc-dropdown-submenu--left .fc-dropdown-submenu-panel {
    left: auto;
    right: calc(100% + 6px);
}

.organization-invite-page {
    display: flex;
    justify-content: center;
    padding: min(10vh, 5rem) 1rem;
}

.organization-invite-card {
    width: min(100%, 480px);
    padding: 1.25rem;
    border: 1px solid var(--fc-modal-border);
    border-radius: 18px;
    background: var(--fc-modal-surface);
    box-shadow: var(--fc-modal-shadow);
}

.organization-invite-brand {
    display: grid;
    justify-items: center;
    margin: .15rem 0 1.3rem;
}

.organization-invite-brand__name {
    max-width: 100%;
    margin: 0;
    color: var(--fc-color-text);
    font-size: 1.15rem;
    font-weight: 700;
}

.organization-invite-form {
    display: grid;
    gap: .75rem;
}

.organization-invite-field {
    display: grid;
    gap: .3rem;
    color: var(--fc-color-text);
    font-size: .8rem;
    font-weight: 600;
}

.organization-invite-success {
    padding: 1rem;
    border-radius: 12px;
    color: var(--fc-color-success-text);
    background: var(--fc-color-success-soft);
    text-align: center;
    font-weight: 700;
}

.organization-invite-state {
    padding: .9rem;
    border-radius: 10px;
    color: var(--fc-color-warning-text);
    background: var(--fc-color-warning-soft);
    font-size: .88rem;
    font-weight: 700;
    text-align: center;
}

.organization-invite-input-group {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.organization-invite-input-group .form-control,
.organization-invite-input-group .form-select {
    min-width: 0;
    flex: 1 1 auto;
}

.organization-invite-select-readonly {
    pointer-events: none;
    color: var(--fc-color-text-muted);
    background-color: var(--fc-color-surface-soft);
}

/* Header */

.organization-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    padding: 1.25rem 1.25rem 1.1rem;
    border-bottom: 1px solid var(--fc-color-palette-edf2f7);
}

.organization-modal__heading {
    min-width: 0;
}

.organization-modal__title {
    margin: 0;
    color: var(--fc-color-text);
    font-size: 1.2rem;
    font-weight: 800;
}

.organization-modal__subtitle {
    margin: .25rem 0 0;
    color: var(--fc-color-text-muted);
    font-size: .82rem;
}

.organization-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    color: var(--fc-color-palette-71839c);
    background: transparent;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.organization-modal__close:hover,
.organization-modal__close:focus-visible {
    color: var(--fc-color-palette-304766);
    background: var(--fc-color-palette-f3f6fa);
}

.organization-modal__body {
    min-width: 0;
    min-height: 220px;
    max-height: min(78vh, 720px);
    padding: 1.1rem 1.25rem 1.35rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.organization-modal__body > * {
    min-width: 0;
    max-width: 100%;
}

.organization-modal__body .row,
.organization-modal__body .organization-section,
.organization-modal__body .organization-summary,
.organization-modal__body .organization-connector-card {
    max-width: 100%;
}

/* Summary */

.organization-summary {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 16px;
    background: linear-gradient(135deg, var(--fc-color-surface-soft) 0%, var(--fc-color-surface) 100%);
}

.organization-summary__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 14px;
    color: var(--fc-color-primary-hover);
    background: linear-gradient(135deg, var(--fc-color-palette-eefaf2) 0%, var(--fc-color-palette-defbe9) 100%);
    box-shadow: 0 8px 18px rgba(var(--fc-color-shadow-brand-rgb), .14);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.organization-summary__details {
    min-width: 0;
    width: 100%;
    display: grid;
    gap: .3rem;
}

.organization-summary__name {
    margin: 0;
    color: var(--fc-color-text);
    font-size: 1.08rem;
    font-weight: 800;
    max-width: 100%;
}

.organization-summary__login {
    margin-top: .1rem;
    overflow-wrap: anywhere;
}

.organization-role-badge,
.organization-inline-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: .22rem .6rem;
    border-radius: 999px;
    color: var(--fc-color-success-text);
    background: var(--fc-color-success-soft);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.2;
}

.organization-role-badge--student { color: var(--fc-color-info-text); background: var(--fc-color-info-soft); }
.organization-role-badge--teacher { color: var(--fc-color-success-text); background: var(--fc-color-success-soft); }
.organization-role-badge--admin { color: var(--fc-color-warning-text); background: var(--fc-color-warning-soft); }
.organization-role-badge--owner { color: var(--fc-color-palette-5a4a9a); background: var(--fc-color-palette-ede9fe); }

.organization-overview-note {
    margin: .75rem 0;
    color: var(--fc-color-text-muted);
    font-size: .85rem;
}

.organization-alert {
    position: sticky;
    top: -.5rem;
    z-index: 3;
    display: flex;
    align-items: center;
    min-height: 38px;
    margin: 0 0 .75rem;
    padding: .55rem .75rem;
    border: 1px solid transparent;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(var(--fc-color-shadow-strong-rgb), .08);
    font-size: .82rem;
    font-weight: 600;
}

.organization-alert--danger { color: var(--fc-color-danger-text); border-color: var(--fc-color-danger); background: var(--fc-color-danger-soft); }
.organization-alert--success { color: var(--fc-color-success-text); border-color: var(--fc-color-primary); background: var(--fc-color-success-soft); }
.organization-alert--warning { color: var(--fc-color-warning-text); border-color: var(--fc-color-warning); background: var(--fc-color-warning-soft); }

/* Stats */

.organization-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    margin: .85rem 0 1.1rem;
}

.organization-stat {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    padding: .75rem .85rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 14px;
    background: var(--fc-color-surface-soft);
    transition: transform .15s ease, box-shadow .15s ease;
}

.organization-stat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 11px;
    font-size: 1rem;
}

.organization-stat__icon--staff {
    color: var(--fc-color-primary-hover);
    background: linear-gradient(135deg, var(--fc-color-palette-eefaf2) 0%, var(--fc-color-palette-defbe9) 100%);
}

.organization-stat__icon--students {
    color: var(--fc-color-info);
    background: linear-gradient(135deg, var(--fc-color-palette-eef4ff) 0%, var(--fc-color-palette-e2edff) 100%);
}

.organization-stat__text {
    display: grid;
    gap: .1rem;
    min-width: 0;
}

.organization-stat strong {
    color: var(--fc-color-text);
    font-size: 1.15rem;
    line-height: 1.1;
}

.organization-stat span {
    color: var(--fc-color-text-muted);
    font-size: .72rem;
}

/* Tabs */

.organization-tabs {
    display: flex;
    gap: .25rem;
    margin: 0 0 1.1rem;
    padding: .3rem;
    overflow-x: auto;
    border-radius: 13px;
    background: var(--fc-color-surface-soft);
    scrollbar-width: none;
}

.organization-tabs::-webkit-scrollbar { display: none; }

.organization-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    flex: 0 0 auto;
    min-height: 38px;
    padding: .45rem .8rem;
    border: 0;
    border-radius: 10px;
    color: var(--fc-color-text-muted);
    background: transparent;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.organization-tab:hover,
.organization-tab:focus-visible {
    color: var(--fc-color-text);
}

.organization-tab.is-active {
    color: var(--fc-color-success-text);
    background: var(--fc-color-surface);
    box-shadow: 0 4px 12px rgba(var(--fc-color-shadow-strong-rgb), .09);
}

.organization-tab__count {
    min-width: 18px;
    padding: .1rem .3rem;
    border-radius: 999px;
    color: var(--fc-color-on-primary);
    background: var(--fc-color-primary);
    font-size: .68rem;
    line-height: 1.1;
}

.organization-tab-panel {
    display: none;
}

.organization-tab-panel.is-active {
    display: block;
}

.organization-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}

.organization-section-heading > h3 {
    min-width: 0;
}

.organization-icon-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    color: var(--fc-color-text-muted);
    background: var(--fc-color-surface-soft);
    transition: color .15s ease, background-color .15s ease, transform .15s ease;
}

.organization-icon-button:hover,
.organization-icon-button:focus-visible {
    color: var(--fc-color-text);
    background: var(--fc-color-border);
}

.organization-icon-button:active {
    transform: translateY(1px);
}

.organization-icon-button--success { color: var(--fc-color-success-text); background: var(--fc-color-success-soft); }
.organization-icon-button--success:hover,
.organization-icon-button--success:focus-visible { color: var(--fc-color-on-primary); background: var(--fc-color-primary); }
.organization-icon-button--danger { color: var(--fc-color-danger-text); background: var(--fc-color-danger-soft); }
.organization-icon-button--danger:hover,
.organization-icon-button--danger:focus-visible { color: var(--fc-color-on-primary); background: var(--fc-color-danger); }
.organization-icon-button--warning { color: var(--fc-color-warning-text); background: var(--fc-color-warning-soft); }
.organization-icon-button--warning:hover,
.organization-icon-button--warning:focus-visible { color: var(--fc-color-text); background: var(--fc-color-warning); }

.organization-section-heading h3,
.organization-settings-group h4 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    color: var(--fc-color-text);
    font-size: .95rem;
    font-weight: 700;
}

.organization-section-heading h3.organization-section-label {
    padding: 0 .1rem;
    color: var(--fc-color-text-muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.organization-section-heading p,
.organization-settings-group h4 span {
    margin: .18rem 0 0;
    color: var(--fc-color-text-muted);
    font-size: .76rem;
    font-weight: 400;
}

.organization-settings-group__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 8px;
    font-size: .82rem;
}

.organization-settings-group__icon--purple {
    color: var(--fc-color-palette-6554d9);
    background: var(--fc-color-palette-f1efff);
}

.organization-settings-group__icon--blue {
    color: var(--fc-color-info);
    background: var(--fc-color-info-soft);
}

.organization-settings-group__icon--green {
    color: var(--fc-color-primary-hover);
    background: var(--fc-color-success-soft);
}

/* Member / list rows */

.organization-member-row,
.organization-connector-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding: .7rem .85rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 14px;
    background: var(--fc-color-surface);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.organization-member-row:hover {
    transform: translateY(-1px);
    border-color: var(--fc-color-palette-cddcf3);
    box-shadow: 0 8px 20px rgba(var(--fc-color-shadow-strong-rgb), .07);
}

[data-organization-members],
[data-organization-invites],
[data-organization-staff-requests],
[data-organization-classroom-requests],
[data-organization-publication-requests] {
    display: grid;
    gap: .55rem;
}

.organization-members-list {
    display: grid;
    gap: .55rem;
}

.organization-member-row__inner {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

.organization-member-row__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    color: var(--fc-color-primary);
    background: var(--fc-color-success-soft);
    font-size: .82rem;
    font-weight: 800;
}

.organization-member-row__details,
.organization-connector-row > div {
    display: grid;
    gap: .25rem;
    min-width: 0;
}

.organization-member-row__details strong,
.organization-connector-row strong {
    color: var(--fc-color-text);
    overflow-wrap: anywhere;
}

.organization-member-row__details .organization-inline-badge {
    justify-self: start;
}

.organization-member-row__actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
}

.organization-member-row__actions .form-select {
    min-width: 145px;
}

.organization-members-toolbar,
.organization-members-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .6rem;
}

.organization-members-toolbar .organization-icon-button { margin-left: auto; }

.organization-members-controls .form-control {
    flex: 1 1 auto;
    min-height: 36px;
    border-color: var(--fc-color-border);
    border-radius: 9px;
    background: var(--fc-color-surface);
}

.organization-members-toolbar .organization-members-controls {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}

.organization-members-more {
    display: block;
    width: 100%;
    margin-top: .6rem;
    padding: .55rem .75rem;
    border: 0;
    border-radius: 9px;
    color: var(--fc-color-text-muted);
    background: var(--fc-color-surface-soft);
    font-size: .8rem;
    font-weight: 700;
}

.organization-members-more:hover,
.organization-members-more:focus-visible {
    color: var(--fc-color-text);
    background: var(--fc-color-border);
    text-decoration: none;
}

.organization-role-editor {
    min-width: 145px;
}

.organization-staff-invite-card {
    display: grid;
    gap: .5rem;
    min-width: 0;
    padding: .8rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 13px;
    background: var(--fc-color-surface);
}

.organization-section-heading__actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.organization-staff-invite-card__expiry {
    min-width: 0;
    color: var(--fc-color-text-muted);
    font-size: .78rem;
    overflow-wrap: anywhere;
}

.organization-staff-invite-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.organization-invite-link-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}

.organization-invite-link {
    display: block;
    min-width: 0;
    width: 100%;
    min-height: 38px;
    padding: .35rem .55rem;
    color: var(--fc-color-text-muted);
    font-size: .75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.organization-invite-copy {
    flex: 0 0 34px;
}

.organization-invite-copy:hover,
.organization-invite-copy:focus-visible { color: var(--fc-color-on-primary); background: var(--fc-color-primary); }

.organization-invite-empty {
    display: grid;
    min-height: 76px;
    place-items: center;
    border: 1px dashed var(--fc-color-border);
    border-radius: 13px;
    color: var(--fc-color-text-muted);
    background: var(--fc-color-surface-soft);
    font-size: .82rem;
}

.organization-help-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    color: var(--fc-color-text-muted);
    background: transparent;
    vertical-align: middle;
}

.organization-help-button:hover,
.organization-help-button:focus-visible {
    color: var(--fc-color-primary);
}

.organization-member-row code {
    max-width: 100%;
    color: var(--fc-color-text-muted);
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: .76rem;
}

.organization-subsection {
    margin-top: 1.35rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--fc-color-border);
}

.organization-settings-form {
    display: grid;
    gap: .8rem;
}

.organization-settings-group {
    display: grid;
    gap: .4rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--fc-color-border);
}

.organization-settings-group:last-of-type {
    padding-bottom: 0;
    border-bottom: 0;
}

.organization-settings-group h4 {
    padding: 0 .1rem;
    font-size: .82rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--fc-color-text);
}

.organization-settings-group h4 small {
    font-size: .72rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.organization-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 44px;
    padding: .6rem .75rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 12px;
    background: var(--fc-color-surface);
    color: var(--fc-color-text);
    font-size: .82rem;
}

.organization-setting-row .form-select,
.organization-setting-row .form-control {
    width: min(220px, 52%);
    flex: 0 1 220px;
}

.organization-setting-row .form-select {
    min-height: 34px;
    padding-top: .3rem;
    padding-bottom: .3rem;
    border-color: var(--fc-color-border);
    border-radius: 9px;
    background-color: var(--fc-color-surface);
    color: var(--fc-color-text);
}

.organization-setting-row .form-select:focus,
.organization-setting-row .form-control:focus {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 .18rem rgba(var(--fc-color-shadow-brand-rgb), .12);
}

.organization-ai-limits .organization-setting-row {
    min-height: 38px;
    padding: .4rem .55rem;
}

.organization-ai-limits .form-control {
    width: 64px;
    flex: 0 0 64px;
    min-height: 32px;
    padding: .25rem .3rem;
    text-align: right;
}

.organization-ai-limits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

.organization-level-create-form {
    display: grid;
    grid-template-columns: .7fr 1fr auto;
    gap: .5rem;
    margin-bottom: .7rem;
}

.organization-modal .form-select,
.organization-modal .form-control {
    min-width: 0;
    max-width: 100%;
}

.organization-level-create-form .btn {
    white-space: nowrap;
}

/* Connector */

.organization-connector-card {
    display: grid;
    gap: .7rem;
    padding: .85rem;
    border: 1px solid var(--fc-color-border);
    border-radius: 14px;
    background: linear-gradient(135deg, var(--fc-color-surface-soft) 0%, var(--fc-color-surface) 100%);
}

.organization-connector-auth-group {
    display: grid;
    gap: .8rem;
    margin-top: 1.35rem;
}

.organization-connector-auth-group__title {
    margin: 0;
    color: var(--fc-color-text);
    font-size: .95rem;
    font-weight: 700;
}

.organization-connector-auth-options {
    display: grid;
    gap: .75rem;
}

.organization-connector-auth-group [data-organization-connector-settings-submit] {
    width: 100%;
}

.organization-connector-card__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
}

.organization-connector-card__meta {
    display: grid;
    min-width: 0;
    gap: .22rem;
}

.organization-connector-card__meta strong {
    color: var(--fc-color-text);
    font-size: .9rem;
}

.organization-connector-card__meta span {
    display: block;
    max-width: 100%;
    color: var(--fc-color-text-muted);
    font-size: .76rem;
}

.organization-connector-test-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 36px;
    flex: 0 0 auto;
    padding: .45rem .7rem;
    border-radius: 10px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.organization-connector-checklist {
    overflow: hidden;
    border-top: 1px solid var(--fc-color-border);
}

.organization-connector-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
    padding: .5rem 0;
    color: var(--fc-color-text);
    font-size: .82rem;
    font-weight: 600;
}

.organization-connector-check + .organization-connector-check {
    border-top: 1px solid var(--fc-color-border);
}

.organization-connector-check__label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.organization-connector-check__label i {
    color: var(--fc-color-text-muted);
    font-size: .9rem;
}

.organization-connector-check__status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
}

.organization-connector-check.is-loading .organization-connector-check__status { color: var(--fc-color-text-muted); background: var(--fc-color-surface); }
.organization-connector-check.is-success .organization-connector-check__status { color: var(--fc-color-success-text); background: var(--fc-color-success-soft); }
.organization-connector-check.is-error .organization-connector-check__status { color: var(--fc-color-danger-text); background: var(--fc-color-danger-soft); }
.organization-connector-check.is-idle .organization-connector-check__status { color: var(--fc-color-text-muted); background: var(--fc-color-surface-soft); }

@media (max-width: 575.98px) {
    .organization-modal__body { padding: .85rem; max-height: 82vh; }
    .organization-modal__header { padding: .9rem .95rem; }
    .organization-modal__title { max-width: calc(100vw - 100px); font-size: 1.05rem; }
    .organization-modal__subtitle { display: none; }
    .organization-summary { padding: .8rem; gap: .7rem; }
    .organization-summary__avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: .92rem; }
    .organization-stats { gap: .4rem; }
    .organization-stat { padding: .6rem .55rem; gap: .5rem; }
    .organization-stat__icon { width: 32px; height: 32px; flex-basis: 32px; }
    .organization-stat span { font-size: .68rem; }
    .organization-member-row:not(.organization-member-row--participant) { align-items: flex-start; flex-direction: column; }
    .organization-member-row--participant { gap: .45rem; padding: .6rem; }
    .organization-member-row--participant .organization-member-row__actions { width: auto; gap: .25rem; }
    .organization-member-row:not(.organization-member-row--participant) .organization-member-row__actions { width: 100%; }
    .organization-member-row__actions .form-select { flex: 1; min-width: 0; }
    .organization-member-row--participant .organization-icon-button { width: 30px; height: 30px; flex-basis: 30px; }
    .organization-member-row--participant .organization-role-editor { width: 108px; min-width: 108px; }
    .organization-member-row--participant.is-editing-role [data-organization-member-deactivate] { display: none; }
    .organization-member-row__avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: .74rem; }
    .organization-setting-row { align-items: flex-start; flex-direction: column; }
    .organization-setting-row .form-select,
    .organization-setting-row .form-control { width: 100%; flex-basis: auto; }
    .organization-ai-limits { grid-template-columns: 1fr; }
    .organization-ai-limits .organization-setting-row { align-items: center; flex-direction: row; min-height: 38px; }
    .organization-ai-limits .form-control { width: 56px; flex: 0 0 56px; align-self: auto; }
    .organization-level-create-form { grid-template-columns: 1fr; }
    .organization-staff-invite-card { padding: .65rem; }
    .organization-connector-card__summary { align-items: stretch; flex-direction: column; }
    .organization-connector-test-button { width: 100%; }
}

.organization-member-row--participant {
    flex-direction: row;
    align-items: center;
}

.organization-member-row--participant .organization-member-row__actions {
    width: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* AI limits: each role row takes full width (Владелец was squeezed) */
.organization-ai-limits {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.organization-ai-limits .organization-setting-row {
    width: 100%;
}

/* ---------------------------------------------------------------------------
 * Connector admin page
 * ------------------------------------------------------------------------- */

.fc-connector-page {
    max-width: 1080px;
}

/* Page header follows the site style: green icon tile + dark title */
.fc-connector-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.fc-connector-page-header__icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-accent-hover);
    font-size: 1.5rem;
    box-shadow: 0 6px 18px rgba(var(--fc-color-shadow-brand-rgb), 0.12);
}
.fc-connector-page-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fc-color-palette-0f172a);
}
.fc-connector-page-header p {
    margin: .25rem 0 0;
    color: var(--fc-color-text-muted);
    font-size: .9rem;
}

/* Status card — site uses a single soft white card with the same
   border-radius as .fc-class-card (16px), no heavy shadow. */
.fc-connector-status-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-border);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(var(--fc-color-shadow-rgb), 0.04);
    margin-bottom: 1.25rem;
}

.fc-connector-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .85rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}
.fc-connector-status-pill--connected {
    background: var(--fc-color-success-soft);
    color: var(--fc-color-success-text);
    border-color: var(--fc-color-success-soft);
}
.fc-connector-status-pill--paused {
    background: var(--fc-color-warning-soft);
    color: var(--fc-color-warning-text);
    border-color: var(--fc-color-warning-soft);
}
.fc-connector-status-pill--error {
    background: var(--fc-color-danger-soft);
    color: var(--fc-color-danger-text);
    border-color: var(--fc-color-danger-soft);
}
.fc-connector-status-pill--unknown {
    background: var(--fc-color-info-soft);
    color: var(--fc-color-info-text);
    border-color: var(--fc-color-info-soft);
}
.fc-connector-status-pill--not_configured {
    background: var(--fc-color-palette-f1f5f9);
    color: var(--fc-color-text-muted);
    border-color: var(--fc-color-palette-f1f5f9);
}

.fc-connector-status-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 1.5rem;
    color: var(--fc-color-text-muted);
    font-size: .82rem;
}

.fc-connector-checks {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem 1.4rem;
    margin: 0;
    padding: .85rem 0 0;
    list-style: none;
    font-size: .82rem;
    color: var(--fc-color-text-muted);
    width: 100%;
    border-top: 1px dashed var(--fc-color-palette-f1f5f9);
}
.fc-connector-checks li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.fc-connector-checks li.is-ok { color: var(--fc-color-success-text); }
.fc-connector-checks li.is-fail { color: var(--fc-color-danger-text); }
.fc-connector-checks li [data-check-state] {
    font-weight: 600;
}

/* Stack of warning banners — same soft-bg banner style as .fc-class-card
   but coloured. We use a left border accent for severity. */
.fc-warning-stack {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-bottom: 1.25rem;
}
.fc-warning {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: 1rem 1.25rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-border);
    border-left: 4px solid var(--fc-color-warning);
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(var(--fc-color-shadow-rgb), 0.04);
}
.fc-warning__icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--fc-color-warning-soft);
    color: var(--fc-color-warning-text);
    font-size: 1rem;
}
.fc-warning__body { flex: 1 1 auto; min-width: 0; }
.fc-warning__title {
    color: var(--fc-color-palette-0f172a);
    font-weight: 700;
    font-size: .95rem;
    margin-bottom: .15rem;
}
.fc-warning__text {
    color: var(--fc-color-text-muted);
    font-size: .85rem;
    line-height: 1.45;
}
.fc-warning__action {
    flex: 0 0 auto;
    align-self: center;
}
.fc-warning--danger {
    border-left-color: var(--fc-color-danger);
}
.fc-warning--danger .fc-warning__icon {
    background: var(--fc-color-danger-soft);
    color: var(--fc-color-danger-text);
}
.fc-warning--info {
    border-left-color: var(--fc-color-info);
}
.fc-warning--info .fc-warning__icon {
    background: var(--fc-color-info-soft);
    color: var(--fc-color-info-text);
}
.fc-warning--success {
    border-left-color: var(--fc-color-success);
}
.fc-warning--success .fc-warning__icon {
    background: var(--fc-color-success-soft);
    color: var(--fc-color-success-text);
}

/* Settings card — mirrors the .fc-class-card look (white, 16px radius,
   soft border, gentle shadow). */
.fc-settings-card {
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(var(--fc-color-shadow-rgb), 0.02);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.fc-settings-card:hover {
    border-color: var(--fc-color-border);
    box-shadow: 0 6px 16px rgba(var(--fc-color-shadow-rgb), 0.05);
}
.fc-settings-card__header {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .25rem;
    color: var(--fc-color-palette-0f172a);
    font-size: 1rem;
    font-weight: 700;
}
.fc-settings-card__icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-accent-hover);
    font-size: 1rem;
}
.fc-settings-card__hint {
    margin: .35rem 0 1.1rem;
    color: var(--fc-color-text-muted);
    font-size: .85rem;
    line-height: 1.45;
}

/* Form field — used everywhere on the site as a 6–8px gap column */
.fc-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1rem;
}
.fc-field__label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    font-size: .88rem;
    color: var(--fc-color-palette-0f172a);
}
.fc-field__help {
    color: var(--fc-color-text-muted);
    font-size: .8rem;
    line-height: 1.4;
}
.fc-field__row {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.fc-field__row > .form-control { flex: 1 1 auto; }

/* Form controls: site uses Bootstrap .form-control / .form-select; we
   only add the brand-coloured focus ring here. */
.fc-settings-card .form-control:focus,
.fc-settings-card .form-select:focus {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.16);
}

/* Custom switch row — mirrors .hw-ai-assistant-setting used elsewhere. */
.fc-switch {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 1rem;
    background: var(--fc-color-surface-soft);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 12px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.fc-switch:hover { background: var(--fc-color-palette-f1f5f9); border-color: var(--fc-color-border); }
.fc-switch.is-disabled { opacity: .55; cursor: not-allowed; }
.fc-switch__icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-accent-hover);
    font-size: 1rem;
    flex: 0 0 36px;
}
.fc-switch__icon--warning { background: var(--fc-color-warning-soft); color: var(--fc-color-warning-text); }
.fc-switch__icon--info    { background: var(--fc-color-info-soft);    color: var(--fc-color-info-text); }
.fc-switch__body { flex: 1 1 auto; min-width: 0; }
.fc-switch__title {
    font-weight: 600;
    font-size: .92rem;
    color: var(--fc-color-palette-0f172a);
    line-height: 1.3;
}
.fc-switch__subtitle {
    color: var(--fc-color-text-muted);
    font-size: .8rem;
    line-height: 1.4;
    margin-top: .15rem;
}
.fc-switch__toggle { flex: 0 0 auto; padding-top: .25rem; }
.fc-switch__toggle .form-check-input:checked {
    background-color: var(--fc-color-primary);
    border-color: var(--fc-color-primary);
}
.fc-switch__toggle .form-check-input:focus {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.18);
}

/* Logs table — site uses 14px rows, light header, hover green-tinted */
.fc-log-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .85rem;
}
.fc-log-table th,
.fc-log-table td {
    padding: .7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--fc-color-palette-f1f5f9);
}
.fc-log-table th {
    font-weight: 600;
    color: var(--fc-color-text-muted);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--fc-color-surface-soft);
}
.fc-log-table tbody tr { cursor: pointer; transition: background .12s ease; }
.fc-log-table tbody tr:hover { background: var(--fc-color-palette-f0fdf4); }

.fc-log-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .85rem;
}
.fc-log-chip {
    border: 1px solid var(--fc-color-border);
    background: var(--fc-color-surface);
    color: var(--fc-color-text-muted);
    border-radius: 999px;
    padding: .3rem .85rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s ease;
}
.fc-log-chip:hover { background: var(--fc-color-surface-soft); color: var(--fc-color-palette-0f172a); }
.fc-log-chip.is-active {
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
    border-color: var(--fc-color-primary);
}

/* Drawer for log detail — site has a 16–20px radius on modals; mirror that. */
.fc-log-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--fc-color-overlay);
    z-index: 1040;
    display: none;
}
.fc-log-drawer-backdrop.is-open { display: block; }
.fc-log-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(540px, 100vw);
    background: var(--fc-color-surface);
    z-index: 1050;
    transform: translateX(100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 28px rgba(var(--fc-color-shadow-rgb), 0.18);
    border-radius: 20px 0 0 20px;
}
.fc-log-drawer.is-open { transform: translateX(0); }
.fc-log-drawer__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fc-color-palette-f1f5f9);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fc-log-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Code block — site uses a soft-grey, NOT dark. This matches the
   minimal style on documentation pages. */
.fc-code-block {
    background: var(--fc-color-palette-f1f5f9);
    color: var(--fc-color-palette-0f172a);
    border: 1px solid var(--fc-color-palette-e2e8f0);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .82rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
}
.fc-code-block code { color: inherit; background: transparent; padding: 0; }

/* Instruction steps — 3 quick steps at the top */
.fc-instruction {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.fc-instruction__step {
    display: flex;
    gap: .85rem;
}
.fc-instruction__step-num {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}
.fc-instruction__step-body { flex: 1 1 auto; }
.fc-instruction__step-title {
    font-weight: 700;
    margin-bottom: .25rem;
    color: var(--fc-color-palette-0f172a);
    font-size: .92rem;
}

/* Snippet tabs — site uses .fc-segmented-tabs style for any tab groups.
   Here we use a slim underline variant that fits the docs. */
.fc-snippet-tabs {
    display: flex;
    gap: .35rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--fc-color-palette-f1f5f9);
    align-items: center;
}
.fc-snippet-tab {
    background: transparent;
    border: none;
    padding: .5rem .9rem;
    color: var(--fc-color-text-muted);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .12s ease, border-color .12s ease;
}
.fc-snippet-tab:hover { color: var(--fc-color-palette-0f172a); }
.fc-snippet-tab.is-active {
    color: var(--fc-color-accent-hover);
    border-bottom-color: var(--fc-color-accent);
}
.fc-snippet-copy {
    border: 1px solid var(--fc-color-border);
    background: var(--fc-color-surface);
    color: var(--fc-color-palette-0f172a);
    border-radius: 10px;
    padding: .3rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.fc-snippet-copy:hover { background: var(--fc-color-surface-soft); border-color: var(--fc-color-palette-cbd5e1); }

/* Bullet list with green check icon */
.fc-bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.fc-bullet-list li {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    color: var(--fc-color-palette-0f172a);
    font-size: .88rem;
}
.fc-bullet-list li::before {
    content: "\F26E";
    font-family: "bootstrap-icons";
    color: var(--fc-color-success);
    margin-top: .15rem;
    flex: 0 0 auto;
}

/* Sticky save bar — matches the inline style already used on
   home.html (rounded 12px, bold). Sits at the bottom of the form. */
.fc-connector-save-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--fc-color-surface);
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 0 0 16px 16px;
    margin: 1.5rem -1.5rem -1.5rem;
}
.fc-connector-save-bar .btn-success {
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 700;
}

.fc-connector-page {
    max-width: 1080px;
}

.fc-connector-status-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-border, #e3e7ed);
    border-radius: 20px;
    box-shadow: 0 4px 18px rgba(var(--fc-color-shadow-strong-rgb, 17 24 39), 0.05);
}

.fc-connector-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .85rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}
.fc-connector-status-pill--connected { background: var(--fc-color-success-soft); color: var(--fc-color-success-text); }
.fc-connector-status-pill--paused    { background: var(--fc-color-warning-soft); color: var(--fc-color-warning-text); }
.fc-connector-status-pill--error     { background: var(--fc-color-danger-soft); color: var(--fc-color-danger-text); }
.fc-connector-status-pill--unknown   { background: var(--fc-color-info-soft); color: var(--fc-color-info-text); }
.fc-connector-status-pill--not_configured { background: var(--fc-color-palette-eef2f7, #eef2f7); color: var(--fc-color-palette-5b6f91, #5b6f91); }

.fc-connector-status-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 1.5rem;
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-size: .82rem;
}

.fc-connector-checks {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem 1.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .82rem;
}
.fc-connector-checks li {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--fc-color-palette-5b6f91, #5b6f91);
}
.fc-connector-checks li.is-ok    { color: var(--fc-color-success-text); }
.fc-connector-checks li.is-fail  { color: var(--fc-color-danger-text); }



.fc-settings-card {
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-border, #e3e7ed);
    border-radius: 20px;
    box-shadow: 0 4px 18px rgba(var(--fc-color-shadow-strong-rgb, 17 24 39), 0.05);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
}
.fc-settings-card__header {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.1rem;
    color: var(--fc-color-palette-0f172a, #0f172a);
    font-size: 1rem;
    font-weight: 700;
}
.fc-settings-card__header > i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--fc-color-palette-eff6ff, #eff6ff);
    color: var(--fc-color-palette-3b82f6, #3b82f6);
    font-size: 1rem;
}
.fc-settings-card__hint {
    margin: -.25rem 0 1.1rem;
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-size: .85rem;
}

.fc-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1rem;
}
.fc-field__label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--fc-color-palette-0f172a, #0f172a);
}
.fc-field__help {
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-size: .8rem;
    line-height: 1.4;
}
.fc-field__row {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.fc-field__row > .form-control { flex: 1 1 auto; }

/* Custom switch row used in the connector page (matches .hw-ai-assistant-setting) */
.fc-switch {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 1rem;
    background: var(--fc-color-palette-f8fafc, #f8fafc);
    border: 1px solid var(--fc-color-border, #e3e7ed);
    border-radius: 14px;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.fc-switch:hover { background: var(--fc-color-palette-f1f5f9, #f1f5f9); }
.fc-switch.is-disabled { opacity: .55; cursor: not-allowed; }
.fc-switch__icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--fc-color-palette-eefaf2, #eefaf2);
    color: var(--fc-color-success-text, #15803d);
    font-size: 1rem;
    flex: 0 0 36px;
}
.fc-switch__body { flex: 1 1 auto; min-width: 0; }
.fc-switch__title { font-weight: 600; font-size: .92rem; color: var(--fc-color-palette-0f172a, #0f172a); }
.fc-switch__subtitle {
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-size: .8rem;
    line-height: 1.4;
    margin-top: .15rem;
}
.fc-switch__toggle {
    flex: 0 0 auto;
}

/* Logs table */
.fc-log-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .85rem;
}
.fc-log-table th,
.fc-log-table td {
    padding: .65rem .9rem;
    text-align: left;
    border-bottom: 1px solid var(--fc-color-border, #e3e7ed);
}
.fc-log-table th {
    font-weight: 600;
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--fc-color-palette-f8fafc, #f8fafc);
}
.fc-log-table tbody tr { cursor: pointer; transition: background .12s ease; }
.fc-log-table tbody tr:hover { background: var(--fc-color-palette-f1f5f9, #f1f5f9); }

.fc-log-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .65rem;
}
.fc-log-chip {
    border: 1px solid var(--fc-color-border, #e3e7ed);
    background: var(--fc-color-surface);
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    border-radius: 999px;
    padding: .25rem .75rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s ease;
}
.fc-log-chip:hover { background: var(--fc-color-palette-f1f5f9, #f1f5f9); }
.fc-log-chip.is-active {
    background: var(--fc-color-primary, #4f7cff);
    color: #fff;
    border-color: var(--fc-color-primary, #4f7cff);
}

/* Drawer for log detail */
.fc-log-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(var(--fc-color-shadow-rgb), 0.4);
    z-index: 1040;
    display: none;
}
.fc-log-drawer-backdrop.is-open { display: block; }
.fc-log-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(540px, 100vw);
    background: var(--fc-color-surface);
    z-index: 1050;
    transform: translateX(100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 28px rgba(var(--fc-color-shadow-rgb), 0.18);
}
.fc-log-drawer.is-open { transform: translateX(0); }
.fc-log-drawer__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fc-color-border, #e3e7ed);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fc-log-drawer__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1.25rem;
}

.fc-code-block {
    background: var(--fc-color-palette-0f172a, #0f172a);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1.15rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .82rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
}
.fc-code-block code { color: inherit; background: transparent; padding: 0; }

.fc-instruction {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.fc-instruction__step {
    display: flex;
    gap: .85rem;
}
.fc-instruction__step-num {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--fc-color-primary, #4f7cff);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
}
.fc-instruction__step-body { flex: 1 1 auto; }
.fc-instruction__step-title {
    font-weight: 700;
    margin-bottom: .25rem;
    color: var(--fc-color-palette-0f172a, #0f172a);
}

.fc-snippet-tabs {
    display: flex;
    gap: .35rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--fc-color-border, #e3e7ed);
}
.fc-snippet-tab {
    background: transparent;
    border: none;
    padding: .4rem .85rem;
    color: var(--fc-color-palette-5b6f91, #5b6f91);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.fc-snippet-tab.is-active {
    color: var(--fc-color-palette-0f172a, #0f172a);
    border-bottom-color: var(--fc-color-primary, #4f7cff);
}
.fc-snippet-copy {
    border: 1px solid var(--fc-color-border, #e3e7ed);
    background: var(--fc-color-surface);
    color: var(--fc-color-palette-0f172a, #0f172a);
    border-radius: 8px;
    padding: .25rem .65rem;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
}

.fc-bullet-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.fc-bullet-list li {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    color: var(--fc-color-palette-0f172a, #0f172a);
    font-size: .88rem;
}
.fc-bullet-list li::before {
    content: "\F26E"; /* bi-check2 */
    font-family: "bootstrap-icons";
    color: var(--fc-color-success-text, #15803d);
    margin-top: .15rem;
}

/* ---------------------------------------------------------------------------
 * Connector copilot (chat inside Card 6)
 * ------------------------------------------------------------------------- */

.fc-copilot {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.fc-copilot__messages {
    min-height: 320px;
    max-height: 520px;
    overflow-y: auto;
    background: var(--fc-color-surface-soft);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.fc-copilot__messages::-webkit-scrollbar { width: 8px; }
.fc-copilot__messages::-webkit-scrollbar-thumb { background: var(--fc-color-palette-cbd5e1); border-radius: 4px; }

.fc-copilot__empty {
    text-align: center;
    color: var(--fc-color-text-muted);
    padding: 2.5rem 1rem;
}
.fc-copilot__empty i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-accent-hover);
    font-size: 1.5rem;
    margin-bottom: .85rem;
    box-shadow: 0 6px 18px rgba(var(--fc-color-shadow-brand-rgb), 0.12);
}
.fc-copilot__empty p {
    max-width: 36ch;
    margin: 0 auto;
    font-size: .9rem;
    line-height: 1.45;
}

/* Message bubbles */
.fc-copilot-msg {
    display: flex;
    gap: .65rem;
    max-width: 100%;
}
.fc-copilot-msg__avatar {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    color: #fff;
}
.fc-copilot-msg--user .fc-copilot-msg__avatar {
    background: var(--fc-color-info);
}
.fc-copilot-msg--assistant .fc-copilot-msg__avatar {
    background: var(--fc-color-primary);
}
.fc-copilot-msg__body {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 12px;
    padding: .8rem 1rem;
    font-size: .9rem;
    line-height: 1.55;
    color: var(--fc-color-palette-0f172a);
}
.fc-copilot-msg--user .fc-copilot-msg__body {
    background: var(--fc-color-palette-f0f9ff);
    border-color: var(--fc-color-palette-baE6fd);
}
.fc-copilot-msg__body p { margin: 0 0 .55rem; }
.fc-copilot-msg__body p:last-child { margin-bottom: 0; }
.fc-copilot-msg__body code {
    background: var(--fc-color-palette-f1f5f9);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: .85em;
    color: var(--fc-color-palette-0f172a);
}
.fc-copilot-msg__body strong { font-weight: 700; color: var(--fc-color-palette-0f172a); }
.fc-copilot-msg__body ul, .fc-copilot-msg__body ol { padding-left: 1.25rem; margin: .35rem 0; }
.fc-copilot-msg__body li { margin-bottom: .25rem; }

/* Code block inside a message with copy button */
.fc-copilot-code {
    position: relative;
    margin: .65rem 0;
    background: var(--fc-color-palette-f1f5f9);
    border: 1px solid var(--fc-color-palette-e2e8f0);
    border-radius: 12px;
    padding: .9rem 1rem;
    overflow: auto;
}
.fc-copilot-code pre {
    margin: 0;
    color: var(--fc-color-palette-0f172a);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .82rem;
    line-height: 1.5;
    white-space: pre;
}
.fc-copilot-code__copy {
    position: absolute;
    top: .55rem;
    right: .55rem;
    border: 1px solid var(--fc-color-border);
    background: var(--fc-color-surface);
    color: var(--fc-color-palette-0f172a);
    border-radius: 8px;
    padding: .25rem .6rem;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.fc-copilot-code__copy:hover { background: var(--fc-color-surface-soft); border-color: var(--fc-color-palette-cbd5e1); }
.fc-copilot-code__copy.is-copied { background: var(--fc-color-success-soft); border-color: var(--fc-color-success); color: var(--fc-color-success-text); }

/* Tool audit badge */
.fc-copilot-tools {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-top: .55rem;
}
.fc-copilot-tool {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-text-muted);
    border: 1px solid var(--fc-color-palette-f1f5f9);
}
.fc-copilot-tool i { color: var(--fc-color-accent-hover); font-size: .85em; }

/* Composer */
.fc-copilot__composer {
    position: relative;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-border);
    border-radius: 14px;
    padding: .65rem .75rem .75rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.fc-copilot__composer:focus-within {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.16);
}
.fc-copilot__textarea {
    width: 100%;
    border: none;
    background: transparent;
    resize: vertical;
    min-height: 60px;
    max-height: 220px;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.45;
    color: var(--fc-color-palette-0f172a);
    outline: none;
}
.fc-copilot__textarea::placeholder { color: var(--fc-color-text-muted); }
.fc-copilot__composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .4rem;
}
.fc-copilot__composer-actions .btn-success {
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: .85rem;
}
.fc-copilot__composer-actions .btn-success:disabled {
    background: var(--fc-color-border);
    color: var(--fc-color-palette-94a3b8);
    border-color: var(--fc-color-border);
}

/* Quota exhausted overlay (mirrors lesson assistant) */
.fc-copilot__overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.fc-copilot__overlay.is-on { display: flex; }
.fc-copilot__overlay-message {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--fc-color-text-muted);
    font-weight: 600;
    font-size: .9rem;
}
.fc-copilot__overlay-message i {
    color: var(--fc-color-accent);
    font-size: 1.1rem;
}

/* Loading dots for the assistant pending turn */
.fc-copilot-msg--pending .fc-copilot-msg__body {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--fc-color-text-muted);
}
.fc-copilot-msg--pending .fc-copilot-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--fc-color-text-muted);
    animation: fc-copilot-pulse 1.2s ease-in-out infinite;
}
.fc-copilot-msg--pending .fc-copilot-dot:nth-child(2) { animation-delay: .15s; }
.fc-copilot-msg--pending .fc-copilot-dot:nth-child(3) { animation-delay: .3s; }
@keyframes fc-copilot-pulse {
    0%, 100% { opacity: .35; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.25); }
}

/* Toolbar above composer */
.fc-copilot__toolbar { padding: 0 .15rem; }
.fc-copilot__toolbar .fc-btn-outline {
    padding: .25rem .7rem;
    font-size: .78rem;
    border-radius: 999px;
}

/* Quota badge on the tab (next to «Коннектор-ассистент») */
.fc-copilot-quota-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-success-text);
}
.fc-copilot-quota-badge.is-low { background: var(--fc-color-warning-soft); color: var(--fc-color-warning-text); }
.fc-copilot-quota-badge.is-empty { background: var(--fc-color-danger-soft); color: var(--fc-color-danger-text); }
.fc-copilot-quota-badge i { font-size: .85em; }

/* ---------------------------------------------------------------------------
 * Redesign v2: master flow + working panel + status bar
 * ------------------------------------------------------------------------- */

/* Page header gets the action buttons on the right */
.fc-connector-page-header { gap: 1rem; }
.fc-connector-page-header > div.flex-grow-1 { min-width: 0; }

/* Tab counter on the "Журнал" tab */
.fc-tab-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 .45rem;
    margin-left: .35rem;
    border-radius: 999px;
    background: var(--fc-color-palette-f1f5f9);
    color: var(--fc-color-text-muted);
    font-size: .72rem;
    font-weight: 700;
}
.fc-tab-counter.is-error { background: var(--fc-color-danger-soft); color: var(--fc-color-danger-text); }

/* ----------------------------------------------------------------
 * Status bar (compact, one row, top of the page)
 * ---------------------------------------------------------------- */
.fc-status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .85rem 1.25rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 14px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(var(--fc-color-shadow-rgb), 0.04);
}
.fc-status-bar__pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .85rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: .85rem;
    white-space: nowrap;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-success-text);
    border: 1px solid var(--fc-color-success-soft);
    transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.fc-status-bar__pill.is-paused { background: var(--fc-color-warning-soft); color: var(--fc-color-warning-text); border-color: var(--fc-color-warning-soft); }
.fc-status-bar__pill.is-error { background: var(--fc-color-danger-soft); color: var(--fc-color-danger-text); border-color: var(--fc-color-danger-soft); }
.fc-status-bar__pill.is-unknown { background: var(--fc-color-info-soft); color: var(--fc-color-info-text); border-color: var(--fc-color-info-soft); }
.fc-status-bar__pill.is-not-configured { background: var(--fc-color-palette-f1f5f9); color: var(--fc-color-text-muted); border-color: var(--fc-color-palette-f1f5f9); }
.fc-status-bar__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}
.fc-status-bar__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    flex: 1 1 auto;
    color: var(--fc-color-text-muted);
    font-size: .82rem;
}
.fc-status-bar__meta-item { display: inline-flex; align-items: center; }
.fc-status-bar__actions { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }

.fc-status-bar-details {
    background: var(--fc-color-surface-soft);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 14px;
    padding: .85rem 1.1rem;
    margin-bottom: 1rem;
}
.fc-status-bar-details.d-none { display: none; }

/* ----------------------------------------------------------------
 * Stepper (master flow)
 * ---------------------------------------------------------------- */
.fc-stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-bottom: 1.25rem;
    position: relative;
}
.fc-stepper__item {
    display: flex;
    gap: .65rem;
    padding: .85rem 1rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    position: relative;
}
.fc-stepper__item + .fc-stepper__item { border-left: 0; }
.fc-stepper__item:first-child { border-radius: 14px 0 0 14px; }
.fc-stepper__item:last-child { border-radius: 0 14px 14px 0; }
.fc-stepper__item:hover { background: var(--fc-color-surface-soft); }
.fc-stepper__item.is-done { background: var(--fc-color-success-soft); border-color: var(--fc-color-success); }
.fc-stepper__item.is-active {
    background: var(--fc-color-surface);
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.12);
    z-index: 1;
}
.fc-stepper__num {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    border: 1px solid var(--fc-color-palette-f1f5f9);
}
.fc-stepper__item.is-active .fc-stepper__num {
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
    border-color: var(--fc-color-primary);
}
.fc-stepper__item.is-done .fc-stepper__num {
    background: var(--fc-color-success);
    color: var(--fc-color-on-primary);
    border-color: var(--fc-color-success);
}
.fc-stepper__item.is-done .fc-stepper__num::before { content: "\F26E"; font-family: "bootstrap-icons"; }
.fc-stepper__item.is-done .fc-stepper__num > * { display: none; }
.fc-stepper__item.is-done .fc-stepper__num { font-size: 0; }
.fc-stepper__title {
    font-weight: 600;
    font-size: .9rem;
    color: var(--fc-color-palette-0f172a);
    margin-bottom: .15rem;
}
.fc-stepper__hint {
    color: var(--fc-color-text-muted);
    font-size: .76rem;
    line-height: 1.3;
}

/* ----------------------------------------------------------------
 * Step card (active step content)
 * ---------------------------------------------------------------- */
.fc-step-card {
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(var(--fc-color-shadow-rgb), 0.04);
    overflow: hidden;
}
.fc-step-card__header {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.1rem 1.5rem;
    background: var(--fc-color-surface-soft);
    border-bottom: 1px solid var(--fc-color-palette-f1f5f9);
}
.fc-step-card__num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: 0 0 36px;
}
.fc-step-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fc-color-palette-0f172a);
}
.fc-step-card__body {
    padding: 1.5rem 1.75rem;
    min-height: 220px;
}
.fc-step-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--fc-color-surface-soft);
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
}
.fc-step-card__footer .btn-success { border-radius: 10px; padding: 8px 18px; font-weight: 600; }

/* ----------------------------------------------------------------
 * Working panel: tile grid + accordions
 * ---------------------------------------------------------------- */
.fc-tile-grid {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.fc-accordion {
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(var(--fc-color-shadow-rgb), 0.02);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.fc-accordion:hover { border-color: var(--fc-color-border); }
.fc-accordion[open] {
    border-color: var(--fc-color-border);
    box-shadow: 0 6px 16px rgba(var(--fc-color-shadow-rgb), 0.05);
}
.fc-accordion__summary {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    color: var(--fc-color-palette-0f172a);
    user-select: none;
}
.fc-accordion__summary::-webkit-details-marker { display: none; }
.fc-accordion__summary > i:first-child {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--fc-color-success-soft);
    color: var(--fc-color-accent-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 36px;
}
.fc-accordion__title {
    font-weight: 700;
    font-size: 1rem;
}
.fc-accordion__hint {
    color: var(--fc-color-text-muted);
    font-size: .82rem;
    margin-left: .35rem;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-accordion__chevron {
    color: var(--fc-color-text-muted);
    transition: transform .15s ease;
}
.fc-accordion[open] .fc-accordion__chevron { transform: rotate(180deg); }
.fc-accordion__body {
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
    padding-top: 1.25rem;
}

/* ----------------------------------------------------------------
 * Floating AI Assistant panel
 * ---------------------------------------------------------------- */
.fc-copilot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1030;
}
.fc-copilot-fab__btn {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .85rem 1.15rem;
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
    border: none;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(var(--fc-color-shadow-brand-rgb), 0.32);
    cursor: pointer;
    font-weight: 700;
    font-size: .92rem;
    transition: transform .12s ease, box-shadow .12s ease;
}
.fc-copilot-fab__btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(var(--fc-color-shadow-brand-rgb), 0.42); }
.fc-copilot-fab__btn > i { font-size: 1.1rem; }
.fc-copilot-fab__quota {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .12rem .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: .72rem;
    font-weight: 700;
    margin-left: .15rem;
}
.fc-copilot-fab__quota.is-low { background: var(--fc-color-warning); color: var(--fc-color-warning-text); }
.fc-copilot-fab__quota.is-empty { background: var(--fc-color-danger); color: #fff; }

.fc-copilot-overlay {
    position: fixed;
    inset: 0;
    background: var(--fc-color-overlay);
    z-index: 1050;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.fc-copilot-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.fc-copilot-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    background: var(--fc-color-surface);
    z-index: 1060;
    transform: translateX(100%);
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(var(--fc-color-shadow-rgb), 0.2);
    border-radius: 20px 0 0 20px;
}
.fc-copilot-panel.is-open { transform: translateX(0); }
.fc-copilot-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--fc-color-palette-f1f5f9);
    background: var(--fc-color-surface);
}
.fc-copilot-panel__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--fc-color-palette-0f172a);
}
.fc-copilot-panel__title > i { font-size: 1.2rem; }
.fc-copilot-panel__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-text-muted);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .12s ease;
}
.fc-copilot-panel__icon:hover { background: var(--fc-color-palette-f1f5f9); color: var(--fc-color-palette-0f172a); }
.fc-copilot-panel__messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    background: var(--fc-color-surface-soft);
}
.fc-copilot-panel__quota {
    padding: .5rem 1.25rem;
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
    background: var(--fc-color-surface);
    text-align: right;
}
.fc-copilot-panel__form {
    position: relative;
    background: var(--fc-color-surface);
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
    padding: .75rem 1rem 1rem;
}
.fc-copilot-panel__textarea {
    width: 100%;
    border: 1px solid var(--fc-color-palette-f1f5f9);
    background: var(--fc-color-surface);
    border-radius: 10px;
    padding: .65rem .8rem;
    resize: vertical;
    min-height: 70px;
    max-height: 200px;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.45;
    color: var(--fc-color-palette-0f172a);
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.fc-copilot-panel__textarea:focus {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.16);
}
.fc-copilot-panel__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .5rem;
    gap: .5rem;
}
.fc-copilot-panel__actions .btn-success {
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: .85rem;
}

/* Hide the in-page copilot controls (old layout) — they are now in the floating panel */
[data-connector-copilot-pane] { display: none !important; }
[data-connector-copilot-tabs] { display: none !important; }

/* ---------------------------------------------------------------------------
 * Copilot panel: file attach, dropzone, question picker
 * ------------------------------------------------------------------------- */

.fc-copilot-panel__form {
    position: relative;
    background: var(--fc-color-surface);
    border-top: 1px solid var(--fc-color-palette-f1f5f9);
    padding: .55rem .8rem .8rem;
    overflow: hidden;
}
.fc-copilot-panel__form.dragging {
    background: var(--fc-color-success-soft);
}

/* Composer (textarea + toolbar) — same shape as the lesson assistant */
.fc-copilot-panel__textarea {
    width: 100%;
    border: 1px solid var(--fc-color-palette-f1f5f9);
    background: var(--fc-color-surface);
    border-radius: 12px;
    padding: .55rem .8rem;
    resize: vertical;
    min-height: 56px;
    max-height: 200px;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.45;
    color: var(--fc-color-palette-0f172a);
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.fc-copilot-panel__textarea:focus {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.16);
}
.fc-copilot-panel__textarea:disabled {
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-palette-94a3b8);
}

.fc-copilot-panel__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .45rem;
    gap: .5rem;
}
.fc-copilot-panel__tools { display: flex; align-items: center; gap: .35rem; }

.fc-copilot-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--fc-color-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
    padding: 0;
}
.fc-copilot-icon-btn:hover {
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-palette-0f172a);
}
.fc-copilot-icon-btn:disabled {
    color: var(--fc-color-palette-94a3b8);
    cursor: not-allowed;
}
.fc-copilot-icon-btn--primary {
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
}
.fc-copilot-icon-btn--primary:hover:not(:disabled) {
    background: var(--fc-color-primary-hover);
    color: var(--fc-color-on-primary);
}
.fc-copilot-icon-btn--primary:disabled {
    background: var(--fc-color-border);
    color: var(--fc-color-palette-94a3b8);
}

/* File-attach dropzone overlay */
.fc-copilot-dropzone {
    position: absolute;
    inset: 0;
    background: rgba(22, 163, 74, 0.08);
    border: 2px dashed var(--fc-color-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: var(--fc-color-success-text);
    font-weight: 600;
    pointer-events: none;
    z-index: 4;
}
.fc-copilot-dropzone i { font-size: 1.5rem; }

/* Attachments preview (before sending) */
.fc-copilot-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .45rem;
}
.fc-copilot-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .55rem .3rem .4rem;
    background: var(--fc-color-surface-soft);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 999px;
    font-size: .78rem;
    color: var(--fc-color-palette-0f172a);
    max-width: 220px;
}
.fc-copilot-attachment-chip i { color: var(--fc-color-accent-hover); }
.fc-copilot-attachment-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}
.fc-copilot-attachment-chip__remove {
    background: transparent;
    border: none;
    color: var(--fc-color-text-muted);
    cursor: pointer;
    padding: 0 .15rem;
    font-size: 1rem;
    line-height: 1;
}
.fc-copilot-attachment-chip__remove:hover { color: var(--fc-color-danger); }

/* Image thumbnail inline in chat messages */
.fc-copilot-msg__file {
    margin-top: .35rem;
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .55rem;
    background: var(--fc-color-surface-soft);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 10px;
    font-size: .8rem;
}
.fc-copilot-msg__file img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
}
.fc-copilot-msg__file a { color: var(--fc-color-palette-0f172a); text-decoration: none; }
.fc-copilot-msg__file a:hover { text-decoration: underline; }

/* Clarifying-question picker (replaces the textarea) */
.fc-copilot-question {
    background: var(--fc-color-success-soft);
    border: 1px solid var(--fc-color-success);
    border-radius: 12px;
    padding: .75rem .9rem;
    margin-bottom: .35rem;
}
.fc-copilot-question__title {
    font-weight: 600;
    color: var(--fc-color-palette-0f172a);
    font-size: .9rem;
    margin-bottom: .5rem;
}
.fc-copilot-question__options {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.fc-copilot-option {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .7rem;
    background: var(--fc-color-surface);
    border: 1px solid var(--fc-color-palette-f1f5f9);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: .88rem;
    color: var(--fc-color-palette-0f172a);
    transition: border-color .12s ease, background .12s ease;
}
.fc-copilot-option:hover { border-color: var(--fc-color-primary); }
.fc-copilot-option.is-recommended { border-color: var(--fc-color-primary); }
.fc-copilot-option__star {
    color: var(--fc-color-warning);
    flex: 0 0 auto;
}
.fc-copilot-option__label { flex: 1 1 auto; }
.fc-copilot-option.is-recommended .fc-copilot-option__label::after {
    content: " · рекомендуем";
    color: var(--fc-color-text-muted);
    font-size: .76rem;
}
.fc-copilot-option__check {
    color: var(--fc-color-primary);
    flex: 0 0 auto;
    opacity: 0;
}
.fc-copilot-option.is-recommended .fc-copilot-option__check { opacity: 1; }
.fc-copilot-option__free {
    background: transparent;
    border: 1px dashed var(--fc-color-palette-cbd5e1);
    color: var(--fc-color-text-muted);
}
.fc-copilot-option__free:hover {
    color: var(--fc-color-palette-0f172a);
    border-color: var(--fc-color-text-muted);
}
