.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.page-title {
    margin: 0;
    font-size: var(--admin-font-size);
    font-weight: 700;
}

.page-meta {
    margin: var(--space-2) 0 0;
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.button {
    display: inline-flex;
    height: var(--control-height);
    min-height: var(--control-height);
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--control-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
    white-space: nowrap;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.button:hover {
    border-color: var(--primary-border-strong);
    background: var(--bg-hover);
    box-shadow: var(--shadow-soft);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.button:active {
    box-shadow: none;
    transform: translateY(0) scale(0.985);
}

.button:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.button--primary {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--active-contrast);
}

.button--success {
    color: var(--success);
}

.button--danger {
    color: var(--danger);
}

.button.MuiButton-root {
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 0 var(--control-padding-x);
    border-radius: var(--radius-control);
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
    text-transform: none;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-4);
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.MuiTextField-root,
.MuiFormControl-root {
    --admin-control-height: var(--control-height);
    --admin-control-font-size: var(--control-font-size);
    --admin-control-line-height: var(--control-line-height);
    --admin-floating-label-font-size: 11px;
    --admin-floating-label-line-height: 14px;
    --admin-floating-label-offset-x: 9px;
    --admin-floating-label-offset-y: -7px;
}

.region-select.MuiTextField-root,
.region-select.MuiFormControl-root {
    width: 180px;
    min-width: 180px;
    flex: 0 0 180px;
}

.region-filter-control {
    display: inline-flex;
    min-width: 0;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--space-1);
}

.region-filter-control .region-select.MuiTextField-root,
.region-filter-control .region-select.MuiFormControl-root {
    flex: 0 0 180px;
}

.MuiInputBase-root.MuiOutlinedInput-root:not(.MuiInputBase-multiline) {
    height: var(--control-height);
    min-height: var(--control-height);
}

.MuiInputBase-root.MuiOutlinedInput-root {
    background: var(--bg-input);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.MuiInputBase-root.MuiOutlinedInput-root:not(.MuiInputBase-multiline) .MuiInputBase-input {
    box-sizing: border-box;
    height: var(--control-height);
    padding-top: 0;
    padding-bottom: 0;
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
}

.MuiInputBase-root .MuiInputBase-input::placeholder {
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
}

.MuiInputBase-input:focus {
    outline: 0;
}

.MuiTextField-root .MuiOutlinedInput-root,
.MuiFormControl-root .MuiOutlinedInput-root {
    border-radius: var(--radius-control);
    background: var(--bg-input);
    backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    font-size: var(--admin-control-font-size);
    line-height: var(--admin-control-line-height);
    -webkit-backdrop-filter: var(--glass-blur);
}

.MuiTextField-root .MuiOutlinedInput-root:not(.MuiInputBase-multiline),
.MuiFormControl-root .MuiOutlinedInput-root:not(.MuiInputBase-multiline) {
    height: var(--admin-control-height);
    min-height: var(--admin-control-height);
}

.MuiTextField-root .MuiOutlinedInput-notchedOutline,
.MuiFormControl-root .MuiOutlinedInput-notchedOutline {
    border-color: var(--border);
}

.MuiTextField-root .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline,
.MuiFormControl-root .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
    border-color: var(--primary-border);
}

.MuiTextField-root .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline,
.MuiFormControl-root .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
    border-color: var(--primary);
    border-width: 1px;
}

.MuiInputBase-root.Mui-focused {
    box-shadow: none;
}

.MuiTextField-root .MuiOutlinedInput-input,
.MuiFormControl-root .MuiOutlinedInput-input {
    box-sizing: border-box;
    height: var(--admin-control-height);
    padding: 0 var(--control-padding-x);
    color: var(--text-primary);
    font-size: var(--admin-control-font-size);
    line-height: var(--admin-control-line-height);
}

.MuiTextField-root .MuiOutlinedInput-input::placeholder,
.MuiFormControl-root .MuiOutlinedInput-input::placeholder {
    color: var(--text-tertiary);
    font-size: var(--admin-control-font-size);
    line-height: var(--admin-control-line-height);
    opacity: 1;
}

.MuiTextField-root .MuiInputLabel-outlined,
.MuiFormControl-root .MuiInputLabel-outlined {
    color: var(--text-tertiary);
    font-size: var(--admin-control-font-size);
    line-height: var(--admin-control-line-height);
    letter-spacing: 0;
    transform: translate(var(--control-padding-x), calc((var(--admin-control-height) - var(--admin-control-line-height)) / 2)) scale(1);
}

.MuiTextField-root .MuiInputLabel-outlined.MuiInputLabel-shrink,
.MuiFormControl-root .MuiInputLabel-outlined.MuiInputLabel-shrink {
    max-width: calc((100% - 18px) / 0.78);
    padding: 0 var(--space-1);
    border-radius: 4px;
    background: var(--bg-card);
    font-size: var(--admin-floating-label-font-size);
    line-height: var(--admin-floating-label-line-height);
    transform: translate(var(--admin-floating-label-offset-x), var(--admin-floating-label-offset-y)) scale(0.78);
}

.MuiTextField-root .MuiFormLabel-root.Mui-focused,
.MuiFormControl-root .MuiFormLabel-root.Mui-focused {
    color: var(--primary);
}

.MuiTextField-root .MuiSelect-select,
.MuiFormControl-root .MuiSelect-select {
    display: flex;
    box-sizing: border-box;
    height: var(--admin-control-height);
    min-height: var(--admin-control-height) !important;
    align-items: center;
    padding: 0 var(--space-8) 0 var(--control-padding-x) !important;
    font-size: var(--admin-control-font-size);
    line-height: var(--admin-control-line-height);
}

