:root {
  color-scheme: light;
  --ink: #181b19;
  --muted: #535d56;
  --line: #d9dfd8;
  --paper: #fff;
  --tint: #f3f6f1;
  --accent: #235741;
  --accent-hover: #184330;
  --danger: #9a3422;
  font: 15px/1.55 system-ui, "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #f5f6f2; }
header { border-bottom: 1px solid var(--line); background: var(--paper); }
.top, main { width: min(1100px, calc(100% - 48px)); margin-inline: auto; }
.top { min-height: 68px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 10px; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: inherit; font-weight: 760; letter-spacing: .04em; text-decoration: none; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: white; font-weight: 850; }
.product { padding-inline-start: 10px; border-inline-start: 1px solid var(--line); color: var(--muted); font-size: .86rem; letter-spacing: 0; }
.identity { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; overflow-wrap: anywhere; }
.identity > span { max-width: 24ch; }
main { padding: 44px 0 72px; }
.intro { margin-bottom: 28px; }
.kicker { color: var(--accent); margin: 0 0 10px; font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-block: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 4vw, 2.85rem); line-height: 1.18; margin-bottom: 8px; letter-spacing: -.035em; }
h2 { font-size: 1.14rem; }
h3 { font-size: 1.06rem; }
.muted, .fineprint { color: var(--muted); }
.panel { border: 1px solid var(--line); border-radius: 18px; padding: clamp(17px, 3.5vw, 28px); background: var(--paper); min-width: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.flow { display: grid; gap: 16px; min-width: 0; }
.gate { max-width: 530px; margin: clamp(12px, 8vh, 88px) auto; padding: clamp(22px, 5vw, 42px); }
.gate .primary { margin-top: 22px; }
.step { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.step span { display: grid; place-items: center; width: 30px; height: 30px; background: var(--tint); color: var(--accent); border-radius: 8px; font: 700 .8rem/1 ui-monospace, monospace; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; min-height: 42px; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; white-space: nowrap; }
button:disabled { cursor: not-allowed; opacity: .55; }
.primary { background: var(--accent); color: white; }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary, .plain { background: var(--paper); color: var(--ink); border-color: var(--line); }
.plain { border-color: transparent; padding-inline: 7px; }
.secondary:hover:not(:disabled), .plain:hover { background: var(--tint); }
:focus-visible { outline: 3px solid #477359; outline-offset: 3px; }
label, .label { font-weight: 650; font-size: .9rem; display: block; margin: 0 0 6px; }
input, select, textarea { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; color: var(--ink); background: var(--paper); border: 1px solid #aeb9ad; border-radius: 9px; }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: #f6f7f5; }
input::placeholder, textarea::placeholder { color: #5b655d; }
textarea { resize: vertical; margin-bottom: 14px; }
.lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.notice:not(:empty) { margin-top: 12px; font-weight: 600; }
.notice[data-tone="error"] { color: var(--danger); }
.notice[data-tone="ok"] { color: var(--accent); }
.target { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--tint); }
.target-line { display: flex; align-items: start; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.target-meta { margin: 4px 0 12px; font-size: .85rem; }
.badge, .chips li { display: inline-block; padding: 3px 8px; background: #e8efe7; color: #294c38; border-radius: 7px; font-size: .8rem; font-weight: 650; overflow-wrap: anywhere; }
.badge[data-tone="error"] { color: var(--danger); background: #f7eae5; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 5px; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
select { margin-bottom: 12px; }
.scopes { margin: 0 0 14px; padding: 8px 12px 8px 30px; border-radius: 8px; background: var(--tint); color: var(--muted); overflow-wrap: anywhere; font-size: .85rem; }
.boundaries dl { margin: 14px 0; }
.boundaries dt { font-weight: 680; }
.boundaries dd { margin: 2px 0 12px; color: var(--muted); }
.fineprint { border-top: 1px solid var(--line); padding-top: 12px; font-size: .85rem; }
.audit { margin-top: 18px; }
.audit-list { list-style: none; padding: 0; margin: 0; }
.audit-list li { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.audit-list p { margin-top: 4px; }
.audit-list small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.delegation-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
#delegation-review .scopes { margin-top: 10px; }
.operator-roles { margin-top: 14px; color: var(--muted); }
.operator-roles .chips { margin-top: 8px; }
.role-picker { list-style: none; padding: 0 6px; max-height: 270px; overflow-y: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 9px; }
.role-picker li { padding: 7px 4px; }
.role-picker li + li { border-top: 1px solid var(--line); }
.role-picker label { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.role-picker input[type="checkbox"] { display: inline-block; flex: 0 0 auto; width: 18px; min-height: 18px; accent-color: var(--accent); }
.role-picker small { display: block; color: var(--muted); overflow-wrap: anywhere; }
#delegation-inspect { margin-top: 8px; }
dialog { width: min(460px, calc(100% - 28px)); padding: 25px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: 0 18px 70px #18211930; }
dialog::backdrop { background: #121c16a8; }
dialog p:not(.kicker) { margin-top: 9px; }
.actions { display: flex; justify-content: end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .top, main { width: calc(100% - 32px); }
  main { padding-top: 28px; }
}
@media (max-width: 390px) {
  .lookup { grid-template-columns: 1fr; }
  .lookup button { justify-self: start; }
}
