.detail-dialog:has(.split-content) { width: min(1080px, calc(100vw - 28px)); }
.detail-dialog:has(.identity-workspace) { width: min(980px, calc(100vw - 28px)); }
.split-content { display: grid; grid-template-columns: minmax(280px, 0.75fr) minmax(360px, 1.25fr); gap: 20px; max-height: 72vh; overflow: auto; }
.split-content h3 { margin: 0 0 12px; color: var(--color-text-strong); }

.identity-workspace { display: flex; flex-direction: column; min-height: min(680px, calc(100vh - 64px)); max-height: calc(100vh - 56px); }
.identity-content { min-height: 0; flex: 1; overflow-y: auto; padding-top: 16px; }
.identity-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--color-border); padding: 0 4px; }
.identity-tabs .tab-button { min-width: 0; display: flex; justify-content: center; align-items: center; gap: 7px; border: 0; border-bottom: 2px solid transparent; border-radius: var(--radius-control) var(--radius-control) 0 0; background: transparent; padding: 10px 12px; color: var(--color-text-muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.identity-tabs .tab-button:hover { background: var(--color-surface-hover); color: var(--color-text-strong); }
.identity-tabs .tab-button.active { border-bottom-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary-strong); }
.identity-tabs .tab-button span { min-width: 22px; border: 1px solid var(--color-border); border-radius: 999px; padding: 1px 6px; background: var(--color-surface); font-size: 11px; text-align: center; }
.identity-panel[hidden], [data-identity-user-list][hidden], [data-identity-role-list][hidden], .identity-user-create[hidden], .role-creator[hidden], .identity-user-record[hidden], .custom-role-editor[hidden] { display: none; }
.identity-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.identity-section-heading > div { min-width: 0; }
.identity-section-heading h3 { margin: 0; color: var(--color-text-strong); font-size: 17px; }
.identity-section-heading p { margin: 4px 0 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.45; }
.identity-user-filters { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(2, minmax(140px, 0.75fr)); gap: 10px; margin-bottom: 12px; }
.identity-user-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.identity-user-record { min-width: 0; min-height: 92px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); padding: 12px; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
.identity-user-record:hover { border-color: var(--color-primary-border); background: var(--color-surface-hover); box-shadow: var(--shadow-control); }
.identity-user-main, .identity-user-meta { min-width: 0; display: grid; gap: 3px; }
.identity-user-main strong { overflow: hidden; color: var(--color-text-strong); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.identity-user-main small, .identity-user-record > small, .identity-user-meta > span:first-child { overflow-wrap: anywhere; color: var(--color-text-muted); font-size: 11px; line-height: 1.35; }
.identity-user-meta { justify-items: end; text-align: right; }
.identity-user-record > small { grid-column: 1 / -1; color: var(--color-primary-strong); }
.identity-user-create form, .identity-user-detail form { min-height: 0; }
.identity-user-create form > .form-grid { padding-top: 2px; }
.role-selection-summary { margin: 10px 0 0; border-left: 3px solid var(--color-primary); padding: 7px 10px; background: var(--color-primary-soft); color: var(--color-text-muted); font-size: 12px; }
.custom-role-settings { margin-top: 14px; border: 1px solid var(--color-primary-border); border-radius: var(--radius-control); background: var(--color-primary-soft); padding: 12px; }
.custom-role-settings > p { margin: 6px 0 0; color: var(--color-text-muted); font-size: 12px; line-height: 1.45; }
.custom-role-editor { margin-top: 14px; border-top: 1px solid var(--color-primary-border); padding-top: 14px; }
.role-preset-actions { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; }
.role-preset-actions small { color: var(--color-text-muted); font-size: 12px; line-height: 1.4; }

.role-matrix-list { min-width: 0; }
.role-matrix { border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); padding: 14px; margin-bottom: 10px; }
.role-matrix-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.role-matrix-heading > div { min-width: 0; display: grid; gap: 3px; }
.role-matrix-heading strong { color: var(--color-text-strong); font-size: 14px; }
.role-matrix-heading span { color: var(--color-text-muted); font-size: 12px; line-height: 1.4; }
.role-matrix-fixed { border-color: var(--color-primary-border); background: var(--color-primary-soft); }
.role-matrix-fixed > p { margin: 0; color: var(--color-text); font-size: 13px; line-height: 1.5; }
.role-matrix-collapsible { padding: 0; background: var(--color-surface); }
.role-matrix-summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.role-matrix-summary::-webkit-details-marker { display: none; }
.role-matrix-summary::after { content: '+'; flex: 0 0 auto; color: var(--color-primary-strong); font-size: 20px; font-weight: 700; }
.role-matrix-collapsible details[open] > .role-matrix-summary::after { content: '\2212'; }
.role-matrix-summary > span:first-child { min-width: 0; display: grid; gap: 3px; margin-right: auto; }
.role-matrix-summary strong { color: var(--color-text-strong); font-size: 14px; }
.role-matrix-summary small { color: var(--color-text-muted); font-size: 11px; line-height: 1.4; }
.role-matrix-body { padding: 0 14px 14px; border-top: 1px solid var(--color-border); }
.role-matrix-body > .permission-group:first-child, .role-matrix-editor > .permission-group:first-child { margin-top: 14px; }
.role-impact { margin: 12px 0 0; border-left: 3px solid var(--color-primary); padding: 7px 10px; background: var(--color-primary-soft); color: var(--color-text-muted); font-size: 12px; }
.role-matrix-editor > footer, .role-creator > form > footer, .role-delete-control footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.role-creator { min-width: 0; }
.role-creator > form { min-width: 0; }
.role-delete-blocked { display: grid; gap: 3px; margin-top: 14px; border: 1px solid var(--color-warning-border); border-radius: var(--radius-control); background: var(--color-warning-soft); padding: 10px 12px; }
.role-delete-blocked strong { color: var(--color-text-strong); font-size: 12px; }
.role-delete-blocked span { color: var(--color-text-muted); font-size: 11px; line-height: 1.45; }
.role-delete-control { margin-top: 14px; border: 1px solid var(--color-danger-border); border-radius: var(--radius-control); background: var(--color-danger-soft); }
.role-delete-control > summary { padding: 9px 11px; color: var(--color-danger); font-size: 12px; font-weight: 750; cursor: pointer; }
.role-delete-control > form { border-top: 1px solid var(--color-danger-border); padding: 10px 11px; }
.role-delete-control p { margin: 0; color: var(--color-text); font-size: 12px; line-height: 1.45; }
.permission-group { min-width: 0; margin: 12px 0 0; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); }
.permission-group > legend { padding: 0 6px; color: var(--color-text-strong); font-size: 13px; font-weight: 750; }
.permission-group > p { margin: 0 0 10px; color: var(--color-text-muted); font-size: 12px; line-height: 1.45; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.permission-option { min-width: 0; display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: start; gap: 8px; padding: 9px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); cursor: pointer; }
.permission-option:hover { border-color: var(--color-primary-border); background: var(--color-surface-hover); }
.permission-option:has(input:checked) { border-color: var(--color-primary-border); background: var(--color-primary-soft); }
.permission-option input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--color-primary); }
.permission-option > span { min-width: 0; display: grid; gap: 3px; }
.permission-option strong { color: var(--color-text-strong); font-size: 12px; line-height: 1.35; }
.permission-option small { color: var(--color-text-muted); font-size: 11px; line-height: 1.4; }
.permission-option code { overflow-wrap: anywhere; color: var(--color-primary-strong); font-size: 10px; }
.role-matrix-readonly .permission-option { cursor: default; opacity: 0.78; }
.role-matrix-readonly .permission-option:hover { border-color: var(--color-border); background: var(--color-surface-subtle); }
.identity-workspace .role-matrix, .identity-workspace .role-creator > form { flex: none; }

