:root {
  --collaboration-blue: #2563eb;
  --ink: #1f2937;
  --muted: #6b7280;
  --paper: #f5f7fb;
  --panel: #fff;
  --line: #e5e7eb;
  --accent: var(--collaboration-blue);
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --danger: #dc2626;
  --warning: #b45309;
  --success: #059669;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; margin: 0; overflow-x: hidden; }
body { color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code, pre { font-family: "Cascadia Code", Consolas, monospace; }
small { color: var(--muted); }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 3; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; color: var(--ink); border-right: 1px solid var(--line); background: #fff; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; color: #fff; border: 0; border-radius: 10px; background: linear-gradient(145deg, #2563eb, #0ea5e9); font-weight: 800; box-shadow: 0 6px 16px rgba(37,99,235,.2); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.main-nav { display: grid; gap: 4px; }
.nav-caption { margin: 14px 10px 5px; color: #9ca3af; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; color: #4b5563; text-align: left; border: 0; border-radius: 8px; background: transparent; transition: background .16s ease, color .16s ease; }
.nav-item span { display: grid; width: 24px; height: 24px; place-items: center; color: #64748b; border-radius: 7px; background: #f3f4f6; font-size: 11px; }
.nav-item:hover { color: var(--accent); background: #f8fafc; }
.nav-item.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 750; }
.nav-item.active span { color: #fff; background: var(--accent); }
.connection-card { margin-top: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.connection-card summary { display: grid; gap: 3px; padding: 11px 12px; cursor: pointer; list-style: none; }
.connection-card summary::-webkit-details-marker { display: none; }
.connection-card summary span { font-size: 12px; font-weight: 750; }
.connection-card summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-body { padding: 0 11px 11px; border-top: 1px solid var(--line); }
.connection-card label { display: block; margin: 9px 0 6px; color: var(--muted); font-size: 11px; }
.connection-card input { width: 100%; margin-bottom: 8px; padding: 7px 8px; }
.connection-card .button { width: 100%; }

.main-content { min-width: 0; padding: 20px clamp(20px, 2.5vw, 36px) 44px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: -20px calc(clamp(20px, 2.5vw, 36px) * -1) 18px; padding: 14px clamp(20px, 2.5vw, 36px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.topbar h1 { margin: 3px 0 2px; font-size: clamp(23px, 2.2vw, 30px); }
.page-heading > p { margin: 0; }
.breadcrumb { color: var(--accent); font-size: 11px; font-weight: 750; }
#page-description { color: var(--muted); font-size: 12px; }
.section-kicker { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.topbar-note { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 7px; padding: 8px 11px; color: #374151; border: 1px solid #dbeafe; border-radius: 9px; background: var(--accent-soft); font-size: 12px; }
.topbar-note span { grid-row: span 2; color: var(--success); }
.topbar-note small { font-size: 10px; }
.view { display: none; min-width: 0; }
.view.active { display: block; }
.workspace-grid { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.detail-panel { min-height: 560px; }
.workspace-sidebar { position: sticky; top: 98px; }
.panel-heading h2 { margin: 0; font-size: 17px; }
.panel-heading p { margin: 4px 0 14px; color: var(--muted); font-size: 11px; }
.section-heading, .card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading h2, .card-heading h2, .card-heading h3 { margin: 0 0 5px; }
.card-heading code, td code { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.item-list { display: grid; gap: 6px; margin-top: 12px; max-height: calc(100vh - 260px); overflow: auto; }
.list-button { display: grid; gap: 3px; width: 100%; padding: 10px 11px; color: var(--ink); text-align: left; border: 1px solid transparent; border-radius: 8px; background: #f8fafc; }
.list-button:hover, .list-button.selected { color: var(--accent-strong); border-color: #bfdbfe; background: var(--accent-soft); }
.list-empty { display: grid; gap: 4px; padding: 24px 12px; color: var(--muted); text-align: center; }

label { color: #36433f; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; padding: 9px 10px; color: var(--ink); border: 1px solid #cdd2cd; border-radius: 8px; background: #fff; }
textarea { resize: vertical; }
.search-field { display: grid; gap: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compact-form { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border-radius: 10px; background: #f6f6f1; }
.compact-form label, .role-editor > label { display: grid; gap: 6px; }
.button { padding: 9px 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 750; }
.button.primary { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgba(37,99,235,.14); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { color: var(--ink); border-color: #c9d2cd; background: #fff; }
.button.danger { color: #fff; background: var(--danger); }
.button.small { padding: 6px 9px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef0eb; font-size: 22px; }
.status-pill, .chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; }
.chip small { color: inherit; opacity: .72; }
.role-strip { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 12px 0; }

.person-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.person-summary h2, .person-summary p { margin: 3px 0; }
.role-summary { padding: 14px 0; }
.role-summary h3 { margin: 0; font-size: 14px; }
.superadmin-banner, .safety-note, .inline-warning, .warning-copy { padding: 10px 12px; border-radius: 8px; background: #fff1d7; color: #714b12; font-size: 13px; }
.application-stack, .permission-stack { display: grid; gap: 13px; }
.application-card { padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.application-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; cursor: pointer; list-style: none; }
.application-summary::-webkit-details-marker { display: none; }
.application-summary:hover { background: #f8fafc; }
.application-summary h3, .application-summary p { margin: 0 0 5px; }
.application-summary code { color: var(--muted); font-size: 12px; }
.application-summary p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.application-summary::after { content: "展开权限"; flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 750; }
.application-card[open] > .application-summary::after { content: "收起权限"; }
.application-card[open] > .application-summary { border-bottom: 1px solid var(--line); }
.application-card-body { padding: 14px; background: #fbfdff; }
.direct-role-editor { margin-top: 12px; padding: 14px; }
.direct-role-editor legend { padding: 0 6px; font-weight: 800; }
.field-help, .form-hint { display: block; margin: 2px 0 10px; color: var(--muted); font-size: 12px; font-weight: 400; }
.direct-role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.direct-role-option { display: grid; align-content: start; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.direct-role-option.selected { border-color: #93c5fd; background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(37,99,235,.06); }
.direct-role-choice { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.direct-role-choice input { width: auto; margin-top: 3px; }
.direct-role-choice strong, .direct-role-choice small { display: block; }
.role-permission-summary { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.role-scope-control { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.role-scope-control select { padding: 7px 8px; }
.subsection-heading { margin: 16px 0 10px; }
.subsection-heading h4 { margin: 0; font-size: 14px; }
.subsection-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.permission-row { padding: 12px; border: 1px solid transparent; border-radius: 9px; background: #fff; }
.permission-row.role-preview { border-color: #bfdbfe; outline: 0; background: var(--accent-soft); }
.permission-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.permission-check { display: flex; align-items: center; gap: 10px; }
.permission-check input, .check-option input, .template-permission input[type="checkbox"], .scope-picker input { width: auto; }
.permission-check strong, .permission-check small { display: block; }
.scope-summary, .source-summary { margin: 6px 0; color: var(--muted); font-size: 12px; }
.scope-picker { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
.department-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.card-actions, .action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sticky-card-actions { position: sticky; bottom: 0; align-items: center; justify-content: flex-end; margin: 14px -14px -14px; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.sticky-card-actions span { margin-right: auto; color: var(--muted); font-size: 11px; }

.role-editor { display: grid; gap: 14px; }
.role-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 250px); gap: 16px; align-items: start; }
.role-editor-main { display: grid; min-width: 0; gap: 14px; }
.role-editor-main > label { display: grid; gap: 6px; }
.role-editor-inspector { position: sticky; top: 98px; display: grid; gap: 10px; }
.role-editor-inspector section { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.role-editor-inspector strong { font-size: 18px; }
.role-editor-inspector p { margin: 0; color: #4b5563; font-size: 12px; line-height: 1.6; }
.summary-label { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.role-application-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid #dbeafe; border-radius: 10px; background: var(--accent-soft); }
.role-application-toolbar label { display: grid; flex: 1 1 420px; gap: 6px; max-width: 620px; }
.role-application-toolbar input { background: #fff; }
.role-application-toolbar > small { padding-bottom: 10px; white-space: nowrap; }
.template-applications { display: grid; gap: 12px; }
.role-application-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.role-application-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; cursor: pointer; list-style: none; }
.role-application-card > summary::-webkit-details-marker { display: none; }
.role-application-card > summary:hover { background: #f8fafc; }
.role-application-card > summary::after { content: "展开配置"; flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 750; }
.role-application-card[open] > summary { border-bottom: 1px solid var(--line); background: #f8fbff; }
.role-application-card[open] > summary::after { content: "收起配置"; }
.role-application-identity { display: grid; gap: 4px; min-width: 0; }
.role-application-identity strong { font-size: 15px; }
.role-application-identity code { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.role-application-counts { display: flex; flex: 1 1 auto; justify-content: flex-end; gap: 7px; }
.role-application-counts span { padding: 4px 8px; color: var(--muted); border-radius: 999px; background: #f3f4f6; font-size: 11px; white-space: nowrap; }
.role-application-counts .selected-count { color: var(--accent-strong); background: #dbeafe; font-weight: 750; }
.role-application-body { padding: 14px; background: #fbfdff; }
.role-application-body h5 { margin: 12px 0 7px; color: #374151; }
.role-application-body h5:first-child { margin-top: 0; }
.template-permission { display: grid; grid-template-columns: minmax(160px, 1fr) 150px minmax(180px, 1fr); gap: 8px; align-items: center; margin: 8px 0; }
.template-permission label { display: flex; gap: 8px; align-items: center; }
.template-permission small { display: block; }
.template-permission label > span { min-width: 0; }
.template-permission .assignment-description { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 400; line-height: 1.45; }
fieldset { min-width: 0; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.check-option { display: inline-flex; gap: 7px; align-items: center; margin: 5px 12px 5px 0; }

.batch-wizard { max-width: 1320px; margin: 0 auto; padding: 0; overflow: hidden; }
.batch-wizard > header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.batch-wizard > header h2, .batch-wizard > header p { margin: 0; }
.batch-wizard > header p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.batch-stepper { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); min-width: min(100%, 430px); margin: 0; padding: 0; list-style: none; }
.batch-stepper li { position: relative; display: grid; justify-items: center; gap: 5px; color: #9ca3af; font-size: 11px; }
.batch-stepper li::before { position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; content: ""; background: #e5e7eb; }
.batch-stepper li:first-child::before { display: none; }
.batch-stepper li.complete::before, .batch-stepper li.current::before { background: #93c5fd; }
.batch-stepper li span { position: relative; z-index: 1; display: grid; width: 27px; height: 27px; place-items: center; border: 2px solid #d1d5db; border-radius: 50%; background: #fff; font-weight: 800; }
.batch-stepper li.complete span { color: #fff; border-color: var(--success); background: var(--success); }
.batch-stepper li.current { color: var(--accent-strong); }
.batch-stepper li.current span { color: #fff; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px #dbeafe; }
.batch-step-panel { min-height: 480px; padding: 20px; }
.batch-step-panel .section-heading > div > h2, .batch-step-panel .section-heading > div > p { margin: 4px 0; }
.batch-step-panel .section-heading > div > p:last-child { color: var(--muted); font-size: 12px; }
.batch-target-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.batch-target-grid fieldset { padding: 14px; }
.batch-choice-list { display: grid; gap: 8px; max-height: 390px; overflow: auto; }
.selection-card { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.selection-card:hover, .selection-card.selected, .selection-card:has(input:checked) { border-color: #93c5fd; background: var(--accent-soft); }
.selection-card.disabled { cursor: not-allowed; opacity: .58; }
.selection-card input { width: auto; margin-top: 3px; }
.selection-card strong, .selection-card small, .selection-card em { display: block; }
.selection-card em { margin-top: 5px; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 400; }
.segmented-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #eef2f7; }
.segmented-control button { padding: 7px 15px; color: var(--muted); border: 0; border-radius: 7px; background: transparent; font-weight: 750; }
.segmented-control button.active { color: var(--accent-strong); background: #fff; box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.batch-grant-section { margin-top: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.batch-role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 9px; }
.batch-application-stack { display: grid; gap: 10px; }
.batch-application-card { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.batch-application-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.batch-application-card > summary::-webkit-details-marker { display: none; }
.batch-application-card > summary span:first-child { display: grid; gap: 3px; }
.batch-application-card > summary span:last-child { color: var(--accent); font-size: 11px; font-weight: 750; }
.batch-application-card[open] > summary { border-bottom: 1px solid var(--line); background: var(--accent-soft); }
.batch-permission-list { display: grid; gap: 8px; padding: 12px; }
.batch-permission-option { display: grid; gap: 9px; padding: 11px; border: 1px solid transparent; border-radius: 8px; background: #f8fafc; }
.batch-permission-option.selected { border-color: #bfdbfe; background: #fff; }
.batch-permission-option > label { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.batch-permission-option input { width: auto; }
.batch-permission-option strong, .batch-permission-option small { display: block; }
.permission-scope-note { margin-left: 25px; }
.batch-scope-editor { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 12px; margin-left: 25px; padding-top: 9px; border-top: 1px solid var(--line); }
.batch-scope-editor label { display: grid; gap: 5px; }
.batch-selection-summary { margin: 14px 0 0; color: var(--muted); text-align: right; font-size: 12px; }
.batch-review-grid { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(340px, 1.2fr); gap: 16px; margin: 18px 0; }
.batch-review-grid > section, .batch-review-grid > label { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.batch-review-grid h3 { margin: 0 0 10px; }
.batch-review-grid dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.batch-review-grid dl div { padding: 9px; border-radius: 7px; background: #fff; }
.batch-review-grid dt { color: var(--muted); font-size: 11px; }
.batch-review-grid dd { margin: 3px 0 0; font-weight: 800; }
.batch-review-grid > label { display: grid; gap: 8px; }
.batch-review-grid textarea { min-height: 118px; }
.batch-wizard-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #f8fafc; }
.batch-wizard form > .inline-warning:empty { display: none; }
.batch-wizard form > .inline-warning { margin: 0 20px 14px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filter-bar label { display: grid; gap: 5px; min-width: 130px; }
.catalog-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 16px 0; }
.catalog-summary > div { display: grid; gap: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.catalog-summary span { color: var(--muted); font-size: 11px; }
.catalog-summary strong { font-size: 19px; }
.catalog-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 690px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-size: 12px; }
.data-table td small { display: block; margin-top: 5px; }
.data-table td .technical-code { color: #64748b; font-family: "Cascadia Code", Consolas, monospace; font-size: 10px; }
.action-cell { white-space: nowrap; }
.action-cell .button { margin: 0 5px 5px 0; }
.action-menu { position: relative; display: inline-block; }
.action-menu > summary { padding: 6px 10px; color: var(--accent-strong); border: 1px solid #bfdbfe; border-radius: 7px; background: #fff; cursor: pointer; list-style: none; font-size: 12px; font-weight: 750; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu > div { position: absolute; z-index: 4; right: 0; display: grid; width: min(320px, 70vw); gap: 7px; margin-top: 5px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 12px 30px rgb(15 23 42 / 14%); }
.action-menu > div .button { width: 100%; margin: 0; white-space: normal; text-align: left; }
.impact-preview ul { padding-left: 20px; }
.impact-preview code { white-space: pre-wrap; }

.audit-filter-bar { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.audit-filter-bar label:first-child { flex: 1 1 300px; }
.audit-filter-bar label:last-child { flex: 0 1 240px; }
.audit-explorer { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 14px; align-items: start; }
.audit-explorer > [data-audit-detail] { position: sticky; top: 98px; min-width: 0; }
.audit-detail-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.audit-detail-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: #fff; }
.audit-detail-card h3, .audit-detail-card header p { margin: 4px 0 0; }
.audit-detail-card header p { color: var(--muted); font-size: 12px; }
.audit-summary-list { display: grid; gap: 8px; margin: 0; padding: 14px; }
.audit-summary-list > div { padding: 9px; border-radius: 7px; background: #fff; }
.audit-summary-list dt { color: var(--muted); font-size: 11px; }
.audit-summary-list dd { margin: 4px 0 0; font-size: 13px; font-weight: 700; }
.audit-detail-card .audit-facts { grid-template-columns: 1fr; padding: 0 14px; }
.audit-detail-card .audit-facts section { min-width: 0; }
.audit-detail-card .technical-disclosure { margin: 14px; }
.audit-detail-card .technical-disclosure pre { max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

.integration-section, .sdk-panel { margin-top: 15px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.integration-section h3, .sdk-panel h3 { margin: 0 0 7px; }
.integration-heading { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.integration-heading .section-kicker { margin-bottom: 4px; }
.onboarding-overview { padding: 0; overflow: hidden; }
.onboarding-overview > .section-heading { padding: 16px 16px 0; }
.onboarding-overview .section-heading h3, .onboarding-overview .section-heading h4 { margin: 0; }
.onboarding-overview .section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.onboarding-stepper { display: grid; grid-template-columns: repeat(7, minmax(92px, 1fr)); gap: 0; margin: 16px; padding: 0; overflow-x: auto; list-style: none; }
.onboarding-stage { position: relative; display: grid; justify-items: center; gap: 7px; min-width: 92px; padding: 0 6px; color: #9ca3af; text-align: center; }
.onboarding-stage::before { position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; content: ""; background: #e5e7eb; }
.onboarding-stage:first-child::before { display: none; }
.onboarding-stage.complete::before, .onboarding-stage.current::before { background: #93c5fd; }
.stage-index { position: relative; z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #d1d5db; border-radius: 50%; background: #fff; font-size: 11px; font-weight: 800; }
.onboarding-stage.complete .stage-index { color: #fff; border-color: var(--success); background: var(--success); }
.onboarding-stage.current .stage-index { color: #fff; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px #dbeafe; }
.onboarding-stage.current strong { color: var(--accent-strong); }
.onboarding-stage strong, .onboarding-stage small { display: block; }
.onboarding-stage strong { color: #4b5563; font-size: 11px; }
.onboarding-stage small { margin-top: 3px; font-size: 9px; line-height: 1.35; }
.next-action-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 16px 16px; padding: 13px 14px; border: 1px solid #bfdbfe; border-radius: 9px; background: var(--accent-soft); }
.next-action-card > div:first-child { display: grid; gap: 3px; }
.next-action-card span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.next-action-card strong { font-size: 13px; }
.next-action-card small { font-size: 11px; }
.next-action-card .action-row { margin: 0; }
.next-action-card.complete { border-color: #a7f3d0; background: #ecfdf5; }
.readiness-block { padding: 14px 16px 16px; border-top: 1px solid var(--line); background: #f8fafc; }
.application-cleanup-controls { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.application-cleanup-impact table { margin: 12px 0; }
.manifest-file-picker { position: relative; align-items: start; }
.manifest-file-picker input[type="file"] { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.manifest-file-picker:focus-within .manifest-file-button { outline: 2px solid var(--accent); outline-offset: 2px; }
.manifest-file-button { display: inline-flex; width: fit-content; }
.manifest-source-switch { display: inline-flex; width: fit-content; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #eef2f7; }
.manifest-source-button { padding: 7px 13px; color: var(--muted); border: 0; border-radius: 7px; background: transparent; cursor: pointer; font-weight: 700; }
.manifest-source-button.active { color: var(--accent-strong); background: #fff; box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.manifest-source-panel { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.manifest-source-panel[hidden] { display: none; }
.manifest-source-panel textarea { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.55; }
.manifest-source-panel > .button { width: fit-content; }
.manifest-import-summary { display: block; min-height: 58px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.manifest-import-summary dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 0; }
.manifest-import-summary dt { color: var(--muted); font-size: 11px; }
.manifest-import-summary dd { margin: 3px 0 0; font-weight: 750; }
.readiness-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 7px; padding: 0; list-style: none; }
.readiness-list li { display: flex; align-items: flex-start; gap: 7px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.readiness-list strong, .readiness-list code { display: block; }
.readiness-list strong { color: var(--ink); font-size: 11px; }
.readiness-list code { margin-top: 2px; color: var(--muted); font-size: 9px; }
.readiness-passed { color: var(--accent); }
.readiness-failed { color: var(--danger); }
.technical-disclosure { margin-top: 12px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.technical-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; cursor: pointer; list-style: none; }
.technical-disclosure > summary::-webkit-details-marker { display: none; }
.technical-disclosure > summary:hover { background: #f8fafc; }
.technical-disclosure > summary strong, .technical-disclosure > summary small { display: block; }
.technical-disclosure > summary small { margin-top: 3px; font-weight: 400; }
.technical-disclosure[open] > summary { border-bottom: 1px solid var(--line); background: #f8fafc; }
.disclosure-hint { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-weight: 700; }
.technical-disclosure[open] .disclosure-hint { font-size: 0; }
.technical-disclosure[open] .disclosure-hint::after { content: "收起"; font-size: 11px; }
.disclosure-body { padding: 14px; }
.disclosure-body > .sdk-panel { margin: 0; padding: 0; border: 0; }
.danger-zone > summary { color: #7f1d1d; background: #fffafa; }
.register-application { margin: 8px 0 12px; border: 1px dashed #93c5fd; border-radius: 8px; background: #f8fbff; }
.register-application > summary { padding: 10px; color: var(--accent-strong); cursor: pointer; font-size: 12px; font-weight: 750; list-style: none; }
.register-application .compact-form { margin: 0; border-top: 1px solid #dbeafe; border-radius: 0 0 8px 8px; }
.integration-search { margin: 12px 0 4px; }
.registry-note { margin: 8px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.sdk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sdk-card { min-width: 0; padding: 12px; border-radius: 10px; background: #f6f6f1; }
.sdk-card h4, .sdk-card p { margin: 0 0 7px; }
.sdk-card pre, .credential-value, .audit-facts pre { max-width: 100%; padding: 9px; overflow: auto; border-radius: 7px; background: #1c2b26; color: #e8f2ed; white-space: pre-wrap; word-break: break-word; }
.credential-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.audit-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.directory-console { display: grid; gap: 16px; }
.directory-overview { display: grid; gap: 14px; }
.directory-overview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.directory-overview-heading h2, .directory-overview-heading p, .directory-history h3, .directory-history p { margin: 3px 0; }
.directory-overview-heading p, .directory-history p, .directory-muted { color: var(--muted); font-size: 12px; }
.directory-partial-warning { margin: 0; border: 1px solid #f6d79c; }
.directory-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.directory-metrics > div, .directory-run-grid > section { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.directory-metrics span, .directory-metrics small, .directory-run-grid h3 { color: var(--muted); font-size: 11px; }
.directory-metrics strong { font-size: 14px; }
.directory-run-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.directory-run-grid h3 { margin: 0; font-weight: 750; }
.directory-run-grid section > strong { color: var(--ink); font-size: 13px; }
.directory-run-grid section > span, .directory-run-grid section > small, .directory-connection-success small { display: block; color: var(--muted); font-size: 11px; }
.directory-run-grid code { width: fit-content; color: #9a3412; font-size: 11px; }
.directory-connection-success { margin: 0; padding: 10px 12px; color: #065f46; border: 1px solid #a7f3d0; border-radius: 8px; background: #ecfdf5; font-size: 13px; }
.directory-history { padding-top: 15px; border-top: 1px solid var(--line); }
.directory-sync-confirmation p { margin: 0 0 10px; line-height: 1.65; }

.app-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 0; border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.app-dialog::backdrop { background: rgba(15, 26, 22, .58); backdrop-filter: blur(2px); }
.dialog-frame header, .dialog-frame footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.dialog-frame header { border-bottom: 1px solid var(--line); }
.dialog-frame footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-frame h2 { margin: 0; }
.dialog-body { padding: 18px; }
.dialog-feedback { min-height: 20px; margin: 0; padding: 0 18px 8px; color: var(--danger); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(440px, calc(100vw - 48px)); padding: 12px 16px; color: #fff; border-radius: 10px; background: #1f2937; opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.empty-state, .loading-state { padding: 28px; color: var(--muted); text-align: center; }
.error-panel { color: var(--danger); }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 196px minmax(0, 1fr); }
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-sidebar { position: static; }
  .item-list { max-height: 320px; }
  .template-permission { grid-template-columns: 1fr; }
  .role-editor-layout { grid-template-columns: 1fr; }
  .role-editor-inspector { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-row: 1; }
  .onboarding-stepper { grid-template-columns: repeat(7, 106px); }
  .batch-wizard > header { align-items: flex-start; flex-direction: column; }
  .batch-stepper { width: 100%; }
  .audit-explorer { grid-template-columns: 1fr; }
  .audit-explorer > [data-audit-detail] { position: static; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
  .main-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connection-card { margin-top: 0; }
  .main-content { padding: 14px 12px 40px; }
  .topbar { margin: -14px -12px 14px; padding: 12px; }
  .topbar, .person-summary, .section-heading, .card-heading { align-items: flex-start; flex-direction: column; }
  .form-grid, .sdk-grid, .audit-facts { grid-template-columns: 1fr; }
  .role-editor-inspector { grid-template-columns: 1fr; }
  .role-application-toolbar, .role-application-card > summary { align-items: flex-start; flex-direction: column; }
  .role-application-toolbar > small { padding-bottom: 0; }
  .role-application-counts { justify-content: flex-start; flex-wrap: wrap; }
  .next-action-card { align-items: flex-start; flex-direction: column; }
  .next-action-card .action-row, .next-action-card .button { width: 100%; }
  .batch-target-grid, .batch-review-grid, .batch-scope-editor { grid-template-columns: 1fr; }
  .catalog-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .directory-metrics, .directory-run-grid { grid-template-columns: 1fr; }
  .batch-stepper strong { display: none; }
  .batch-step-panel { padding: 14px; }
}
