:root {
  --ink: #182c31;
  --muted: #546970;
  --teal: #006857;
  --line: #d8e2df;
  --paper: #fff;
  --canvas: #f4f7f6;
  --bad: #a1352b;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
  scrollbar-gutter: stable;
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p, dl, dd, ol, pre, form, fieldset { margin: 0; }
h1, h2, h3 { font-weight: 650; line-height: 1.4; }
a, summary, button { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #009f88; outline-offset: 3px; }
.mono, .technical, pre { font-family: var(--mono); }
.masthead { background: #103e38; color: white; border-bottom: 3px solid #278a73; }
.masthead-inner { min-height: 67px; padding: 0 clamp(18px, 3vw, 48px); margin: auto; max-width: 1700px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.identity { display: flex; gap: 12px; align-items: center; }
.identity strong { font-size: 18px; letter-spacing: .04em; }
.brand-mark { display: flex; align-items: end; gap: 3px; height: 28px; padding: 2px 4px; border-bottom: 2px solid #acdfce; }
.brand-mark i { width: 4px; height: 45%; background: #a3dec9; transform: skew(-12deg); }
.brand-mark i:nth-child(2) { height: 80%; }
.brand-mark i:nth-child(3) { height: 60%; }
.connection-state { display: flex; align-items: center; gap: 8px; color: #d4e8e1; font-size: 12px; white-space: nowrap; }
.connection-state::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #e0bd75; }
.connection-state.is-connected::before { background: #79dbab; }
.connection-state.is-error::before { background: #ffc3aa; }
.workbench { display: grid; grid-template-columns: 190px minmax(0, 1fr); max-width: 1700px; min-height: calc(100vh - 70px); margin: auto; }
.sidebar { min-width: 0; background: #ecf2ef; border-right: 1px solid var(--line); padding: 36px 14px 24px; }
#navigation { display: grid; gap: 5px; }
#navigation a { display: block; padding: 11px 19px; color: #3c514c; text-decoration: none; font-weight: 530; border: 1px solid transparent; border-radius: 6px; }
#navigation a:hover { background: #e0eae5; }
#navigation a[aria-current] { color: #0a594b; background: #d6e8df; border-color: #c2dace; font-weight: 650; }
summary { cursor: pointer; }
main { width: 100%; max-width: 1400px; min-width: 0; padding: 33px clamp(20px, 3.1vw, 52px) 60px; }
.workspace-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
h1 { font-size: clamp(23px, 2.1vw, 31px); letter-spacing: -.025em; }
.sync { display: flex; align-items: center; flex-wrap: wrap; gap: 13px; color: var(--muted); font-size: 12px; }
.columns { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); align-items: start; }
.full { grid-column: 1/-1; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; min-width: 0; box-shadow: 0 1px 2px rgba(20,50,41,.035); }
.card-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 57px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.card-header h2 { font-size: 16px; letter-spacing: .015em; }
.card-body { min-width: 0; padding: 21px 22px 23px; }
h3 { font-size: 13px; }
.counter, .hint, .byte-count { color: var(--muted); font-size: 12px; }
.counter { font-variant-numeric: tabular-nums; }
.hint { margin-top: 8px; overflow-wrap: anywhere; }
.hint:empty { display: none; }
.more { display: inline-block; font-size: 13px; font-weight: 560; line-height: 1.55; text-decoration: none; }
.more:hover { text-decoration: underline; }
label:not(.check-label), legend { display: block; font-size: 13px; font-weight: 600; margin: 0 0 7px; }
label > span:not(.attribute-name), legend > span { font-size: 12px; color: var(--muted); font-weight: normal; }
label:not(.check-label) > span, legend > span { margin-left: 7px; }
input[type="text"], select, textarea {
  min-width: 0; width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #a9bbb4;
  border-radius: 5px; background: white; color: var(--ink); line-height: 1.5; font-size: 14px;
}
textarea { display: block; resize: vertical; min-height: 108px; }
select { text-overflow: ellipsis; }
input::placeholder, textarea::placeholder { color: #75857e; }
input:disabled, textarea:disabled, select:disabled { background: #f4f6f5; color: #65746d; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
input + label:not(.check-label), select + label:not(.check-label), .form-pair + label, .byte-count + label { margin-top: 17px; }
button { border: 1px solid transparent; border-radius: 5px; padding: 8px 16px; min-height: 40px; line-height: 1.5; cursor: pointer; background: var(--teal); color: #fff; font-weight: 580; }
button:hover:not(:disabled) { background: #005547; }
button.secondary { background: white; border-color: #a9bcb2; color: #174d40; }
button.secondary:hover:not(:disabled) { background: #f0f6f2; }
button.danger { color: var(--bad); background: white; border-color: #dab4af; }
button.danger:hover:not(:disabled) { background: #fff5f0; }
button:disabled { color: #64766c; border-color: #dbe3dd; background: #edf2ee; cursor: not-allowed; }
button[aria-busy="true"] { background: #d6e8dd; color: #335a49; }
button[aria-busy="true"]::after { content: "…"; }
button.small { padding: 5px 12px; min-height: 32px; font-size: 12px; }
form.card-body > button { margin-top: 17px; }
.action-bar { margin-top: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 13px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 15px; margin: 16px 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.split, .form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 24px; }
.grant-details { border-left: 1px solid var(--line); padding-left: 24px; }
.grant-list { margin-top: 10px; white-space: pre-line; overflow-wrap: anywhere; font-size: 13px; color: var(--muted); }
#permissions-fieldset { margin-top: 0; }
#partition-options { display: flex; flex-direction: column; gap: 9px; }
.subsection { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 18px; }
.subsection .check-label { margin: 12px 0; }
fieldset { border: 0; padding: 0; margin-top: 17px; min-width: 0; }
legend { padding: 0; }
.check-label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.check-label input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--teal); }
.attribute-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.attribute-name small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.byte-count { text-align: right; margin-top: 3px; }
.byte-count.is-error { color: var(--bad); }
.global-message, .operation-result { padding: 10px 13px; border-radius: 4px; background: #edf6f1; border-left: 3px solid #4f9579; font-size: 13px; overflow-wrap: anywhere; }
.global-message { margin-bottom: 16px; }
.operation-result { margin-top: 15px; }
.global-message.is-error, .operation-result.is-error { background: #fff1ec; border-color: #ac5044; }
.result-heading { font-weight: 650; }
.result-message { margin-top: 3px; }
.result-details { margin-top: 7px; font-size: 12px; color: var(--muted); }
.result-detail-code, .plaintext { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow-y: auto; }
.result-detail-code { margin-top: 6px; font-size: 12px; }
.plaintext { margin-top: 11px; font: inherit; user-select: text; }
/* The receipt and audit entry open the same viewport-bound inspection panel. */
button.interaction-trace { min-height: 28px; padding: 2px 0; margin-top: 4px; color: var(--teal); background: transparent; font-size: 13px; }
button.interaction-trace:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.trace-receipt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px; }
.trace-receipt-head .interaction-trace { margin-top: 0; }
html:has(.trace-drawer[open]), body:has(.trace-drawer[open]) { overflow: hidden; }
.trace-drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; width: min(880px, 94vw); max-width: 100%;
  height: 100%; height: 100dvh; max-height: none; padding: 0; overflow: hidden;
  border: 0; border-left: 1px solid var(--line); color: var(--ink); background: var(--paper);
  box-shadow: -10px 0 42px rgb(16 49 43 / .15);
}
.trace-drawer[open] { display: flex; flex-direction: column; }
.trace-drawer::backdrop { background: rgb(18 42 38 / .30); }
.trace-drawer-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 19px 24px; border-bottom: 1px solid var(--line); }
.trace-drawer-head h2 { font-size: 20px; }
.trace-drawer-head button { flex: none; }
.trace-content { flex: 1; min-height: 0; padding: 16px 24px 28px; overflow: auto; overscroll-behavior: contain; }
.trace-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; }
.trace-meta time, .trace-id { color: var(--muted); font-size: 12px; }
.trace-id { overflow-wrap: anywhere; font-family: var(--mono); }
.trace-download { margin-left: auto; }
.trace-verify { margin: 7px 0 14px; font-size: 12px; }
.trace-verify > summary { width: fit-content; color: var(--teal); font-weight: 600; }
.trace-verify > a { display: inline-block; margin-top: 6px; }
.trace-command { display: block; overflow-wrap: anywhere; padding: 6px 0; font-family: var(--mono); }
.trace-workspace { display: grid; grid-template-columns: minmax(185px, .9fr) minmax(0, 1.8fr); align-items: start; gap: 18px; margin-top: 14px; }
.trace-nav, .trace-current-step { min-width: 0; }
.trace-steps { list-style: none; padding: 3px; margin: -3px; }
.trace-steps li + li { margin-top: 3px; }
button.trace-step {
  width: 100%; min-height: 40px; display: grid; grid-template-columns: 20px minmax(0,1fr) auto;
  align-items: baseline; gap: 7px; padding: 8px; background: transparent; color: var(--ink); text-align: left;
}
.trace-step strong { overflow-wrap: anywhere; font-size: 13px; font-weight: 550; }
.trace-step:hover:not(:disabled) { background: var(--canvas); }
.trace-step[aria-current="step"], .trace-step[aria-current="step"]:hover { background: #e7f2ed; border-color: #b9d7c8; }
.trace-step.trace-failed[aria-current="step"] { background: #fff2ec; border-color: #d6ada3; }
.trace-number { font: 12px var(--mono); color: var(--muted); }
.trace-step .trace-number { text-align: center; }
.trace-status { margin-left: auto; color: var(--teal); white-space: nowrap; font-size: 12px; }
.trace-failed .trace-status, .trace-reason { color: var(--bad); font-weight: 600; }
.trace-current-step { padding: 16px 18px; border: 1px solid var(--line); border-radius: 7px; overflow-wrap: anywhere; }
.trace-step-header { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.trace-step-header strong, .trace-step-header h3 { font-size: 15px; }
.trace-route { margin: 4px 0 10px; color: var(--muted); font-size: 12px; }
.trace-calculation, .trace-reason { font-size: 13px; }
.trace-reason { margin-top: 9px; padding: 7px 10px; border-left: 3px solid #b66457; background: #fff3ee; }
.trace-fields { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.trace-fields-label { margin-bottom: 5px; font-size: 12px; font-weight: 600; }
.trace-fields dl { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); gap: 5px 12px; font-size: 12px; }
.trace-fields dt { overflow-wrap: anywhere; color: var(--muted); }
.trace-fields dd { min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); }
.trace-wide-field { grid-column: 1/-1; }
.trace-matrix { border-collapse: collapse; table-layout: fixed; width: 100%; }
.trace-matrix th, .trace-matrix td { border: 1px solid var(--line); text-align: left; padding: 4px 6px; font-size: 12px; }
.trace-matrix th { background: var(--canvas); font-weight: 600; }
.trace-value summary { color: var(--teal); width: fit-content; font-family: system-ui, sans-serif; }
.trace-value pre { max-height: 14rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; padding: 6px 0; }
.trace-conclusion { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; font-size: 13px; overflow-wrap: anywhere; }
.trace-conclusion strong, .trace-conclusion code { margin-right: 7px; }
@media (max-width: 640px) {
  .trace-drawer { width: 100%; border-left: 0; }
  .trace-drawer-head { padding: 12px 14px; }
  .trace-drawer-head h2 { font-size: 17px; }
  .trace-content { padding: 12px 14px max(18px, env(safe-area-inset-bottom)); }
  .trace-meta { gap: 4px 9px; }
  .trace-id { order: 1; flex-basis: 100%; }
  .trace-workspace { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .trace-steps { display: flex; align-items: stretch; gap: 5px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 4px 7px; margin: -4px -4px 0; }
  .trace-steps li { flex: 0 0 auto; max-width: 75%; }
  .trace-steps li + li { margin-top: 0; }
  button.trace-step { position: relative; height: 100%; min-height: 36px; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px; padding: 6px 8px; border-color: var(--line); }
  .trace-step:not(.trace-failed) .trace-status { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .trace-current-step { padding: 12px; }
}
.events-list { list-style: none; padding: 0; }
.events-list > li + li { border-top: 1px solid var(--line); }
.events-list > li > details { padding: 12px 22px; }
.events-list > li > details > summary { display: grid; grid-template-columns: 46px 1fr minmax(125px,.66fr) 45px; align-items: baseline; gap: 10px; }
.events-list > li > details > summary::-webkit-details-marker { display: none; }
.events-list > li > details > summary:hover strong { color: var(--teal); text-decoration: underline; }
.events-list > li > details > summary strong { font-weight: 560; font-size: 13px; }
.event-id, .events-list > li > details > summary time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.outcome { font-size: 12px; text-align: right; color: var(--teal); }
.outcome.denied { color: var(--bad); }
.policy-tools { margin-top: 9px; font-size: 12px; color: var(--teal); }
.policy-tools summary { width: fit-content; }
.token-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.token-list button { min-height: 31px; padding: 4px 9px; font-size: 12px; }
.skip-link { position: absolute; top: -100px; left: 14px; background: white; padding: 8px 14px; }
.skip-link:focus { top: 8px; z-index: 9; }
@media (min-width: 1600px) {
  .workbench { grid-template-columns: 215px minmax(0,1fr); }
}
@media (max-width: 1000px) {
  .workbench { grid-template-columns: 149px minmax(0,1fr); }
  .sidebar { padding: 29px 9px 20px; }
  main { padding: 25px 19px 45px; }
  .columns { gap: 13px; }
  .card-body { padding: 16px; }
  .card-header { min-height: 48px; padding: 12px 16px; }
}
@media (max-width: 760px) {
  .workbench { display: block; }
  .masthead-inner { min-height: 55px; }
  .identity strong { font-size: 15px; }
  .sidebar { padding: 0; background: #f5f8f6; border-bottom: 1px solid var(--line); border-right: none; }
  #navigation { display: flex; overflow-x: auto; padding: 4px 12px; gap: 2px; }
  #navigation a { flex: 0 0 auto; padding: 8px; font-size: 13px; }
  main { padding: 20px 14px 40px; }
  .workspace-header { margin-bottom: 16px; }
  .sync { gap: 7px; }
}
@media (max-width: 590px) {
  .columns, .form-pair, .split { grid-template-columns: minmax(0,1fr); }
  .grant-details { border: 0; border-top: 1px solid var(--line); padding: 14px 0 0; }
  .card-header { min-height: 44px; }
  .sync > span { display: none; }
  .masthead-inner { padding: 0 14px; }
  .identity { gap: 7px; }
  .brand-mark { height: 22px; }
  .events-list > li > details { padding: 10px 13px; }
  .events-list > li > details > summary { grid-template-columns: 32px 1fr auto; gap: 2px 7px; }
  .events-list > li > details > summary time { grid-column: 2; grid-row: 2; }
  .outcome { grid-column: 3; grid-row: 1; }
  input[type="text"], textarea, select { font-size: 16px; }
}
@media (max-width: 370px) {
  .connection-state { font-size: 10px; gap: 3px; }
  .brand-mark { display: none; }
  .attribute-options { grid-template-columns: 1fr; }
}