.script-output { max-height: 55vh; overflow: auto; border: 1px solid var(--color-primary-border); border-radius: var(--radius-control); background: var(--color-code-bg); color: var(--color-code-text); padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.55 var(--font-mono); }
.business-logo-field { grid-column: 1 / -1; }
.business-logo-picker { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); padding: 12px; }
.business-logo-picker > div { min-width: 0; display: grid; gap: 7px; }
.business-logo-upload { display: flex; align-items: center; gap: 9px; min-width: 0; }
.business-logo-upload label { position: relative; flex: 0 0 auto; cursor: pointer; }
.business-logo-upload input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.business-logo-upload > span { min-width: 0; overflow: hidden; color: var(--color-text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-business-mark, .receipt-business-mark { display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; border: 1px solid var(--color-primary-border); background: var(--color-primary-soft); color: var(--color-primary-strong); font-weight: 800; }
.profile-business-mark { width: 72px; height: 72px; border-radius: var(--radius-panel); font-size: 20px; }
.profile-business-mark img, .receipt-business-mark img { width: 100%; height: 100%; object-fit: contain; background: var(--color-surface); }
.progress-track { height: 10px; overflow: hidden; margin-bottom: 10px; border-radius: 5px; background: var(--color-border); }
.progress-track i { display: block; height: 100%; background: var(--color-primary); }
.migration-live-progress { grid-column: 1 / -1; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); }
.migration-live-progress > div:last-child, .migration-status { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.migration-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.migration-summary div { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-subtle); }
.migration-summary span, .migration-totals span { color: var(--color-text-muted); font-size: 12px; }
.migration-summary strong { color: var(--color-text-strong); font-size: 18px; }
.migration-totals { display: grid; gap: 7px; margin-top: 12px; padding: 12px; border-top: 1px solid var(--color-border); }
.migration-totals span { display: flex; justify-content: space-between; gap: 12px; }
.migration-totals strong { color: var(--color-text); }
