.member-panel
{
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    background: var(--panel);
}

.member-header
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.member-header h2
{
    margin: 0;
    font-size: 22px;
}

.member-header p
{
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-dim);
}

.member-header-actions
{
    display: flex;
    align-items: center;
    gap: 8px;
}

.member-action
{
    display: grid;
    grid-template-columns: 16px auto;
    gap: 7px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text);
    background: var(--panel-soft);
    cursor: pointer;
}

.member-action.primary
{
    border-color: transparent;
    color: #ffffff;
    background: var(--accent);
}

.member-action:hover,
.member-action:focus
{
    border-color: #8bcfc6;
    background: #eef8f6;
    outline: none;
}

.member-action.primary:hover,
.member-action.primary:focus
{
    background: var(--accent-hover);
}

.member-action:disabled
{
    opacity: 0.65;
    cursor: not-allowed;
}

.member-action svg
{
    width: 16px;
    height: 16px;
}

.member-dialog-backdrop
{
    position: fixed;
    z-index: 35;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(3px);
}

.member-dialog-backdrop[hidden]
{
    display: none;
}

.member-dialog
{
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(760px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.18);
}

.member-dialog-header
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding: 18px 20px;
}

.member-dialog-header h3
{
    margin: 0;
    font-size: 18px;
}

.member-dialog-header p
{
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-dim);
}

.member-dialog-close
{
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    background: #ffffff;
    cursor: pointer;
}

.member-dialog-close:hover,
.member-dialog-close:focus
{
    color: var(--text);
    background: var(--panel-soft);
    outline: none;
}

.member-dialog-close svg
{
    width: 18px;
    height: 18px;
}

.member-dialog-body
{
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.member-dialog-body .member-detail-form
{
    margin-top: 0;
}

.member-dialog-actions
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

.member-dialog-actions-left,
.member-dialog-actions-right
{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.member-dialog-action
{
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-weight: 700;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
}

.member-dialog-action.primary
{
    border-color: transparent;
    color: #ffffff;
    background: var(--accent);
}

.member-dialog-action.danger
{
    border-color: #f1b8b8;
    color: #b42318;
    background: #fff5f5;
}

.member-dialog-action:hover,
.member-dialog-action:focus
{
    border-color: #8bcfc6;
    background: #eef8f6;
    outline: none;
}

.member-dialog-action.primary:hover,
.member-dialog-action.primary:focus
{
    background: var(--accent-hover);
}

.member-dialog-action.danger:hover,
.member-dialog-action.danger:focus
{
    border-color: #ef8f8f;
    color: #8f1d14;
    background: #ffe7e7;
}

.member-dialog-action:disabled
{
    opacity: 0.55;
    cursor: not-allowed;
}

.member-preset-backdrop
{
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
}

.member-preset-backdrop[hidden]
{
    display: none;
}

.member-preset-dialog
{
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(520px, calc(100% - 40px));
    max-height: min(520px, calc(100vh - 160px));
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.member-preset-header
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
}

.member-preset-header strong
{
    display: block;
    font-size: 15px;
}

.member-preset-header span
{
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-dim);
}

.member-preset-close
{
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    background: #ffffff;
    cursor: pointer;
}

.member-preset-close:hover,
.member-preset-close:focus
{
    color: var(--text);
    background: var(--panel-soft);
    outline: none;
}

.member-preset-close svg
{
    width: 16px;
    height: 16px;
}

.member-preset-list
{
    display: grid;
    gap: 14px;
    overflow-y: auto;
    padding: 14px 16px;
}

.member-preset-section
{
    display: grid;
    gap: 8px;
}

.member-preset-section h4
{
    margin: 0;
    font-size: 12px;
    color: var(--text-dim);
}

.member-preset-item
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--panel-soft);
}

.member-preset-item-content
{
    min-width: 0;
}