.MuiTextField-root .MuiSelect-icon,
.MuiFormControl-root .MuiSelect-icon {
    top: 50%;
    color: var(--text-tertiary);
    transform: translateY(-50%);
}

.MuiAutocomplete-root {
    --admin-autocomplete-input-height: 22px;
}

.MuiAutocomplete-root .MuiOutlinedInput-root.MuiAutocomplete-inputRoot:not(.MuiInputBase-multiline) {
    height: auto;
    min-height: var(--control-height);
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: 3px 36px 3px var(--space-2);
}

.MuiAutocomplete-root .MuiOutlinedInput-root.MuiAutocomplete-inputRoot .MuiAutocomplete-input {
    flex: 1 0 12px;
    width: auto !important;
    min-width: 12px;
    height: var(--admin-autocomplete-input-height);
    padding: 0 !important;
    line-height: var(--admin-autocomplete-input-height);
}

.MuiAutocomplete-root .MuiOutlinedInput-root.MuiAutocomplete-inputRoot .MuiAutocomplete-endAdornment {
    top: 50%;
    right: var(--space-2);
    transform: translateY(-50%);
}

.MuiAutocomplete-root .MuiAutocomplete-tag {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-1);
    display: inline-flex;
    flex: 0 0 auto;
    max-width: calc(100% - var(--space-2));
    height: var(--admin-tag-height);
    align-items: center;
    margin: 0;
    border: 1px solid var(--admin-multiselect-tag-border);
    border-radius: var(--admin-tag-radius);
    background: var(--admin-multiselect-tag-bg);
    box-shadow: var(--admin-multiselect-tag-shadow);
    color: var(--admin-multiselect-tag-color);
    font-size: var(--admin-tag-font-size);
    font-weight: var(--admin-tag-font-weight);
    line-height: 1;
    white-space: nowrap;
    animation: row-enter var(--motion-base) var(--ease-emphasized) both;
    transition:
        box-shadow var(--motion-fast) var(--ease-standard),
        filter var(--motion-fast) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:nth-of-type(6n + 2) {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-2);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:nth-of-type(6n + 3) {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-3);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:nth-of-type(6n + 4) {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-4);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:nth-of-type(6n + 5) {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-5);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:nth-of-type(6n) {
    --admin-multiselect-tag-bg: var(--admin-multiselect-tag-6);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:hover {
    box-shadow: var(--admin-multiselect-tag-shadow-hover);
    filter: saturate(1.06) brightness(1.03);
    transform: translateY(-1px);
}

.MuiAutocomplete-root .MuiAutocomplete-tag:active {
    transform: translateY(0) scale(0.98);
}

.MuiAutocomplete-root .MuiAutocomplete-tag .MuiChip-label {
    overflow: hidden;
    padding: 0 var(--admin-tag-padding-x);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.MuiAutocomplete-root .MuiAutocomplete-tag .MuiChip-deleteIcon {
    width: 18px;
    height: 18px;
    margin-right: var(--space-1);
    border-radius: var(--radius-pill);
    color: rgba(255, 255, 255, 0.9);
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-emphasized);
}

.MuiAutocomplete-root .MuiAutocomplete-tag .MuiChip-deleteIcon:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    transform: scale(1.08);
}

