/* Shared modeless windows: dimensions follow the task, not intrinsic text width. */
dialog.app-dialog {
  --dialog-width: 560px;
  box-sizing: border-box;
  position: fixed;
  inset: 8vh 0 auto;
  width: min(var(--dialog-width), calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 32px);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  color: #263648;
  background: #fff;
  border: 1px solid #aebcc9;
  border-radius: 8px;
  box-shadow: 0 18px 54px #152e4926, 0 3px 10px #152e4914;
  font: 13px/1.5 "Segoe UI", system-ui, sans-serif;
}
dialog.app-dialog[open] { display: flex; flex-direction: column; }
dialog.app-dialog[data-dialog-size="compact"] { --dialog-width: 380px; }
dialog.app-dialog[data-dialog-size="form"] { --dialog-width: 480px; }
dialog.app-dialog[data-dialog-size="wide"] { --dialog-width: 820px; }
dialog.app-dialog[data-dialog-size="workspace"] { --dialog-width: 960px; }
dialog.app-dialog[data-dialog-size="table"] { --dialog-width: 1120px; }
dialog.app-dialog.panel-gambar { --dialog-width: 340px; inset: 174px 14px auto auto; margin: 0; max-height: calc(100dvh - 190px); }
.dialog-titlebar {
  display: flex;
  padding: 0;
  gap: 0;
  flex: 0 0 auto;
  align-items: center;
  min-height: 46px;
  background: #f7f9fb;
  border-bottom: 1px solid #dce3ea;
}
dialog.app-dialog .dialog-titlebar h3 {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 12px 20px;
  border: 0;
  background: transparent;
  color: #243e56;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
dialog.app-dialog button.dialog-dismiss {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 30px;
  min-height: 0;
  padding: 0;
  margin: 0 6px 0 0;
  border: 1px solid transparent;
  background: transparent;
  color: #587086;
}
.dialog-dismiss svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
dialog.app-dialog .dialog-dismiss:hover { color: #9c3434; background: #fbe9e9; border-color: #eed0d0; }
.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b5c2ce #f6f8fa;
  padding: 18px 20px 20px;
}
.dialog-body > :first-child { margin-top: 0; }
/* Body sections are not title bars. Reset the legacy negative h3 margins. */
dialog.app-dialog .dialog-body :is(h3, h4) {
  position: static;
  margin: 20px 0 10px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1px solid #e0e7ec;
  background: transparent;
  color: #30495b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}
.dialog-body p:empty { display: none; }
dialog.app-dialog .dialog-body > :is(h3, h4):first-child { margin-top: 0; }
.dialog-body > h4:first-child { margin-top: 0; }
.dialog-footer {
  display: flex;
  flex-wrap: wrap;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #d8e0e7;
  background: #f5f7fa;
}
.dialog-footer:empty { display: none; }
.dialog-footer > p { order: -1; flex: 1 0 100%; max-height: 84px; overflow: auto; margin: 0 0 4px; }
.dialog-footer > p:empty { display: none; }
.dialog-footer > .kisi { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
dialog.app-dialog .dialog-footer button { width: auto; min-width: 88px; min-height: 32px; margin: 0; padding: 6px 16px; }
dialog.app-dialog .dialog-primary:not(:disabled) { background: #286a9f; border-color: #286a9f; color: #fff; }
dialog.app-dialog .dialog-primary:hover:not(:disabled) { background: #1b5889; border-color: #1b5889; }
dialog.app-dialog button { width: auto; max-width: 100%; min-height: 32px; margin-top: 12px; padding: 6px 14px; border-radius: 4px; font-weight: 400; line-height: 1.4; }
dialog.app-dialog .kisi button { width: 100%; }
dialog.app-dialog :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 9px;
  margin-top: 5px;
  border: 1px solid #b8c6d4;
  border-radius: 3px;
  background: #fff;
  color: #263648;
  font: inherit;
  line-height: 1.35;
}
dialog.app-dialog textarea { resize: vertical; }
dialog.app-dialog label > [data-satuan-beban]::before { content: " ("; }
dialog.app-dialog label > [data-satuan-beban]::after { content: ")"; }
dialog.app-dialog :is(textarea, [tabindex], [contenteditable]):focus-visible {
  outline: 2px solid var(--accent, #0e6269);
  outline-offset: 2px;
}
dialog.app-dialog .dialog-body > input[type="number"] { max-width: 224px; }
dialog.app-dialog input[type="color"] { padding: 3px; cursor: pointer; }
dialog.app-dialog select[size] { min-height: 132px; padding: 5px; }
dialog.app-dialog select[size] option { padding: 4px 7px; }
dialog.app-dialog :is(input, select, textarea):disabled { background: #f1f4f7; color: #81909d; }
dialog.app-dialog label { display: block; margin: 12px 0 0; color: #465b6c; font-size: 12px; line-height: 1.5; }
dialog.app-dialog label[data-dialog-label] { display: flex; align-items: flex-start; gap: 8px; color: #344b60; margin-top: 9px; }
dialog.app-dialog label[data-dialog-label] > span { min-width: 0; flex: 1; }
dialog.app-dialog :is(input[type="radio"], input[type="checkbox"]) { flex: 0 0 auto; width: 14px; height: 14px; margin: 2px 0 0; }
dialog.app-dialog fieldset { min-width: 0; margin: 16px 0 0; padding: 10px 14px 14px; border: 1px solid #d2dce5; border-radius: 4px; }
dialog.app-dialog fieldset:first-child { margin-top: 0; }
dialog.app-dialog legend { padding: 0 6px; color: #466075; font-size: 12px; font-weight: 600; }
dialog.app-dialog fieldset > label:first-of-type { margin-top: 2px; }
dialog.app-dialog :is(.baris-dua, .baris-tiga, .baris-empat, .kolom-dua) { gap: 10px 16px; align-items: end; }
dialog.app-dialog .baris-dua { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.app-dialog .baris-tiga { grid-template-columns: repeat(3, minmax(0, 1fr)); }
dialog.app-dialog .baris-tiga:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dialog.app-dialog .baris-empat { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Inline math (F<sub>x</sub>, S<sub>DS</sub>, units) must remain a text line.
   Flex-column labels turn every subscript/text node into a separate row. */
dialog.app-dialog :is(.baris-dua, .baris-tiga, .baris-empat) > label { min-width: 0; }
dialog.app-dialog label > :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { display: block; }
dialog.app-dialog label[data-dialog-label] { display: flex; align-items: flex-start; }
dialog.app-dialog :is(.baris-dua, .baris-tiga, .baris-empat) > button { justify-self: start; align-self: end; margin-bottom: 0; }
dialog.app-dialog .kisi { gap: 8px; }
dialog.app-dialog .kisi button { margin-top: 0; }
/* Space the action group from its preceding list/fields, not each button. */
dialog.app-dialog .dialog-body .kisi:not(:first-child) { margin-top: 14px; }
dialog.app-dialog :is(.muted, .kecil) { line-height: 1.5; }
dialog.app-dialog .tabel-bungkus { max-height: min(320px, 38dvh); margin-top: 10px; border: 1px solid #d1dce5; border-radius: 3px; background: #fff; }
dialog.app-dialog .tabel-bungkus.lebar { max-height: min(480px, 48dvh); }
dialog.app-dialog table { font-size: 12px; }
dialog.app-dialog :is(td, th) { padding: 7px 9px; }
dialog.app-dialog th { background: #eef3f7; color: #435d72; font-weight: 600; white-space: nowrap; }
dialog.app-dialog tbody tr:nth-child(even) { background: #f8fafc; }
dialog.app-dialog tbody tr:hover { background: #edf5fc; }
dialog.app-dialog tbody tr[aria-selected="true"] { background: #cfe3f6; }
dialog.app-dialog :is(td, th) { vertical-align: middle; }
dialog.app-dialog th { z-index: 1; }
dialog.app-dialog td :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) { min-height: 28px; margin: 0; padding: 4px 6px; }
dialog.app-dialog td button { margin: 0; min-height: 27px; padding: 3px 8px; }
/* Definition lists: names and descriptions need room; actions stay together. */
#dlg-kasus .dialog-body > .tabel-bungkus,
#dlg-load-case .dialog-body > .tabel-bungkus,
#dlg-kombinasi .dialog-body > .tabel-bungkus { max-height: min(230px, 30dvh); margin-top: 0; }
:is(#tabel-kasus, #tabel-load-case, #tabel-kombinasi) { table-layout: fixed; }
dialog.app-dialog :is(#tabel-kasus, #tabel-load-case, #tabel-kombinasi) :is(th, td) { text-align: left; overflow-wrap: break-word; }
dialog.app-dialog :is(#tabel-kasus, #tabel-load-case, #tabel-kombinasi) :is(th, td):last-child { width: 116px; white-space: nowrap; text-align: right; }
#tabel-kasus th:first-child { width: 110px; }
#tabel-kasus th:nth-child(2) { width: 60px; }
#tabel-kasus th:nth-child(3) { width: 106px; }
#tabel-kasus td:nth-child(3) { text-align: right; padding-right: 18px; }
#tabel-kasus td:nth-child(4) button { margin-top: 5px; }
#tabel-load-case th:first-child { width: 136px; }
#tabel-load-case th:nth-child(2) { width: 144px; }
#tabel-kombinasi th:first-child { width: 112px; }
#tabel-kombinasi th:nth-child(2) { width: 106px; }
#tabel-kombinasi th:nth-child(4) { width: 136px; }
.dialog-combination-sections { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr); gap: 18px 24px; margin-top: 18px; }
.dialog-section { min-width: 0; padding: 0; margin: 0; border: 0; }
dialog.app-dialog .dialog-section > h3:first-child { margin-top: 0; }
.dialog-combination-sections > .dialog-section:last-child { grid-column: 1 / -1; }
#dlg-kombinasi .baris-tiga:has(#sd-fungsi) { grid-template-columns: minmax(0, 1fr) 92px; }
#dlg-kombinasi .baris-tiga:has(#kmb-kasus),
#dlg-load-case .baris-tiga:has(#lc-pola-pilih) { grid-template-columns: minmax(0, 1fr) 112px auto; }
#dlg-kombinasi .baris-tiga:has(#kmb-id) { grid-template-columns: minmax(0, 1fr) minmax(180px, .55fr); }
/* Edit Story and Grid System Data (Milestone 75): dua grup BERTUMPUK, daftar di kiri dan
   tombol di kanan, Refresh View di tengah — susunan dialog ETABS yang dipotret 2026-09-24. */
#dlg-grid { --dialog-width: 560px; }
#dlg-grid fieldset { display: grid; grid-template-columns: minmax(0, 1fr) 196px; gap: 10px 16px; align-items: start; }
#dlg-grid fieldset > select { grid-column: 1; height: 150px; min-height: 0; margin: 0; }
#dlg-grid fieldset .kisi { grid-column: 2; grid-template-columns: 1fr; align-content: start; margin-top: 0; }
#dlg-grid #grid-segarkan-tampak { display: block; width: auto; margin: 12px auto 0; }
#dlg-tumpuan { --dialog-width: 360px; }
#dlg-tumpuan .dialog-body > label { margin-top: 0; }
/* Replicate (Milestone 75c): tab Story berdaftar pilih-banyak; Replicate Assigns berpohon
   centang berindentasi di dalam bingkai, seperti dialog ETABS yang dipotret 2026-09-24. */
#dlg-replikasi #rep-lantai { width: 100%; height: 150px; }
#dlg-replikasi-opsi { --dialog-width: 420px; }
#dlg-replikasi-opsi .pohon-opsi { list-style: none; margin: 0; padding: 6px 8px; min-height: 250px; border: 1px solid #b8c6d4; }
#dlg-replikasi-opsi .pohon-opsi ul { list-style: none; margin: 0; padding-left: 20px; }
#dlg-replikasi-opsi .pohon-opsi label { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
/* Numerical rows keep bounded cells while identifiers/functions get more space. */
#dlg-load-case .baris-tiga:has(#lc-id) { grid-template-columns: minmax(0, 1fr) minmax(220px, 1fr); }
#dlg-kasus .baris-tiga:has(#kasus-id) { grid-template-columns: minmax(0, 1fr) 180px; }
#dlg-kasus #kasus-jenis { max-width: 240px; }
#dlg-fungsi-rsa .baris-tiga:has(#fn-kode) { grid-template-columns: minmax(190px, 1.3fr) minmax(140px, 1fr) 92px 92px; }
#tabel-story { table-layout: fixed; }
#tabel-story th:first-child { width: 29%; }
#tabel-story th:nth-child(2), #tabel-story th:nth-child(3) { width: 23%; }
#tabel-story th:nth-child(4) { width: 10%; }
#tabel-story th:last-child { width: 15%; }
#tabel-story td { overflow: hidden; text-overflow: ellipsis; }
#tabel-story :is(td, th) { padding: 4px 7px; }
#dlg-story .tabel-bungkus { max-height: min(290px, 29dvh); }
#dlg-story :is(#st-cepat, #st-tambah) { width: auto; min-width: 150px; padding-inline: 18px; }
#dlg-story #st-warna { height: 32px; }
#dlg-hasil .pohon-tabel { max-height: 200px; }
dialog.app-dialog table.windowed-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
dialog.app-dialog .windowed-table tbody tr:not(.table-spacer) { height: 22px; }
dialog.app-dialog .windowed-table td { box-sizing: border-box; height: 22px; padding: 1px 9px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.app-dialog .windowed-table .table-spacer td { padding: 0; border: 0; background: #fff; }
#dlg-material-data { --dialog-width: 840px; }
#dlg-section-data { --dialog-width: 960px; }
#sec-dimensi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; align-items: end; }
#sec-dimensi label:has(input[type="checkbox"]) { grid-column: 1 / -1; }
.section-preview { box-sizing: border-box; height: 252px; overflow: hidden; display: grid; align-content: center; background: #f5f8f8; border: 1px solid #e1e9e8; border-radius: 4px; }
.section-preview svg { display: block; width: 100%; height: 250px; }
.section-preview svg text { font: 12px "Segoe UI", sans-serif; fill: #425b68; }
.section-preview[data-state="pending"] > * { opacity: .35; }
.section-general-preview { margin: 12px; width: calc(100% - 24px); }
.section-preview > p { margin: 10px 14px; }
#sec-peringatan-teks { overflow-wrap: anywhere; white-space: pre-line; margin-bottom: 0; }
.dialog-property-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.spectrum-chart { margin-top: 14px; border: 1px solid #d6e1e7; border-radius: 6px; background: #fff; overflow: hidden; }
.spectrum-chart-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid #edf1f4; }
.spectrum-chart-header strong { display: flex; align-items: center; gap: 9px; color: #294953; font-weight: 600; }
.spectrum-chart-header strong:not(:empty)::before { content: ""; width: 20px; height: 3px; background: #237e83; border-radius: 2px; }
#fn-plot-readout { color: #536b7c; font-size: 12px; font-variant-numeric: tabular-nums; white-space: pre; }
#fn-grafik { display: block; width: 100%; height: 310px; touch-action: pan-y; }
#fn-grafik text { font: 12px "Segoe UI", sans-serif; fill: #586e7c; }
#fn-grafik .spectrum-axis-title { fill: #304e60; font-weight: 600; }
.spectrum-grid { stroke: #e9eff2; stroke-width: 1; }
.spectrum-axis { stroke: #99adb9; stroke-width: 1; }
.spectrum-line { stroke: #237e83; stroke-width: 2.2; stroke-linejoin: round; fill: none; }
.spectrum-fill { fill: #237e83; fill-opacity: .065; }
.spectrum-cursor { stroke: #7a999f; stroke-dasharray: 4 4; }
.spectrum-point { fill: #237e83; stroke: #fff; stroke-width: 2; }
.spectrum-parameters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 12px 0 0; border: 1px solid #dce5eb; border-radius: 5px; background: #f8fafb; }
.spectrum-parameters:empty { display: none; }
.spectrum-parameters > div { min-width: 0; padding: 10px 16px; }
.spectrum-parameters > div + div { border-left: 1px solid #dce5eb; }
.spectrum-parameters dt { font-size: 11px; color: #617787; }
.spectrum-parameters dd { margin: 3px 0 0; font-size: 14px; font-weight: 600; color: #294953; font-variant-numeric: tabular-nums; }
.dialog-property-column { min-width: 0; }
dialog.app-dialog .dialog-property-column > fieldset:first-child { margin-top: 0; }
#dlg-material-data .dialog-property-column .baris-tiga { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#dlg-material-data .dialog-property-column .baris-tiga > :last-child:nth-child(3) { grid-column: 1 / -1; }
dialog.app-dialog :is(#mat-warna, #sec-warna, #shell-warna) { width: 104px; display: block; }
@media (max-width: 760px) {
  dialog.app-dialog { top: 12px; max-height: calc(100dvh - 24px); }
  .dialog-body { padding: 14px; }
  .dialog-footer { padding: 10px 14px; }
  dialog.app-dialog .baris-empat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-property-columns { grid-template-columns: minmax(0, 1fr); }
  .dialog-combination-sections { grid-template-columns: minmax(0, 1fr); }
  #dlg-fungsi-rsa .baris-tiga:has(#fn-kode) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :is(#tabel-kasus, #tabel-load-case) { min-width: 660px; }
  #tabel-kombinasi { min-width: 850px; }
}
@media (max-width: 440px) {
  dialog.app-dialog :is(.baris-tiga, .baris-dua, .baris-empat, .kolom-dua) { grid-template-columns: minmax(0, 1fr); }
  .dialog-footer { gap: 6px; }
  dialog.app-dialog .dialog-footer button { flex: 1 1 auto; padding-inline: 10px; }
  #dlg-grid fieldset { grid-template-columns: minmax(0, 1fr); }
  #dlg-grid fieldset .kisi { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #dlg-kombinasi .baris-tiga:has(#kmb-id), #dlg-load-case .baris-tiga:has(#lc-id), #dlg-kasus .baris-tiga:has(#kasus-id) { grid-template-columns: minmax(0, 1fr); }
}

/* Load Case Tree (Milestone 80 Tahap e): pohon bertingkat seperti kotak pohon ETABS. */
#pohon-kasus { min-height: 14em; max-height: 50vh; overflow: auto; border: 1px solid #b8c2cc; padding: 6px 8px; background: #fff; }
#pohon-kasus ul { list-style: none; margin: 0; padding-left: 1.4em; }
#pohon-kasus > ul { padding-left: 0; }
#pohon-kasus li { line-height: 1.6; }

/* File ▸ Close (Milestone 80 Tahap g): kalimat dua paragraf seperti kotak pesan ETABS. */
#tm-teks { white-space: pre-line; }
