.diagram-launch { display: block; min-height: 44px; margin: 18px auto 0; padding: 10px 15px; color: #e4f6f5; background: #204855; border: 1px solid #90b9bf; border-radius: 4px; font: inherit; font-size: 15px; cursor: pointer; }
.diagram-launch:hover { background: #30606a; }
body:has(.diagram-dialog[open]) { overflow: hidden; }
.diagram-dialog { box-sizing: border-box; width: min(1120px, calc(100vw - 32px)); max-width: none; height: min(860px, calc(100dvh - 32px)); max-height: none; margin: auto; padding: 0; border: 1px solid #a7bfc5; border-radius: 8px; color: #193a47; background: #f3f7f8; }
.diagram-dialog::backdrop { background: rgb(6 27 41 / 78%); }
.diagram-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 20px; gap: 12px; }
.diagram-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.diagram-header p { margin: 0 0 3px; font-size: 13px; color: #496570; }
.diagram-header h2 { margin: 0; font-size: 25px; font-weight: 600; line-height: 1.4; }
.diagram-dialog button { min-height: 44px; padding: 9px 14px; border: 1px solid #789ba4; border-radius: 4px; background: white; color: #193a47; font: inherit; font-size: 15px; cursor: pointer; }
.diagram-dialog button:disabled { opacity: .45; cursor: default; }
#diagramClose { flex-shrink: 0; }
.diagram-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diagram-controls output { min-width: 4ch; font-size: 15px; font-variant-numeric: tabular-nums; }
#diagramHelp { margin: 0; color: #496570; font-size: 14px; line-height: 1.6; }
.diagram-viewport { flex: 1; min-height: 100px; overflow: auto; overscroll-behavior: contain; border: 1px solid #789ba4; border-radius: 4px; background: #ffffff; color: #1e293b; border-color: #cbd5e1; padding: 12px; touch-action: pan-x pan-y pinch-zoom; }
.diagram-stage { position: relative; margin: auto; overflow: hidden; }
.diagram-canvas { width: 720px; position: absolute; left: 0; top: 0; transform-origin: top left; }
.diagram-canvas .detail-visual { box-sizing: border-box; }
.diagram-canvas .detail-visual > svg { max-height: none; height: auto; }
.diagram-canvas .dispatch-diagram { max-width: none; }
.diagram-notes { flex-shrink: 0; max-height: 30%; overflow: auto; font-size: 15px; line-height: 1.7; }
.diagram-notes summary { cursor: pointer; padding: 7px 0; }
.diagram-notes p { margin: 8px 0; }
@media (max-width: 560px) {
  .diagram-dialog { width: 100%; height: 100dvh; border-radius: 0; }
  .diagram-shell { padding: 12px; gap: 10px; }
  .diagram-header h2 { font-size: 20px; }
  .diagram-header { gap: 8px; }
  #diagramClose { padding: 9px; }
  .diagram-controls { gap: 6px; }
  .diagram-dialog button { padding: 9px 12px; }
}
@media print { .diagram-launch, .diagram-dialog { display: none !important; } }