.admin-tag-list {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.admin-tag {
    display: inline-flex;
    flex: 0 0 auto;
    max-width: 100%;
    height: var(--admin-tag-height);
    align-items: center;
    gap: var(--admin-tag-gap);
    overflow: hidden;
    border: 1px solid var(--admin-tag-border);
    border-radius: var(--admin-tag-radius);
    background: var(--admin-tag-bg);
    color: var(--admin-tag-color);
    font-size: var(--admin-tag-font-size);
    font-weight: var(--admin-tag-font-weight);
    line-height: 1;
    padding: 0 var(--admin-tag-padding-x);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.MuiAutocomplete-popper .MuiAutocomplete-paper {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-flyout);
    box-shadow: var(--shadow-panel);
    transform-origin: top center;
    animation: autocomplete-pop-enter var(--motion-base) var(--ease-emphasized) both;
}

.MuiAutocomplete-popper[data-popper-placement*="top"] .MuiAutocomplete-paper {
    transform-origin: bottom center;
    animation-name: autocomplete-pop-enter-up;
}

.MuiAutocomplete-popper .MuiAutocomplete-listbox {
    max-height: 280px;
    padding: var(--space-1);
}

.MuiAutocomplete-popper .MuiAutocomplete-option {
    min-height: var(--control-height);
    border-radius: var(--radius-control);
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
    transition:
        background var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        transform var(--motion-fast) var(--ease-emphasized);
}

.MuiAutocomplete-popper .MuiAutocomplete-option.Mui-focused,
.MuiAutocomplete-popper .MuiAutocomplete-option[aria-selected="true"] {
    background: var(--primary-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.MuiTextField-root .MuiOutlinedInput-root.MuiInputBase-multiline,
.MuiFormControl-root .MuiOutlinedInput-root.MuiInputBase-multiline {
    align-items: flex-start;
    padding: var(--space-2) var(--space-3);
}

.MuiTextField-root .MuiOutlinedInput-root.MuiInputBase-multiline .MuiOutlinedInput-input,
.MuiFormControl-root .MuiOutlinedInput-root.MuiInputBase-multiline .MuiOutlinedInput-input {
    height: auto;
    min-height: calc(var(--admin-line-height) * 2);
    padding: 0;
    line-height: var(--admin-control-line-height);
}

.MuiFormHelperText-root {
    margin: var(--space-1) 0 0;
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
    line-height: var(--admin-line-height);
}

.MuiMenuItem-root {
    min-height: var(--control-height);
    font-size: var(--admin-font-size);
}

@media (max-width: 760px) {
    .region-select.MuiTextField-root,
    .region-select.MuiFormControl-root {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .region-filter-control {
        width: 100%;
        flex: 1 1 100%;
    }

    .region-filter-control .region-select.MuiTextField-root,
    .region-filter-control .region-select.MuiFormControl-root {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
    }
}

.kpi-card {
    min-height: 132px;
    padding: var(--space-5);
    animation: panel-enter var(--motion-slow) var(--ease-emphasized) both;
    transition:
        border-color var(--motion-base) var(--ease-standard),
        box-shadow var(--motion-base) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.kpi-grid .kpi-card:nth-child(2) {
    animation-delay: 40ms;
}

.kpi-grid .kpi-card:nth-child(3) {
    animation-delay: 80ms;
}

.kpi-grid .kpi-card:nth-child(4) {
    animation-delay: 120ms;
}

.kpi-grid .kpi-card:nth-child(5) {
    animation-delay: 160ms;
}

.kpi-card:hover,
.chart-card:hover,
.table-card:hover,
.server-rail:hover,
.inline-inspector:hover {
    border-color: var(--primary-border-strong);
    box-shadow: var(--shadow-panel);
    transform: translateY(-2px);
}

.kpi-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.kpi-card__label,
.card-title {
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
    font-weight: 650;
}

.metric-icon {
    display: grid;
    width: var(--control-height);
    height: var(--control-height);
    place-items: center;
    border-radius: var(--radius-control);
    background: var(--primary-surface);
    color: var(--primary);
    transition:
        background var(--motion-base) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.kpi-card:hover .metric-icon {
    transform: scale(1.08) rotate(-4deg);
}

.metric-icon--success {
    background: var(--success-surface);
    color: var(--success);
}

.metric-icon--warning {
    background: var(--warning-surface);
    color: var(--warning);
}

.metric-icon--info {
    background: var(--info-surface);
    color: var(--info);
}

.kpi-value {
    margin-top: var(--space-5);
    color: var(--text-primary);
    font-size: var(--admin-font-size);
    font-weight: 760;
    line-height: 1;
}

.kpi-value span {
    margin-left: var(--space-1);
    font-size: var(--admin-font-size);
    font-weight: 600;
}

.kpi-sub {
    margin-top: var(--space-3);
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
}

.status-ok {
    color: var(--success);
}

.status-warn {
    color: var(--warning);
}

.status-danger {
    color: var(--danger);
}

.status-badge {
    display: inline-flex;
    box-sizing: border-box;
    flex: 0 0 auto;
    max-width: 100%;
    height: var(--admin-tag-height);
    align-items: center;
    gap: var(--admin-tag-gap);
    padding: 0 var(--admin-tag-padding-x);
    border: 1px solid var(--admin-tag-border) !important;
    border-radius: var(--admin-tag-radius) !important;
    background: var(--neutral-surface) !important;
    color: var(--text-secondary) !important;
    font-size: var(--admin-tag-font-size) !important;
    font-weight: var(--admin-tag-font-weight) !important;
    line-height: 1;
    white-space: nowrap;
    word-break: keep-all;
}

.status-point {
    display: block;
    flex: 0 0 var(--space-2);
    width: var(--space-2);
    height: var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--stopped);
}

.status-badge.MuiChip-root {
    gap: 0;
    padding: 0;
}

.status-badge.MuiChip-root .MuiChip-icon {
    margin-left: var(--admin-tag-padding-x);
    margin-right: 0;
}

.status-badge.MuiChip-root .MuiChip-label {
    overflow: hidden;
    padding-left: var(--admin-tag-gap);
    padding-right: var(--admin-tag-padding-x);
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge--running,
.status-badge--succeeded {
    border-color: var(--success-border) !important;
    background: var(--success-surface) !important;
    color: var(--success) !important;
}

.status-badge--running .status-point,
.status-badge--succeeded .status-point {
    background: var(--success);
    box-shadow: 0 0 var(--space-3) var(--success-glow);
}

.status-badge--warning {
    border-color: var(--warning-border) !important;
    background: var(--warning-surface) !important;
    color: var(--warning) !important;
}

.status-badge--warning .status-point {
    background: var(--warning);
    box-shadow: 0 0 var(--space-3) var(--warning-glow);
}

.status-badge--error,
.status-badge--danger {
    border-color: var(--danger-border) !important;
    background: var(--danger-surface) !important;
    color: var(--danger) !important;
}

.status-badge--error .status-point,
.status-badge--danger .status-point {
    background: var(--danger);
    box-shadow: 0 0 var(--space-3) var(--danger-glow);
}

.status-badge--stopped {
    background: var(--neutral-surface) !important;
    color: var(--stopped) !important;
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-chip {
    height: var(--status-height);
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: var(--admin-font-size);
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.filter-chip:hover {
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.filter-chip--active {
    border-color: var(--primary-border-strong);
    background: var(--primary-surface);
    color: var(--text-primary);
}

.muted {
    color: var(--text-tertiary);
}

.cell-stack {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.cell-stack > * {
    min-width: 0;
    overflow-wrap: anywhere;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.empty-state {
    padding: var(--space-8) var(--space-5);
    color: var(--text-tertiary);
    text-align: center;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: var(--space-6);
    background: var(--login-gradient), var(--bg-page);
}

.login-panel {
    display: grid;
    width: min(420px, 100%);
    gap: var(--space-6);
    padding: var(--space-7);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
    box-shadow: var(--shadow-panel);
    animation: panel-enter var(--motion-slow) var(--ease-emphasized) both;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.login-brand h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--admin-font-size);
}

.login-brand p {
    margin: var(--space-1) 0 0;
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
}

.login-form,
.form-drawer {
    display: grid;
    gap: var(--space-4);
}

.form-drawer {
    width: min(420px, 100vw);
    padding: var(--space-6);
}

.form-drawer--wide {
    width: min(560px, 100vw);
}

.form-drawer--sticky-actions {
    box-sizing: border-box;
    height: 100vh;
    max-height: 100vh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.form-drawer--sticky-actions .form-drawer__content {
    display: grid;
    align-content: start;
    min-height: 0;
    gap: var(--space-4);
    overflow: auto;
    padding-right: 2px;
}

.form-drawer--sticky-actions .form-drawer__actions {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.form-drawer--activity-config {
    box-sizing: border-box;
    width: min(880px, calc(100vw - 48px));
    height: 100vh;
    max-height: 100vh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    padding: var(--space-5);
}

.form-drawer--activity-config .form-drawer__content {
    display: grid;
    align-content: start;
    min-height: 0;
    gap: var(--space-4);
    overflow: auto;
    padding-right: 2px;
}

.form-drawer--activity-config .form-drawer__actions {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.role-permission-drawer {
    box-sizing: border-box;
    width: min(1040px, calc(100vw - 48px));
    height: 100vh;
    max-height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    padding: var(--space-5);
}

.role-permission-drawer .form-drawer__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-permission-scope {
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}

.role-permission-drawer .form-drawer__actions {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.form-drawer h2 {
    margin: 0 0 var(--space-1);
    color: var(--text-primary);
    font-size: var(--admin-font-size);
}

.form-drawer__section {
    display: grid;
    gap: var(--space-3);
}

.form-drawer__section + .form-drawer__section {
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-soft);
}

.form-drawer__section-title {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    line-height: 18px;
}

.form-drawer__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}

.form-drawer__grid > .MuiTextField-root,
.form-drawer__grid > .MuiFormControl-root,
.form-drawer__grid > .MuiAutocomplete-root,
.form-drawer__grid > .MuiFormControlLabel-root {
    width: 100%;
}

.form-drawer__section > .MuiFormControlLabel-root,
.form-drawer__grid > .MuiFormControlLabel-root {
    min-height: var(--control-height);
    margin: 0;
}

.form-drawer__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-2);
}

/* 高密度编辑统一使用固定标题、分区导航和操作区，避免长表单把提交按钮推离视口。 */
.form-drawer--workspace {
    box-sizing: border-box;
    width: min(900px, calc(100vw - 48px));
    height: 100vh;
    max-height: 100vh;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0;
    overflow: hidden;
    padding: var(--space-5);
    background: var(--bg-card);
}

.role-form-workspace {
    width: min(1180px, calc(100vw - 48px));
}

.form-drawer__header {
    display: flex;
    min-height: 44px;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.form-drawer__heading {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.form-drawer__heading h2 {
    margin: 0;
}

.form-drawer__heading > span {
    overflow: hidden;
    color: var(--text-tertiary);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-drawer__tabs {
    display: flex;
    min-height: 42px;
    align-items: flex-end;
    gap: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.form-drawer__tabs button {
    position: relative;
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-1);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 650;
    transition: color var(--motion-fast) var(--ease-standard);
}

.form-drawer__tabs button::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--primary);
    content: "";
    opacity: 0;
    transform: scaleX(0.65);
    transition:
        opacity var(--motion-fast) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.form-drawer__tabs button:hover,
.form-drawer__tabs button.is-active {
    color: var(--primary);
}

.form-drawer__tabs button.is-active::after {
    opacity: 1;
    transform: scaleX(1);
}

.form-drawer__tabs small {
    display: grid;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    place-items: center;
    border-radius: var(--radius-pill);
    background: var(--neutral-surface);
    color: var(--text-tertiary);
    line-height: 20px;
}

.form-drawer__tabs button.is-active small {
    background: var(--primary-surface);
    color: var(--primary);
}

.form-drawer__workspace {
    min-height: 0;
    overflow: auto;
    padding: var(--space-4) 2px;
}

.form-drawer--workspace .form-drawer__panel {
    align-content: start;
    min-height: 100%;
}

.form-drawer--workspace .form-drawer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-drawer--workspace .form-drawer__actions {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.form-drawer__section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.form-drawer__section-heading > span {
    color: var(--text-tertiary);
    font-size: 12px;
}

.form-drawer__access-panel {
    display: grid;
    align-content: start;
    gap: var(--space-5);
}

.form-setting-row {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
}

.form-setting-row > div {
    display: grid;
    gap: 2px;
}

.form-setting-row strong {
    color: var(--text-primary);
}

.form-setting-row span {
    color: var(--text-tertiary);
    font-size: 12px;
}

/* 主从分栏让用户先定位应用或权限分类，再编辑单个范围，内容量增长时仍保持稳定扫读路径。 */
.form-editor-split {
    display: grid;
    min-height: 100%;
    grid-template-columns: 220px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.form-editor-split--permissions {
    grid-template-columns: 210px minmax(0, 1fr);
}

.form-editor-rail {
    min-width: 0;
    overflow: auto;
    border-right: 1px solid var(--border);
    background: var(--bg-card-strong);
}

.form-editor-rail__label {
    padding: var(--space-3);
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
}

.form-editor-rail button {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 0;
    border-left: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        color var(--motion-fast) var(--ease-standard);
}

.form-editor-rail button:hover {
    background: var(--bg-hover);
}

.form-editor-rail button.is-active {
    border-left-color: var(--primary);
    background: var(--primary-surface);
    color: var(--primary);
    font-weight: 700;
}

.form-editor-rail button > :first-child {
    min-width: 0;
}

.form-editor-rail__count {
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.form-editor-panel {
    display: grid;
    min-width: 0;
    min-height: 0;
    align-content: start;
    overflow: auto;
}

.form-editor-toolbar {
    position: sticky;
    z-index: 1;
    top: 0;
    display: grid;
    min-height: 60px;
    grid-template-columns: minmax(120px, 1fr) minmax(220px, 300px) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.form-editor-toolbar > div:first-child {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.form-editor-toolbar strong {
    overflow: hidden;
    color: var(--text-primary);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-editor-toolbar > div:first-child > span {
    color: var(--text-tertiary);
    font-size: 12px;
}

.form-editor-filter,
.form-editor-group-actions label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--text-secondary);
    white-space: nowrap;
}

.form-editor-filter .MuiCheckbox-root,
.form-editor-group-actions .MuiCheckbox-root,
.form-option .MuiCheckbox-root {
    padding: 0;
}

.form-editor-group-actions {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--space-3);
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-tertiary);
    font-size: 12px;
}

.form-option-grid {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
}

.form-option-grid--finance,
.form-option-grid--roles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-option-grid--permissions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-option {
    display: flex;
    min-width: 0;
    min-height: 48px;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-card-strong);
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background var(--motion-fast) var(--ease-standard),
        border-color var(--motion-fast) var(--ease-standard),
        transform var(--motion-base) var(--ease-emphasized);
}

.form-option:hover {
    border-color: var(--primary-border-strong);
    background: var(--primary-hover);
}

.form-option:active {
    transform: scale(0.99);
}

.form-option > span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.form-option strong,
.form-option small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-option strong {
    color: var(--text-primary);
    font-size: var(--control-font-size);
    font-weight: 650;
}

.form-option small {
    color: var(--text-tertiary);
    font-size: 11px;
}

.form-option--disabled {
    cursor: not-allowed;
    background: var(--bg-page);
}

.form-option--disabled:hover {
    border-color: var(--border);
    background: var(--bg-page);
}

.form-option--disabled:active {
    transform: none;
}

.form-option--disabled strong {
    color: var(--text-tertiary);
}

.form-option__holder {
    color: var(--warning);
}

.form-option--single-line {
    min-height: 40px;
}

.form-option--single-line > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-editor-state {
    display: grid;
    min-height: 160px;
    place-items: center;
    color: var(--text-tertiary);
}

.form-editor-state--error {
    color: var(--danger);
}

@media (max-width: 980px) {
    .form-drawer--workspace,
    .role-form-workspace {
        width: 100vw;
        padding: var(--space-4);
    }

    .form-editor-split,
    .form-editor-split--permissions {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .form-option-grid--permissions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .form-drawer--workspace .form-drawer__grid,
    .form-option-grid--finance,
    .form-option-grid--roles,
    .form-option-grid--permissions {
        grid-template-columns: 1fr;
    }

    .form-editor-split,
    .form-editor-split--permissions {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .form-editor-rail {
        display: flex;
        max-height: none;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .form-editor-rail__label {
        display: none;
    }

    .form-editor-rail button {
        width: auto;
        min-width: max-content;
        border-bottom: 2px solid transparent;
        border-left: 0;
    }

    .form-editor-rail button.is-active {
        border-bottom-color: var(--primary);
    }

    .form-editor-toolbar {
        position: static;
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .form-drawer__tabs button::after,
    .form-editor-rail button,
    .form-option {
        transition: none;
    }
}

.reward-tier-editor-table {
    display: grid;
    min-width: 0;
    gap: var(--space-2);
    overflow-x: auto;
}

.reward-tier-editor-table__head,
.reward-tier-editor-table__row {
    display: grid;
    min-width: 720px;
    align-items: center;
    gap: var(--space-2);
    grid-template-columns: var(--reward-tier-columns, 72px minmax(160px, 1fr) minmax(160px, 1fr) 120px 96px 52px);
}

.reward-tier-editor-table__head {
    padding: 0 var(--space-2);
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
}

.reward-tier-editor-table__body {
    display: grid;
    gap: var(--space-2);
}

.reward-tier-editor-table__row {
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-2);
    background: var(--fill-secondary);
}

.reward-tier-editor-table__cell {
    min-width: 0;
}

.reward-tier-editor-table__cell > .MuiTextField-root,
.reward-tier-editor-table__cell > .MuiFormControl-root,
.reward-tier-editor-table__cell > .MuiAutocomplete-root {
    width: 100%;
}

.reward-tier-editor-table__index {
    color: var(--text-primary);
    font-weight: 750;
    white-space: nowrap;
}

.reward-tier-editor-table__action {
    display: flex;
    justify-content: flex-end;
}

.reward-tier-editor-table__empty {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-2);
    color: var(--text-tertiary);
}

.weekly-star-config-drawer {
    box-sizing: border-box;
    display: grid;
    width: min(880px, calc(100vw - 48px));
    height: 100vh;
    max-height: 100vh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: var(--space-4);
    overflow: hidden;
    padding: var(--space-5);
}

.weekly-star-config-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.weekly-star-config-drawer__title {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--admin-font-size);
    font-weight: 800;
}

.weekly-star-config-drawer__body {
    display: grid;
    align-content: start;
    min-height: 0;
    gap: var(--space-4);
    overflow: auto;
    padding-right: 2px;
}

.weekly-star-config-section {
    display: grid;
    gap: var(--space-3);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.weekly-star-config-section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.weekly-star-config-grid {
    display: grid;
    gap: var(--space-3);
}

.weekly-star-config-grid--basic {
    grid-template-columns: minmax(240px, 1.2fr) minmax(160px, 0.8fr) minmax(180px, 0.8fr);
}

.weekly-star-config-grid > .MuiTextField-root,
.weekly-star-config-grid > .MuiFormControl-root,
.weekly-star-config-grid > .MuiAutocomplete-root {
    width: 100%;
}

.weekly-star-time-range {
    display: flex;
    align-items: center;
    grid-column: 1 / -1;
}

.weekly-star-time-range__control {
    width: min(680px, 100%) !important;
}

.weekly-star-config-card-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weekly-star-config-card {
    display: grid;
    min-width: 0;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--fill-secondary);
}

.weekly-star-config-card__header {
    display: flex;
    min-height: 22px;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.weekly-star-config-card__label {
    color: var(--text-primary);
    font-weight: 760;
    line-height: 1;
}

.weekly-star-rank-badge {
    display: inline-flex;
    height: 22px;
    align-items: center;
    padding: 0 var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 760;
    line-height: 1;
}

.weekly-star-rank-badge--1 {
    border-color: color-mix(in srgb, #f2a800 36%, var(--border));
    background: color-mix(in srgb, #f2a800 13%, var(--bg-card));
}

.weekly-star-rank-badge--2 {
    border-color: color-mix(in srgb, #7d8796 32%, var(--border));
    background: color-mix(in srgb, #7d8796 12%, var(--bg-card));
}

.weekly-star-rank-badge--3 {
    border-color: color-mix(in srgb, #c26f30 34%, var(--border));
    background: color-mix(in srgb, #c26f30 12%, var(--bg-card));
}

.weekly-star-list-stack {
    display: grid;
    min-width: 0;
    gap: var(--space-1);
}

.weekly-star-list-title,
.weekly-star-list-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-star-list-title {
    color: var(--text-primary);
    font-weight: 720;
}

.weekly-star-list-meta {
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 18px;
}

.weekly-star-list-chip-list {
    display: grid;
    width: 100%;
    min-width: 0;
    max-height: 82px;
    gap: var(--space-1);
    overflow: hidden;
}

.weekly-star-list-chip.MuiChip-root {
    max-width: 100%;
    justify-content: flex-start;
}

.weekly-star-list-chip .MuiChip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-star-list-actions {
    display: flex;
    width: 100%;
    justify-content: flex-end;
}

.weekly-star-list-actions > div {
    display: grid;
    grid-template-columns: repeat(2, var(--control-height));
    gap: var(--space-2);
    justify-content: end;
}

.weekly-star-config-drawer__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.side-drawer {
    box-sizing: border-box;
    display: flex;
    width: min(420px, 100vw);
    height: 100vh;
    max-height: 100vh;
    flex-direction: column;
    gap: var(--space-4);
    overflow: hidden;
    padding: var(--space-6);
    background: var(--bg-card);
}

.side-drawer--wide {
    width: min(560px, 100vw);
}

.side-drawer--detail {
    width: min(720px, 100vw);
}

.side-drawer__header {
    display: flex;
    flex: 0 0 auto;
    min-height: var(--control-height);
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.side-drawer__title {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--admin-font-size);
    font-weight: 800;
}

.side-drawer__body {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    gap: var(--space-4);
    overflow: auto;
    padding-right: 2px;
}

.side-drawer__actions {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.form-section-title {
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
    font-weight: 700;
}

.permission-menu-list {
    display: grid;
    gap: var(--space-3);
}

.role-permission-menu-list {
    display: block;
    column-count: 2;
    column-gap: var(--space-3);
}

.role-permission-menu-list > .permission-menu-section {
    width: 100%;
    margin-bottom: var(--space-3);
    break-inside: avoid;
}

.permission-menu-section {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.permission-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: var(--control-height);
}

.permission-menu-title {
    color: var(--text-primary);
    font-size: var(--admin-font-size);
    font-weight: 700;
}

.permission-menu-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.permission-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
    font-weight: 600;
    white-space: nowrap;
}

.permission-menu-toggle .MuiCheckbox-root,
.permission-check .MuiCheckbox-root {
    padding: 0;
}

.permission-menu-count {
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
    white-space: nowrap;
}

.permission-section {
    display: grid;
    gap: var(--space-3);
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.permission-grid--compact {
    gap: var(--space-2);
}

.permission-grid--finance {
    grid-template-columns: 1fr;
}

.permission-scope-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

.permission-scope-group > strong {
    grid-column: 1 / -1;
    color: var(--text-primary);
    font-size: var(--admin-font-size);
}

.permission-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--control-height);
    padding: 0 var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-control);
    background: var(--bg-card-strong);
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
}

.role-permission-drawer .permission-menu-section {
    padding: var(--space-2);
}

.role-permission-drawer .permission-menu-header {
    min-height: 30px;
}

.role-permission-drawer .permission-check {
    min-height: 30px;
    padding: 0 var(--space-2);
}

.role-permission-drawer .permission-check span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .role-permission-drawer {
        width: 100vw;
        padding: var(--space-4);
    }

    .role-permission-drawer .form-drawer__grid {
        grid-template-columns: 1fr;
    }

    .role-permission-menu-list {
        column-count: 1;
    }
}

@media (max-width: 900px) {
    .form-drawer--activity-config,
    .weekly-star-config-drawer {
        width: 100vw;
        padding: var(--space-4);
    }

    .reward-tier-editor-table {
        overflow-x: visible;
    }

    .reward-tier-editor-table__head {
        display: none;
    }

    .reward-tier-editor-table__row {
        min-width: 0;
        grid-template-columns: 1fr;
    }

    .reward-tier-editor-table__cell {
        display: grid;
        align-items: center;
        gap: var(--space-2);
        grid-template-columns: 96px minmax(0, 1fr);
    }

    .reward-tier-editor-table__cell::before {
        color: var(--text-tertiary);
        content: attr(data-label);
        font-size: 12px;
        font-weight: 700;
    }

    .reward-tier-editor-table__action {
        justify-content: space-between;
    }

    .weekly-star-config-grid--basic,
    .weekly-star-config-card-grid {
        grid-template-columns: 1fr;
    }
}

.batch-actions {
    display: flex;
    gap: var(--space-2);
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 32px;
    margin-top: var(--space-2);
    color: var(--text-tertiary);
    font-size: 12px;
}

.pagination-bar__meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--space-2);
}

.data-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    gap: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
    color: var(--text-tertiary);
}

.data-state--loading {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: var(--space-4);
}

.data-state__skeleton {
    display: grid;
    width: 100%;
    min-height: 360px;
    grid-template-rows: auto minmax(0, 1fr);
    gap: var(--space-4);
}

.data-state__skeleton-toolbar {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.data-state__skeleton-filters,
.data-state__skeleton-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.data-state__skeleton-actions {
    flex: 0 0 auto;
}

.data-state__skeleton-filter {
    width: 150px;
    height: var(--control-height);
}

.data-state__skeleton-reset,
.data-state__skeleton-action {
    width: 84px;
    height: var(--control-height);
}

.data-state__skeleton-table {
    display: grid;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.data-state__skeleton-head {
    height: var(--table-head-height);
    border-radius: 0;
    background-color: var(--bg-card-strong);
}

.data-state__skeleton-row {
    display: grid;
    min-height: var(--table-row-height);
    align-items: center;
    grid-template-columns: minmax(180px, 1.35fr) minmax(100px, 0.7fr) minmax(140px, 0.95fr) minmax(90px, 0.55fr) minmax(54px, 0.35fr);
    gap: var(--space-4);
    padding: 0 var(--space-4);
    border-top: 1px solid var(--row-border);
}

.data-state__skeleton-cell {
    width: min(100%, 150px);
    height: 18px;
}

.data-state__skeleton-cell--main {
    width: min(100%, 220px);
}

.data-state__skeleton-cell--short {
    width: 72px;
}

.data-state__skeleton-cell--action {
    width: 34px;
    height: 28px;
}

.data-state__title {
    color: var(--text-secondary);
    font-size: var(--admin-font-size);
    font-weight: 650;
}

.admin-table {
    --admin-table-cell-x: var(--space-3);
    display: flex;
    flex-direction: column;
    width: max(100%, var(--admin-table-min-width, 900px), var(--admin-table-content-width, 0px));
    min-height: 100%;
    min-width: max(100%, var(--admin-table-min-width, 900px), var(--admin-table-content-width, 0px));
}

.admin-row {
    display: grid;
    flex: 0 0 auto;
    align-items: center;
    grid-template-columns: var(--admin-table-columns);
    min-height: var(--table-row-height);
    padding: 0;
    border-bottom: 1px solid var(--row-border);
    background: var(--bg-card);
    color: var(--text-secondary);
    column-gap: 0;
    font-size: var(--admin-font-size);
    animation: row-enter var(--motion-slow) var(--ease-emphasized) both;
}

.admin-row[role="button"] {
    cursor: pointer;
}

.admin-row--head {
    min-height: var(--table-head-height);
    background: var(--bg-card-strong);
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
    font-weight: 650;
}

.admin-row--load-more {
    min-height: 36px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.admin-row--load-more-done {
    min-height: 1px;
}

.admin-cell--load-more {
    grid-column: 1 / -1;
    text-align: center;
}

.admin-row--load-more-sentinel {
    min-height: 1px;
}

.admin-cell {
    box-sizing: border-box;
    min-width: 0;
    padding: 0 var(--admin-table-cell-x);
    overflow: hidden;
    overflow-wrap: anywhere;
}

.admin-cell--actions {
    justify-content: center;
    overflow: visible;
}

.admin-cell:first-child {
    padding-left: var(--admin-table-cell-x);
}

.admin-cell:last-child {
    padding-right: var(--admin-table-cell-x);
}

.admin-cell--head {
    position: relative;
    display: flex;
    min-height: var(--table-head-height);
    align-items: center;
    padding-right: calc(var(--admin-table-cell-x) + 10px);
}

.admin-cell--head:last-child {
    padding-right: calc(var(--admin-table-cell-x) + 10px);
}

.admin-cell__head-content {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: var(--space-2);
}

.admin-cell__head-label {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-cell__head-custom {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    overflow: visible;
}

.admin-cell__head-filter {
    color: var(--primary);
    font-weight: 700;
}

.admin-cell__head-trigger {
    display: inline-flex;
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: inherit;
}

.admin-cell__head-trigger:hover,
.admin-cell__head-trigger--active {
    color: var(--text-primary);
}

.admin-cell__head-icon {
    flex: 0 0 auto;
    color: var(--text-tertiary);
    font-size: 16px;
}

.admin-cell__head-trigger--active .admin-cell__head-icon {
    color: var(--primary);
}

.inline-edit-cell {
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
    align-items: center;
}

.inline-edit-cell__button {
    display: inline-flex;
    width: var(--inline-edit-cell-width, 100%);
    max-width: min(var(--inline-edit-cell-max-width, 100%), 100%);
    min-height: 30px;
    align-items: center;
    justify-content: flex-start;
    padding: 0 var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-edit-cell__button:hover {
    border-color: var(--primary-border);
    background: var(--primary-surface);
    color: var(--primary);
}

.inline-edit-cell__button:disabled {
    cursor: default;
    color: var(--text-tertiary);
}

.inline-edit-cell__button:disabled:hover {
    border-color: transparent;
    background: transparent;
    color: var(--text-tertiary);
}

.inline-edit-cell__button--link {
    padding-right: 0;
    padding-left: 0;
    border: 0;
    color: var(--primary);
    font-weight: 700;
}

.inline-edit-cell__button--link:hover {
    background: transparent;
    color: var(--primary-strong);
    text-decoration: underline;
}

.inline-edit-cell__button--link:disabled {
    color: var(--text-primary);
}

.inline-edit-cell__button--link:disabled:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.inline-edit-cell__input {
    width: var(--inline-edit-cell-width, 100%);
    max-width: min(var(--inline-edit-cell-max-width, 100%), 100%);
}

.inline-edit-cell__input :is(.MuiInputBase-input) {
    padding-right: var(--space-2);
    padding-left: var(--space-2);
    text-align: left;
}

.admin-table-filter-reset-wrap {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
}

.admin-cell--fixed-left,
.admin-cell--fixed-right {
    position: sticky;
    z-index: 2;
    display: flex;
    min-height: var(--table-row-height);
    align-items: center;
    background: inherit;
}

.admin-cell--fixed-left {
    left: 0;
    box-shadow: 10px 0 18px -18px rgb(30 41 59 / 0.4);
}

.admin-cell--fixed-right {
    right: 0;
    box-shadow: -10px 0 18px -18px rgb(30 41 59 / 0.4);
}

.admin-row--head .admin-cell--fixed-left,
.admin-row--head .admin-cell--fixed-right {
    z-index: 4;
    min-height: var(--table-head-height);
    background: inherit;
}

.admin-column-resizer {
    position: absolute;
    top: 9px;
    right: 0;
    bottom: 9px;
    width: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: col-resize;
    touch-action: none;
}

.admin-column-resizer::after {
    position: absolute;
    top: 0;
    right: 4px;
    bottom: 0;
    width: 1px;
    border-radius: var(--radius-pill);
    background: transparent;
    content: "";
    transition:
        background var(--motion-fast) var(--ease-standard),
        box-shadow var(--motion-fast) var(--ease-standard);
}

.admin-column-resizer:hover::after,
.admin-cell--resizing .admin-column-resizer::after {
    background: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-surface);
}

.admin-table--resizing {
    cursor: col-resize;
    user-select: none;
}

.admin-table-filter-popover .MuiPopover-paper {
    width: 280px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-flyout);
    box-shadow: var(--shadow-panel);
}

.admin-table-filter {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-2);
}

.admin-table-filter__search.MuiTextField-root {
    width: 100%;
}

.admin-table-filter__options {
    max-height: 280px;
    overflow: auto;
}

.admin-table-filter__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
}

.admin-table-filter__options .MuiMenuItem-root {
    min-height: 34px;
    border-radius: var(--radius-control);
    color: var(--text-secondary);
}

.admin-table-filter__options .MuiMenuItem-root.Mui-selected {
    background: var(--primary-hover);
    color: var(--text-primary);
}

.admin-table-filter__empty {
    padding: var(--space-4) var(--space-2);
    color: var(--text-tertiary);
    font-size: var(--admin-font-size);
    text-align: center;
}

.admin-table .empty-state--table {
    flex: 1;
}

.table-frame {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    background: var(--bg-card);
}

.table-frame .table-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    scrollbar-color: var(--border-strong) var(--bg-subtle);
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.table-frame .table-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-frame .table-scroll::-webkit-scrollbar-track {
    background: var(--bg-subtle);
}

.table-frame .table-scroll::-webkit-scrollbar-thumb {
    border: 2px solid var(--bg-subtle);
    border-radius: 999px;
    background: var(--border-strong);
}

.table-frame .table-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.table-frame .admin-row--head {
    position: sticky;
    top: 0;
    z-index: 1;
}

.content-panel,
.table-frame,
.table-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.content-panel {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 520px;
}

.empty-state--table {
    min-height: 340px;
    align-content: center;
}

.empty-state__title {
    color: var(--text-secondary);
    font-weight: 650;
}

.empty-state__action {
    display: flex;
    justify-content: center;
}