.member-preset-item-content strong
{
    display: block;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-preset-item-content span
{
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

.member-preset-item-actions
{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.member-preset-action,
.member-preset-save
{
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    background: #ffffff;
    cursor: pointer;
}

.member-preset-action.danger
{
    border-color: #f1b8b8;
    color: #b42318;
    background: #fff5f5;
}

.member-preset-action:hover,
.member-preset-action:focus,
.member-preset-save:hover,
.member-preset-save:focus
{
    border-color: #8bcfc6;
    background: #eef8f6;
    outline: none;
}

.member-preset-action.danger:hover,
.member-preset-action.danger:focus
{
    border-color: #ef8f8f;
    color: #8f1d14;
    background: #ffe7e7;
}

.member-preset-empty
{
    margin: 0;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--panel-soft);
}

.member-preset-actions
{
    border-top: 1px solid var(--border);
    padding: 12px 16px;
}

@media (max-width: 720px)
{
    .member-header
    {
        align-items: flex-start;
        flex-direction: column;
    }

    .member-header-actions
    {
        flex-wrap: wrap;
        width: 100%;
    }

    .member-action
    {
        justify-content: center;
        flex: 1 1 140px;
    }

    .member-dialog-backdrop
    {
        padding: 12px;
    }

    .member-dialog
    {
        max-height: calc(100vh - 24px);
    }

    .member-dialog-header,
    .member-dialog-body,
    .member-dialog-actions
    {
        padding-right: 14px;
        padding-left: 14px;
    }

    .member-dialog-actions-left,
    .member-dialog-actions-right
    {
        width: 100%;
    }

    .member-dialog-actions-right
    {
        justify-content: flex-end;
    }

    .member-preset-backdrop
    {
        padding: 12px;
    }

    .member-preset-dialog
    {
        width: 100%;
        max-height: calc(100vh - 24px);
    }

    .member-preset-item
    {
        grid-template-columns: minmax(0, 1fr);
    }

    .member-preset-item-actions
    {
        justify-content: flex-start;
    }
}

@media (max-width: 520px)
{
    .member-dialog-actions-right
    {
        display: grid;
        grid-template-columns: 1fr;
    }

    .member-dialog-action,
    .member-preset-save,
    .member-preset-action
    {
        justify-content: center;
        width: 100%;
    }

    .member-preset-item-actions
    {
        display: grid;
        grid-template-columns: 1fr;
    }
}

.member-content
{
    padding: 24px;
    min-height: 0;
    overflow-y: auto;
}

.member-list-panel
{
    min-width: 0;
}

.member-list
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.member-card
{
    display: grid;
    gap: 14px;
    align-content: start;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(19, 41, 48, 0.04);
}

.member-card-header
{
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.member-card-avatar
{
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid #a8ded8;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 900;
    color: var(--accent-hover);
    background: #e8f6f3;
}

.member-card-title-wrap
{
    display: grid;
    gap: 6px;
    min-width: 0;
}

.member-card-edit
{
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-dim);
    background: transparent;
    cursor: pointer;
}

.member-card-edit:hover,
.member-card-edit:focus
{
    border-color: var(--border);
    color: var(--text);
    background: #ffffff;
    outline: none;
}

.member-card-edit svg
{
    width: 15px;
    height: 15px;
}

.member-card:hover,
.member-card:focus
{
    border-color: #8bcfc6;
    background: linear-gradient(180deg, #ffffff 0%, #eef8f6 100%);
    box-shadow: 0 8px 24px rgba(19, 41, 48, 0.08);
    outline: none;
}

.member-card.active
{
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(18, 131, 116, 0.16);
}

.member-card-title
{
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}

.member-card-role
{
    display: grid;
    gap: 6px;
    border-top: 1px solid #dcebe8;
    padding-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-hover);
    line-height: 1.5;
}

.member-card-note,
.member-card-link
{
    display: grid;
    gap: 6px;
    border-left: 3px solid #b7d7ef;
    border-radius: 0 8px 8px 0;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-dim);
    background: #f4f8fb;
    line-height: 1.6;
}

.member-card-section-label
{
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-hover);
}

.member-card-role p,
.member-card-note p
{
    margin: 0;
}

.member-card-link
{
    color: var(--text);
}

.member-card-footer
{
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid #e4eeec;
    padding-top: 12px;
}

.member-card-status
{
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border: 1px solid #d9e7e4;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: #ffffff;
}

.member-card-status.normal
{
    border-color: #a8ded8;
    color: var(--accent-hover);
    background: #eef8f6;
}

.member-card-status.warning
{
    border-color: #f0d7a6;
    color: #9f6b00;
    background: #fff8e7;
}

.member-card-status.error
{
    border-color: #f1b8b1;
    color: #b42318;
    background: #fff3f1;
}

.member-card-status.muted
{
    color: var(--text-dim);
}

.member-empty
{
    grid-column: 1 / -1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    color: var(--text-dim);
    background: var(--panel-soft);
}

.member-detail-form
{
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.member-detail-field
{
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
}

.member-detail-field span
{
    color: var(--text-dim);
}

.member-detail-field input,
.member-detail-field select,
.member-detail-field textarea
{
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit;
    font-weight: 500;
    color: var(--text);
    background: #ffffff;
}

.member-detail-field textarea
{
    resize: vertical;
    min-height: 86px;
    line-height: 1.5;
}

.member-array-editor
{
    display: grid;
    gap: 8px;
}

.member-array-list
{
    display: grid;
    gap: 8px;
}

.member-array-item
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.member-array-remove,
.member-array-add
{
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.member-array-remove
{
    min-height: 38px;
    padding: 0 10px;
}

.member-array-add
{
    justify-self: start;
    min-height: 34px;
    padding: 0 12px;
}

.member-array-remove:hover,
.member-array-remove:focus,
.member-array-add:hover,
.member-array-add:focus
{
    border-color: #8bcfc6;
    outline: none;
}

.member-detail-field input[readonly]
{
    color: var(--text-dim);
    background: var(--panel);
}
