.agency-totals { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(175px,100%),1fr)); gap:20px; margin:24px 0 42px; }
.inspector .stage-model { display:flex; flex-wrap:wrap; align-items:center; gap:14px 28px; margin:16px 0 0; border-top:1px solid var(--line); padding:18px 0 10px; }
.stage-model small,.stage-model strong { display:block; }.stage-model small { color:var(--steel); margin-bottom:5px; font-size:13px; }.stage-model strong { color:var(--text); font-size:17px; font-weight:550; }
.stage-model .btn { margin-inline-start:auto; }.inspector .module-local { display:flex; align-items:center; gap:8px; color:var(--steel); font-size:14px; margin:16px 0; }
@media(max-width:600px){.inspector .stage-model{gap:14px 22px}.stage-model .btn{margin-inline-start:0}}
.agency-totals > div { padding:18px 0; border-top:1px solid var(--line); }
.agency-totals dt,.agency-project dt,.agency-balance small,.agency-model,.agency-project header span { color:var(--steel); font-size:15px; }
.agency-totals dd,.agency-balance strong { display:block; margin:8px 0 0; font-size:clamp(28px,3vw,48px); line-height:1.1; letter-spacing:-.05em; font-weight:420; }
.agency-project-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(345px,100%),1fr)); gap:18px; }
.agency-project { padding:clamp(22px,2.4vw,36px); border:1px solid var(--line); border-radius:20px; background:linear-gradient(135deg,#191e26,#111419 68%); min-width:0; }
.agency-project header,.agency-project dl > div { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:baseline; gap:5px 16px; }
.agency-project h2 { font-size:clamp(26px,2.25vw,40px); line-height:1.12; font-weight:450; margin:0; }
.agency-project h2 a { color:inherit; }
.agency-balance { padding:26px 0; }
.agency-project dl { margin:0; }
.agency-project dl > div { padding:8px 0; border-top:1px solid var(--line); }
.agency-project dd { margin:0; font-variant-numeric:tabular-nums; }
.agency-project .actions { margin:18px 0 0; flex-wrap:wrap; }
.agency-project details { max-height:250px; overflow:auto; overflow-wrap:anywhere; }
.agency-project-form { display:grid; gap:16px; }
.agency-project-form > p { margin:0; }
.agency-back { display:inline-flex; align-items:center; gap:5px; font-size:14px; color:var(--steel); }
.agency-section { scroll-margin-top:135px; }
.agency-budget { display:grid; justify-items:start; gap:7px; padding:16px 0; border-top:1px solid var(--line); }
.profile-fold { border-top:1px solid var(--line); padding-top:18px; }
.profile-fold>summary { cursor:pointer; font-size:clamp(20px,2vw,28px); padding:12px 0; }
.kb-standard { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; margin:24px 0 32px; }
.kb-resource { display:flex; flex-direction:column; align-items:flex-start; text-align:left; gap:12px; min-height:200px; padding:clamp(19px,2.2vw,32px); background:var(--panel,#171b21); border:1px solid var(--line); border-radius:18px; color:var(--ink); font:inherit; }
.kb-resource:not(:disabled):hover { border-color:var(--steel); }.kb-resource i,.kb-resource span { color:var(--steel); }.kb-resource strong { font-size:clamp(20px,2.1vw,30px); line-height:1.13; }.kb-resource small { margin-top:auto; display:flex; align-items:center; gap:7px; }
.live-progress { display:flex; align-items:center; flex-wrap:wrap; gap:14px; padding:16px; border-bottom:1px solid var(--line); }
.live-progress strong,.live-progress small { display:block; }.live-progress progress { max-width:100%; }
@media(max-width:740px){.kb-standard{grid-template-columns:1fr;gap:12px}.kb-resource{min-height:145px}.kb-resource i{display:none}}
.agency-provider h3 { margin:0; font-size:26px; font-weight:500; }
.agency-provider { background:var(--surface,#171a20); }
.agency-options { padding:16px 0; border-top:1px solid var(--line); }
.agency-options summary { cursor:pointer; font-weight:550; }
.agency-options[open] summary { margin-bottom:16px; }
.agency-issue { display:inline-flex; align-items:center; gap:8px; margin:5px 0; }
.map-browser,.map-edit { display:grid; gap:16px; }
.map-tools,.map-row { display:flex; align-items:center; justify-content:space-between; gap:18px; }
.map-tools { align-items:flex-end; }.map-tools label { flex:1; }
.map-row { border-top:1px solid var(--line); padding:14px 0; }.map-row > div { min-width:0; }
.map-row small,.map-row a,.map-row strong { display:block; overflow-wrap:anywhere; }
.map-row strong { margin:5px 0; line-height:1.35; }.map-row a,.map-row small { font-size:14px; color:var(--steel); }
.map-row .btn { flex:none; }.map-edit > button { justify-self:start; }
.keyword-state { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.keyword-state .icon-btn { flex:none; }
@media(max-width:600px){.map-row,.map-tools{align-items:flex-start;flex-direction:column;gap:12px}.map-tools label{width:100%}.map-row .btn{min-height:40px}}
@media(max-width:740px){.agency-totals{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 19px;margin-bottom:24px}.agency-project{padding:21px}}
#dialog {
  --dialog-width: 700px;
  width: min(var(--dialog-width), calc(100% - 32px));
  max-width: none;
  max-height: min(90dvh, 960px);
  overflow: auto;
  overscroll-behavior: contain;
  color-scheme: dark;
}
#dialog:has(form) { width: min(var(--dialog-width), calc(100% - 32px)); }
#dialog:has(.map-browser) { --dialog-width:860px; }
#dialog:has(.request-choice,.kb-detail,.kb-form,.kb-section-reader,.kb-section-editor,.stage-readings,.prompt-reader,.prompt-library,[name="body_markdown"],.question-browser) { --dialog-width: 860px; }
#dialog .dialog-body { padding: clamp(20px,3vw,40px); min-width: 0; }
#dialog .dialog-head { align-items: flex-start; gap: 20px; margin-bottom: 24px; }
#dialog .dialog-head h2 { font-size: clamp(27px,2.6vw,38px); line-height: 1.12; font-weight: 450; letter-spacing: -.042em; margin: 0; }
#dialog .dialog-head .icon-btn { width: 44px; height: 44px; flex: none; }
#dialog .dialog-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--line); }
#dialog .dialog-foot .btn { min-height: 46px; padding-inline: 20px; border-radius: 30px; }
#dialog .request-choice { gap: 12px; }
#dialog .request-choice legend { font-size: 17px; margin-bottom: 14px; }
#dialog .request-choice label { grid-template-columns: 19px minmax(0,1fr); gap: 12px; padding: 18px; border-radius: 14px; }
#dialog .request-choice label span { gap: 9px; }
#dialog .request-choice label strong { font-size: 18px; font-weight: 500; }
#dialog .request-choice label small, #dialog .request-charge { font-size: 15px; line-height: 1.5; }
#dialog .request-inputs { gap: 18px; margin-top: 8px; }
#dialog textarea, #dialog input:not([type=checkbox],[type=radio]), #dialog select { font-size: 16px; }
.cabinet .graph-layout > .graph-column { grid-column: 1; min-width: 0; }
.cabinet .graph-column > .graph-card { margin: 0; }
.cabinet .graph-layout .graph-history-foot { position: static; margin: 16px 0 0; }
.cabinet .graph-layout > .inspector { grid-column: 2; grid-row: 1; }
.graph-history-foot .history-button { color: var(--ink); background: #202630; }
.graph-history-foot .flow-controls { padding: 10px 0 0; }
@media (max-width:760px) {
  .graph-layout .graph-history-foot { padding-top: 14px; }
  .graph-layout.inspecting-stage .graph-column { display: none; }
}
@media (max-width:680px) {
  #dialog:has(form) { width: calc(100% - 20px); max-height: calc(100dvh - 24px); }
  #dialog .dialog-body { padding: 20px 18px; }
  #dialog .dialog-head { margin-bottom: 18px; }
  #dialog .request-choice label { padding: 13px 15px; }
  .publication-list tbody tr { position: relative; grid-template-columns: minmax(0,1fr); padding: 20px 0 24px; }
  .publication-list tbody td { grid-column: 1; min-width: 0; }
  .publication-list tbody td:first-child {
    position: absolute; z-index: 1; top: 24px; left: 4px; display: grid; place-items: center;
    width: 44px; height: 44px; border-radius: 50%; background: #13171ee8;
  }
  .publication-list tbody td:first-child input { width: 25px; height: 25px; }
  .publication-list .publication-material { display: grid; gap: 13px; }
  .publication-list .publication-thumb, .cabinet .library-row .article-thumb {
    width: 100%; max-width: none; height: auto; aspect-ratio: 1.9; object-fit: cover; border-radius: 10px;
  }
  .publication-material > div:first-child, .publication-material:has(img[hidden]) > div { padding-left: 52px; }
  .publication-material .main-link { font-size: 22px; margin-block: 6px; }
  .cabinet .library-row:has(.article-thumb:not([hidden])) { grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
  .cabinet .library-row .article-thumb { grid-column: 1 / -1; }
  .reader-screen .reader-pane .reading-banner:not(.source-diagram) img { aspect-ratio: 1.85; object-fit: cover; }
  .reader-screen .reader-aligned .reader { font-size: 17px; line-height: 1.68; text-align: left; }
}

.project-article-model{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:16px 0;padding:16px 22px;border:1px solid #39404b;border-radius:20px;background:#15191f;color:#f0f2f4}
.project-article-model div{display:grid;gap:3px}.project-article-model small{color:#b4bdc8}.project-article-model strong{font-size:20px}
#dialog .dialog-body:has(.agency-project-form,.agency-key-form){max-height:min(85dvh,800px);display:flex;flex-direction:column;overflow:hidden}
#dialog .dialog-body:has(.agency-project-form,.agency-key-form) .form-stack{min-height:0;overflow-y:auto;overscroll-behavior:contain}
#dialog .dialog-body:has(.agency-project-form,.agency-key-form) .dialog-foot{flex-shrink:0;position:relative;margin-top:12px}

.live-progress[hidden] { display:none; }
.live-progress.flow-working strong::before,
.list-step.is-flowing::before {
  content:""; display:inline-block; width:.6em; height:.6em; margin-right:.6em;
  border-radius:50%; background:#efc674; box-shadow:0 0 0 4px #e6ba6026;
}
.graph-node.is-flowing .module-orb {
  color:#ffe4a3; outline:2px solid #efc674; outline-offset:3px;
  box-shadow:0 0 20px #e5b34e38;
}
.graph-node.is-flowing .module-orb::after {
  content:""; position:absolute; inset:-5px; border-radius:50%;
  border:2px solid #e8ba66; pointer-events:none; animation:stage-ripple 2.2s ease-out infinite;
}
.timeline [data-state="running"]>summary .step-bullet { color:#33260f; background:#efc674; }
@keyframes stage-ripple {
  from { transform:scale(.97); opacity:.8; }
  to { transform:scale(1.38); opacity:0; }
}
@media(prefers-reduced-motion:reduce) { .graph-node.is-flowing .module-orb::after { animation:none; border:0; } }
.wallet-journal { margin:0; padding:0; list-style:none; }
.wallet-operation { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:8px 18px; padding:20px 0; border-top:1px solid var(--line); }
.wallet-operation>div { display:grid; gap:6px; min-width:0; }
.wallet-operation small { color:var(--muted); font-size:14px; }
.wallet-operation b,.wallet-operation a { font-size:16px; font-weight:500; overflow-wrap:anywhere; }
.wallet-operation strong { white-space:nowrap; font-variant-numeric:tabular-nums; }
.wallet-operation>.btn { grid-column:1/-1; justify-self:start; }
.stage-outcome { max-width:76ch; min-width:0; font-size:16px; line-height:1.55; }
.stage-outcome>h3,.review-verdict header h3 { margin:0; font-size:20px; line-height:1.3; }
.stage-outcome>p { margin:.6em 0; }
.stage-duration { margin:16px 0 4px; font-size:14px; color:var(--muted); }
.stage-note>summary,.stage-outcome .stage-note>summary { padding:12px 0; font-size:15px; }
.review-verdict { max-width:76ch; margin:20px 0; }
.review-verdict header { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 16px; margin-bottom:12px; }
.review-verdict header p { margin:0; font-size:15px; color:var(--muted); }
.review-verdict .review-point { border-top:1px solid var(--line); }
.review-verdict .review-point>summary { display:flex; gap:10px; align-items:center; min-height:46px; padding:10px 0; font-size:16px; cursor:pointer; }
.review-point>summary b { flex:1; font-weight:500; }
.review-point>summary span { color:var(--muted); font-size:14px; }
.review-point[data-verdict="fail"]>summary span { color:#ffb6a1; }
.review-verdict .review-point p { margin:0 0 16px; line-height:1.55; overflow-wrap:anywhere; }
@media (min-width:1050px) {
  .stage-outcome:has(.review-verdict) { max-width:none; }
  .stage-outcome .review-verdict { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; column-gap:clamp(28px,4vw,70px); max-width:none; }
  .stage-outcome .review-verdict header { grid-column:1/-1; }
  .review-verdict .review-point p { max-width:58ch; }
}
@media(max-width:600px) {
  .release-phase .step-detail { padding:10px 0 18px; }
  .stage-outcome,.review-verdict .review-point>summary { font-size:16px; }
}

.balance-funding { margin: 20px 0 32px; text-align: left; }
.balance-funding .funding-trigger { min-height: 52px; padding: 12px 25px; font-size: 17px; }
.balance-funding section { margin-top: 20px; }
.balance-funding section > p { margin: 0 0 12px; }
.balance-funding section > small, .funding-option small { color: var(--muted); }
.funding-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 0 0 12px; }
.funding-option { padding: clamp(16px,2vw,26px); text-align: left; background: var(--panel,#171b21); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font: inherit; }
.funding-option strong, .funding-option small { display: block; }
.funding-option strong { font-size: clamp(23px,2vw,32px); line-height: 1.15; font-weight: 550; }
.funding-option small { margin-top: 8px; font-size: 15px; }
.funding-option:focus-visible, .funding-option:hover { border-color: var(--steel); }
.funding-option:disabled { opacity: .65; }
.funding-status:empty { display: none; }
@media (max-width:620px) {
  .funding-options { grid-template-columns: 1fr; gap: 8px; }
  .funding-option { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .funding-option small { margin: 0; }
}
