/* Shared STAAD ANL/STD source viewer: compact outside, STAAD-style editor when expanded. */
strutools-staad-viewer { display: block; min-width: 0; }
.staad-viewer-details { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.staad-viewer-details > summary {
  min-height: 58px; display: flex; align-items: center; gap: 11px; padding: 9px 13px; cursor: pointer;
  list-style: none; color: var(--text); background: var(--surface-2); user-select: none;
}
.staad-viewer-details > summary::-webkit-details-marker { display: none; }
.staad-viewer-summary-icon {
  flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-strong);
}
.staad-viewer-summary-copy { min-width: 0; display: grid; gap: 2px; }
.staad-viewer-summary-copy b { font-size: .86rem; }
.staad-viewer-summary-copy small { overflow: hidden; color: var(--muted); font-size: .69rem; text-overflow: ellipsis; white-space: nowrap; }
.staad-viewer-summary-action { margin-left: auto; color: var(--accent-strong); font-size: .72rem; font-weight: 750; white-space: nowrap; }
.staad-viewer-chevron { color: var(--muted); font-size: .72rem; transition: transform .18s ease; }
.staad-viewer-details[open] .staad-viewer-chevron { transform: rotate(180deg); }
.staad-viewer-details[open] > summary { border-bottom: 1px solid #2d3742; }
.staad-viewer-editor-shell { position: relative; height: clamp(300px, 47vh, 560px); overflow: hidden; background: #111820; }
.staad-viewer-highlight,
.staad-viewer-input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 17px 19px; border: 0; border-radius: 0;
  box-sizing: border-box; overflow: auto; white-space: pre; tab-size: 4;
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace; font-size: 13.5px; font-weight: 400; line-height: 1.55;
}
.staad-viewer-highlight { z-index: 1; color: #d8dee9; pointer-events: none; scrollbar-width: none; }
.staad-viewer-highlight::-webkit-scrollbar { display: none; }
.staad-viewer-input {
  z-index: 2; resize: none; outline: 0; background: transparent; color: transparent; caret-color: #ffffff;
  -webkit-text-fill-color: transparent; scrollbar-color: #536273 #111820;
}
.staad-viewer-input::placeholder { color: #82909e; -webkit-text-fill-color: #82909e; opacity: 1; }
.staad-viewer-input::selection { background: rgba(70, 139, 255, .42); }
.staad-viewer-input:focus { box-shadow: inset 0 0 0 2px #5b9dff; }
.staad-syntax-comment { color: #66b96b; }
.staad-syntax-keyword { color: #59a8ff; font-weight: 650; }
.staad-syntax-number { color: #d2a8ff; }
.staad-syntax-profile-type { color: #ffb86c; font-weight: 700; }
.staad-syntax-section { color: #8be9fd; }
@media (max-width: 680px) {
  .staad-viewer-summary-action { display: none; }
  .staad-viewer-highlight, .staad-viewer-input { padding: 14px; font-size: 12.5px; }
  .staad-viewer-editor-shell { height: 340px; }
}

/* One reusable, read-only popup is shared by every STD/ANL upload workflow. */
.staad-source-dialog {
  width: min(1080px, calc(100vw - 32px)); max-width: none; height: min(780px, calc(100vh - 32px)); max-height: none;
  margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px;
  color: var(--text); background: var(--surface); box-shadow: 0 30px 100px rgba(5, 12, 28, .42);
}
.staad-source-dialog::backdrop { background: rgba(6, 12, 26, .72); backdrop-filter: blur(7px); }
.staad-source-dialog-shell { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.staad-source-dialog-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 16px 12px 19px; border-bottom: 1px solid var(--line); background: var(--surface); }
.staad-source-dialog-header > div { min-width: 0; display: grid; gap: 3px; }
.staad-source-dialog-header small { color: var(--accent-strong); font-size: .64rem; font-weight: 850; letter-spacing: .12em; }
.staad-source-dialog-header h2 { overflow: hidden; margin: 0; color: var(--text); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.staad-source-dialog-header button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--surface-muted); cursor: pointer; }
.staad-source-dialog > .staad-source-dialog-shell > strutools-staad-viewer { min-height: 0; overflow: hidden; }
.staad-source-dialog .staad-viewer-details { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr); border: 0; border-radius: 0; }
.staad-source-dialog .staad-viewer-details > summary { display: none; }
.staad-source-dialog .staad-viewer-editor-shell { display: block; height: 100%; min-height: 0; }
.staad-source-dialog-shell > footer { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 16px 9px 19px; border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); font-size: .72rem; }
.staad-source-dialog-shell > footer span { display: inline-flex; align-items: center; gap: 7px; }
.staad-source-dialog-shell > footer button { min-height: 36px; padding: 0 18px; border: 0; border-radius: 9px; color: #fff; background: var(--core-title-gradient, linear-gradient(105deg, #1a73e8, #7c4dff)); font-weight: 750; cursor: pointer; }
@media (max-width: 680px) {
  .staad-source-dialog { width: calc(100vw - 18px); height: calc(100vh - 18px); }
  .staad-source-dialog-header { padding-inline: 13px; }
  .staad-source-dialog-shell > footer { padding-inline: 13px; }
}
@media print { strutools-staad-viewer, .staad-source-dialog { display: none !important; } }
