/* Dialogs live above the shell; only their body scrolls. */
.run-failure-symbol {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-lt);
  color: var(--red);
  font-weight: 700;
  vertical-align: middle
}
.run-failure-kicker {
  display: inline-block;
  vertical-align: middle;
  font-size: 12px;
  color: var(--text2);
  margin-left: 8px
}
.run-failure-panel h2 {
  margin-top: 12px
}
.feedback-modal-open {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue)
}
.feedback-modal-open:hover {
  background: #0758c7;
  color: #fff
}
.community-pick-list {
  display: grid;
  margin-top: 12px
}
.community-pick {
  display: grid;
  grid-template-columns: 16px minmax(0,1fr) 36px;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--bdr);
  cursor: pointer
}
.community-pick-title {
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere
}
.community-pick-meta {
  font-size: 11px;
  color: var(--text2);
  margin-top: 4px
}
.community-pick-score {
  text-align: right;
  font: 600 16px var(--mono)
}
.donate-modal-close,.feedback-modal-close {
  width: 36px;
  height: 36px;
  padding: 6px;
  flex-shrink: 0;
  border-radius: 6px
}
.run-failure-panel h2 {
  font-size: 20px
}
.run-failure-panel p {
  font-size: 13px;
  color: var(--text2);
  margin-top: 8px
}
.run-failure-detail {
  padding: 12px;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 6px;
  font: 12px/1.7 var(--mono);
  overflow-wrap: anywhere;
  margin-top: 12px
}
.run-failure-actions {
  flex-wrap: wrap
}
.cert-preview-head {
  align-items: flex-start
}
.cert-preview-head h2 {
  font-size: 20px
}
.cert-preview-head p,.cert-preview-note {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.cert-preview-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 6px;
  line-height: 22px
}
.sheet-model-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap
}
.sheet-model-tools>span {
  font-size: 12px;
  color: var(--text2)
}
.sheet-advanced small {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.donate-modal,.feedback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: #17223266;
  padding: 20px
}
.donate-modal-card,.feedback-modal-card {
  width: min(640px,100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--bdr);
  border-radius: 12px;
  overflow: hidden
}
.donate-modal-head,.feedback-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--bdr)
}
.donate-modal-title,.feedback-modal-title {
  font-size: 18px;
  font-weight: 600
}
.feedback-modal-sub,.feedback-modal-tip,.donate-modal-tip {
  font-size: 12px;
  color: var(--text2);
  margin-top: 8px
}
.donate-modal-body,.feedback-modal-body {
  padding: 20px;
  min-height: 0;
  overflow: auto
}
.donate-modal-body img {
  display: block;
  max-width: 280px;
  max-height: 50vh;
  margin: auto;
  object-fit: contain
}
.feedback-modal-card {
  width: min(800px,100%);
}
.owner-modal-card {width:min(720px,100%)}
.owner-contact-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.owner-contact-grid section {min-width:0;text-align:center;background:var(--bg);border-radius:8px;padding:16px}
.owner-contact-grid h3 {font-size:16px;margin-bottom:16px}
.owner-contact-grid img {width:100%;height:auto;aspect-ratio:1;object-fit:contain;background:#fff;border-radius:8px}
.owner-contact-grid p {font-size:12px;color:var(--text2);margin-top:12px;line-height:1.7}
@media(max-width:500px){.owner-contact-grid{grid-template-columns:1fr}}
.feedback-modal-area {
  min-height: clamp(280px,40dvh,400px);
  padding: 12px 16px;
  resize: vertical;
  font: 14px/1.75 var(--mono);
  margin-top: 16px
}
.feedback-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px
}
.feedback-modal-tip {
  width: 100%
}
.feedback-modal-list {
  font-size: 13px;
  color: var(--text2)
}
.new-test-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900
}
.new-test-sheet.on {
  display: block
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: #17223266;
  backdrop-filter: blur(3px)
}
.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px,calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  margin: 24px auto;
  background: #fff;
  border: 1px solid var(--bdr);
  border-radius: 12px;
  box-shadow: 0 24px 80px #101b3633;
  overflow: hidden
}
.sheet-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 12px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0
}
.sheet-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px
}
.sheet-title {
  font-size: 20px;
  font-weight: 650
}
.sheet-subtitle {
  display: none;
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.sheet-close {
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 6px;
  font-size: 20px;
  flex-shrink: 0
}
.sheet-task-picker {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg3);
  margin-top: 0;
  grid-column: 2;
  grid-row: 1;
  margin-right: 44px
}
.sheet-head-row { grid-column: 1/-1; grid-row: 1; }
.sheet-task-option { padding-inline: 12px; }
.sheet-task-option {
  flex: 1;
  background: transparent;
  border: 0;
  min-height: 36px
}
.sheet-task-option.on {
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--blue)
}
.task-option-icon,.sheet-task-option small {
  display: none
}
.sheet-steps {
  grid-column: 1/-1;
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  margin-top: 0
}
.sheet-step-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2)
}
.sheet-step-tab.on {
  color: var(--blue);
  font-weight: 600
}
.step-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--bdr);
  border-radius: 50%;
  font-size: 11px
}
.on>.step-index {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff
}
.sheet-body {
  padding: 16px 20px;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain
}
.sheet-section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px
}
.sheet-section-head h3 {
  font-size: 14px
}
.sheet-section-head p {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.sheet-local-badge,.sheet-recommend {
  font-size: 11px;
  color: var(--green);
  white-space: nowrap
}
.sheet-import {
  padding: 12px;
  background: var(--blue-lt2);
  border: 1px solid #d9e6fa;
  border-radius: 8px;
  margin-bottom: 12px
}
.sheet-import-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px
}
.sheet-import-head strong {
  font-size: 13px
}
.sheet-import-head p {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.sheet-import-badge {
  font-size: 11px;
  color: var(--blue)
}
.sheet-import textarea {
  min-height: 64px;
  height: 64px;
  font-size: 14px;
  resize: vertical
}
.sheet-import-body { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; align-items: center; }
.sheet-import-body>button { min-height: 40px; white-space: nowrap; }
#sheetImportStatus { grid-column: 1/-1; font-size: 11px; color: var(--text2); overflow-wrap: anywhere; }
.sheet-model-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 6px; }
.sheet-model-label label { margin: 0; }
.sheet-model-label #sheetLoadModels {
  min-height: 30px;
  padding: 5px 11px;
  border-color: #0a69df;
  background: linear-gradient(180deg,#1683ff 0%,#0672e8 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,113,227,.2), inset 0 1px 0 rgba(255,255,255,.22);
}
.sheet-model-label #sheetLoadModels:hover:not(:disabled) {
  border-color: #005fc7;
  background: linear-gradient(180deg,#0878ef 0%,#0068d9 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,113,227,.25), inset 0 1px 0 rgba(255,255,255,.2);
}
.sheet-model-label #sheetLoadModels:disabled {
  border-color: #8ebff5;
  background: #8ebff5;
  color: rgba(255,255,255,.92);
  box-shadow: none;
}
.sheet-import-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 12px
}
.sheet-import-actions span,.sheet-form-divider {
  font-size: 11px;
  color: var(--text2)
}
.sheet-form-divider {
  margin: 12px 0;
  text-align: center
}
.sheet-import button {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue)
}
.sheet-form-grid {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px 16px
}
.sheet-field {
  min-width: 0
}
.sheet-field-wide {
  grid-column: 1/-1
}
.sheet-field label,.sheet-model-results label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px
}
.sheet-field>small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text2)
}
.sheet-input-wrap {
  position: relative
}
.sheet-input-wrap input {
  padding-right: 44px
}
.sheet-visibility {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  padding: 7px
}
.sheet-visibility svg {
  width: 17px;
  height: 17px
}
.sheet-model-tools {
  margin-top: 16px
}
.sheet-status {
  font-size: 12px;
  color: var(--text2);
  margin-top: 10px
}
.sheet-status.error {
  color: var(--red)
}
.sheet-status.ok {
  color: var(--green)
}
.sheet-model-results {
  margin-top: 16px
}
.sheet-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--bdr)
}
.sheet-setting-row strong {
  font-size: 14px
}
.sheet-setting-row p,.sheet-setting-row small {
  display: block;
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px
}
.sheet-setting-row select {
  width: 160px;
  flex-shrink: 0
}
.sheet-segment {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg3);
  border-radius: 8px
}
.sheet-segment button {
  background: transparent;
  border: 0;
  white-space: nowrap
}
.sheet-segment button.on {
  background: #fff;
  color: var(--blue)
}
.sheet-advanced {
  border-top: 1px solid var(--bdr);
  padding-top: 20px
}
.sheet-advanced>summary {
  cursor: pointer;
  font-size: 13px
}
.sheet-advanced-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 16px;
  margin-top: 20px
}
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg3);
  border-top: 1px solid var(--bdr);
  flex-shrink: 0
}
.sheet-foot-note {
  font-size: 11px;
  color: var(--text2)
}
.sheet-foot-actions {
  display: flex;
  gap: 8px;
  margin-left: auto
}
.sheet-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  min-width: 100px;
  min-height: 36px
}
.sheet-secondary {
  min-height: 36px
}
.run-failure-dialog,.cert-preview-dialog {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #15223866
}
.run-failure-dialog.on,.cert-preview-dialog.on {
  display: flex
}
.run-failure-backdrop,.cert-preview-backdrop {
  position: absolute;
  inset: 0
}
.run-failure-panel,.cert-preview-panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--bdr);
  width: min(660px,100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 24px;
  box-shadow: 0 24px 80px #101b3633
}
.run-failure-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px
}
.cert-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 20px
}
.cert-preview-body {
  padding: 20px 0;
  display: grid;
  place-items: center
}
.cert-preview-body canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 300px);
  width: auto;
  height: auto;
  object-fit: contain
}
.cert-preview-foot {
  display: grid;
  gap: 12px
}
.cert-preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}
@media(max-width:600px) {
  .sheet-head { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .sheet-task-picker { grid-column: 1; grid-row: 2; margin-right: 0; }
  .sheet-model-label #sheetLoadModels { min-height: 40px; }
  .sheet-panel {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
    margin: 10px auto
  }
  .sheet-head,.sheet-body {
    padding: 12px 16px
  }
  .sheet-foot {
    padding: 12px 16px
  }
  .sheet-primary,.sheet-secondary,.sheet-task-option {
    min-height: 40px
  }
  .sheet-foot-note {
    display: none
  }
  .sheet-form-grid,.sheet-advanced-grid {
    grid-template-columns: 1fr
  }
  .sheet-setting-row {
    display: grid;
    gap: 12px
  }
  .sheet-setting-row select {
    width: 100%
  }
  .sheet-import {
    padding: 12px
  }
  .sheet-import-actions {
    flex-wrap: wrap
  }
  .sheet-primary {
    min-width: 88px
  }
  .sheet-foot-actions {
    width: 100%;
    justify-content: flex-end
  }
  .sheet-section-head {
    gap: 8px
  }
  .help-panel {
    margin: 10px;
    max-height: calc(100dvh - 20px)
  }
  .help-doc {
    padding: 20px
  }
  .help-head {
    padding: 12px 16px
  }
  .help-foot-actions {
    width: 100%;
    justify-content: flex-end
  }
  .run-failure-panel,.cert-preview-panel {
    padding: 20px
  }
}
.help-connection-guide { margin: 12px 0; }
.help-connection-guide a { display: block; border: 1px solid var(--bdr); border-radius: 8px; overflow: hidden; }
.help-connection-guide a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.help-connection-guide img { display: block; width: 100%; height: auto; }
.help-connection-guide figcaption { margin-top: 8px; color: var(--text2); font-size: 12px; }
