.join-manage-body {
    min-height: 100vh;
    background: #f8fafc;
}

.join-manage-main {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 24px 16px 72px;
}

.join-manage-loading {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #475569;
    font-weight: 700;
}

.join-manage-spinner,
.manage-button-spinner {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    border: 3px solid #bfdbfe;
    border-right-color: #2563eb;
    border-radius: 50%;
    animation: join-manage-spin 0.7s linear infinite;
}

.manage-button-spinner {
    width: 17px;
    height: 17px;
    border-width: 2px;
    border-color: rgb(255 255 255 / 45%);
    border-right-color: #ffffff;
}

@keyframes join-manage-spin {
    to { transform: rotate(360deg); }
}

.join-manage-error-state {
    width: min(100%, 620px);
    margin: 48px auto;
    padding: 40px 24px;
    border: 1px solid #fecaca;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgb(15 23 42 / 8%);
    text-align: center;
}

.join-manage-state-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    color: #b91c1c;
}

.join-manage-error-state h1 {
    color: #0f172a;
    font-size: 26px;
    line-height: 1.25;
}

.join-manage-error-state p {
    margin: 12px auto 0;
    color: #475569;
    line-height: 1.6;
}

.join-manage-error-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.join-manage-back {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: #1d4ed8;
    font-size: 14px;
    font-weight: 750;
}

.join-manage-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 12px 0 24px;
}

.join-manage-eyebrow {
    margin: 0 0 6px;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.join-manage-header h1 {
    margin: 0;
    color: #0f172a;
    font-size: 30px;
    line-height: 1.18;
}

.join-manage-header p:not(.join-manage-eyebrow) {
    max-width: 680px;
    margin: 10px 0 0;
    color: #475569;
    line-height: 1.55;
}

.join-manage-header-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.manage-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1.5px solid transparent;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.manage-button:hover {
    text-decoration: none;
}

.manage-button:focus-visible,
.manage-field input:focus-visible,
.manage-field select:focus-visible,
.join-link-card input:focus-visible,
.join-group-option input:focus-visible,
.manage-toggle-row input:focus-visible,
.join-request-group-action select:focus-visible {
    outline: 3px solid rgb(37 99 235 / 25%);
    outline-offset: 2px;
}

.manage-button-primary {
    border-color: #1d4ed8;
    background: #2563eb;
    color: #ffffff;
}

.manage-button-primary:hover {
    border-color: #1e40af;
    background: #1d4ed8;
    color: #ffffff;
}

.manage-button-secondary {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

.manage-button-secondary:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.manage-button-danger-text {
    border-color: #fecaca;
    background: #ffffff;
    color: #b91c1c;
}

.manage-button-danger-text:hover {
    border-color: #b91c1c;
    background: #fef2f2;
    color: #991b1b;
}

.manage-button-link {
    min-height: 40px;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.manage-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.join-manage-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #854d0e;
    font-size: 14px;
    line-height: 1.5;
}

.join-manage-notice svg,
.join-manage-notice i {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.join-manage-layout {
    display: grid;
    gap: 20px;
}

.manage-card {
    min-width: 0;
    padding: 22px 18px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgb(15 23 42 / 5%);
}

.manage-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.manage-card-heading h2,
.join-requests-heading h2 {
    margin: 0;
    color: #0f172a;
    font-size: 21px;
    line-height: 1.25;
}

.manage-card-heading p,
.join-requests-heading > div > p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.manage-card-heading > svg,
.manage-card-heading > i {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    color: #2563eb;
}

.join-settings-form {
    display: grid;
    gap: 22px;
}

.join-settings-grid {
    display: grid;
    gap: 18px;
}

.manage-field label,
.join-link-card > label,
.join-request-group-action > label {
    display: block;
    margin-bottom: 7px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 750;
}

.manage-field input,
.manage-field select,
.join-link-card input,
.join-request-group-action select {
    width: 100%;
    min-height: 46px;
    padding: 10px 11px;
    border: 1.5px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-size: 16px;
}

.manage-field input:hover,
.manage-field select:hover,
.join-link-card input:hover,
.join-request-group-action select:hover {
    border-color: #94a3b8;
}

.manage-field input[aria-invalid="true"],
.manage-field select[aria-invalid="true"] {
    border-color: #b91c1c;
}

.manage-field-note {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.manage-field-error {
    min-height: 18px;
    margin: 5px 0 0;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.4;
}

.manage-toggle-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 18px;
    align-items: start;
    padding: 17px;
    border: 1px solid #dbe3ee;
    border-radius: 11px;
    background: #f8fafc;
}

.manage-toggle-row label {
    display: block;
    color: #1e293b;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
}

.manage-toggle-row p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.manage-toggle-row input {
    width: 24px;
    height: 24px;
    margin-top: 1px;
    accent-color: #2563eb;
}

.manage-fieldset {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
}

.manage-fieldset legend {
    padding: 0 7px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 800;
}

.manage-fieldset > p:first-of-type {
    margin: 0 0 13px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.join-group-options {
    display: grid;
    gap: 9px;
}

.join-group-option {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dbe3ee;
    border-radius: 9px;
    color: #334155;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.join-group-option:hover {
    border-color: #93c5fd;
    background: #f8fafc;
}

.join-group-option input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    accent-color: #2563eb;
}

.manage-inline-empty {
    padding: 18px;
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    background: #f8fafc;
    text-align: center;
}

.manage-inline-empty p {
    margin: 0 0 14px;
    color: #475569;
    line-height: 1.5;
}

.manage-save-button {
    width: 100%;
}

.manage-status {
    padding: 13px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 14px;
    line-height: 1.5;
}

.join-link-card {
    align-self: start;
}

.join-link-card input {
    margin-bottom: 10px;
    background: #f8fafc;
    font-size: 14px;
}

.join-link-card > .manage-button {
    width: 100%;
}

.join-copy-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: #1e40af;
    font-size: 13px;
    font-weight: 650;
}

.join-link-note {
    margin: 16px 0 0;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}

.join-requests-card {
    margin-top: 20px;
}

.join-requests-heading {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.join-request-filters {
    display: grid;
    gap: 12px;
}

.join-request-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.join-request-item {
    min-width: 0;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    background: #ffffff;
}

.join-request-item article {
    padding: 18px;
}

.join-request-item-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
}

.join-request-item-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    overflow-wrap: anywhere;
}

.join-request-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.join-request-badge-pending {
    background: #fff7ed;
    color: #9a3412;
}

.join-request-badge-consent_pending {
    background: #fefce8;
    color: #854d0e;
}

.join-request-badge-active {
    background: #f0fdf4;
    color: #166534;
}

.join-request-badge-rejected,
.join-request-badge-removed {
    background: #fef2f2;
    color: #991b1b;
}

.join-request-meta {
    display: grid;
    gap: 11px;
    margin: 17px 0 0;
}

.join-request-meta > div {
    min-width: 0;
}

.join-request-meta dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.join-request-meta dd {
    margin: 3px 0 0;
    color: #1e293b;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.join-request-links {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 16px;
}

.join-request-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: flex-end;
    margin-top: 17px;
    padding-top: 17px;
    border-top: 1px solid #e2e8f0;
}

.manage-button-small {
    min-height: 42px;
    padding: 8px 12px;
    font-size: 13px;
}

.join-request-group-action {
    width: 100%;
    margin-top: 5px;
}

.join-request-group-action > div {
    display: grid;
    gap: 9px;
}

.join-request-group-action select {
    min-width: 0;
    font-size: 14px;
}

.join-request-working {
    color: #475569;
    font-size: 14px;
    font-weight: 650;
}

.join-request-empty {
    padding: 38px 18px;
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
}

.join-request-empty .join-manage-state-icon {
    color: #64748b;
}

.join-request-empty h3 {
    margin: 0;
    color: #0f172a;
    font-size: 19px;
}

.join-request-empty p {
    max-width: 520px;
    margin: 9px auto 18px;
    color: #64748b;
    line-height: 1.5;
}

@media (min-width: 540px) {
    .join-manage-error-actions,
    .join-manage-header-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .join-settings-grid,
    .join-request-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .join-group-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .join-request-item-heading {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .join-request-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .join-request-group-action > div {
        grid-template-columns: minmax(180px, 1fr) auto;
    }
}

@media (min-width: 768px) {
    .join-manage-main {
        padding: 34px 28px 88px;
    }

    .join-manage-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .join-manage-header h1 {
        font-size: 36px;
    }

    .manage-card {
        padding: 26px;
    }

    .join-request-meta {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .join-manage-layout {
        grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
        align-items: start;
    }

    .join-link-card {
        position: sticky;
        top: 90px;
    }

    .join-requests-heading {
        flex-direction: row;
        justify-content: space-between;
        align-items: end;
    }

    .join-request-filters {
        width: min(100%, 500px);
    }

    .join-request-meta {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .join-request-group-action {
        width: auto;
        min-width: 390px;
        margin-top: 0;
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .join-manage-spinner,
    .manage-button-spinner {
        animation-duration: 1.5s;
    }
}
