.generator .heading { align-items: center; }
.gen-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.gen-panel { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 13px; }
.gen-sidebar { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.gen-sidebar h2 { font-size: 13px; margin: 14px 0 7px; }
.gen-list-section > summary { padding: 7px 0; cursor: pointer; font-weight: 750; color: #183b64; }
.gen-list-section + .gen-list-section { border-top: 1px solid var(--line); }
.gen-empty-list { margin: 2px 0 8px; font-size: 11px; color: var(--muted); }
.gen-version-group { border-top: 1px solid var(--line); padding: 7px 0; }
.gen-version-status { display: block; margin-top: 3px; font-size: 11px; font-weight: normal; }
.gen-version-history { padding: 4px 8px; font-size: 11px; }
.gen-version-history summary { cursor: pointer; }
.gen-version-group button { display: block; text-align: left; white-space: normal; width: 100%; }
.gen-version-group button[aria-current] { background: #edf4ff; }
.gen-editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.gen-editor-head h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.gen-badge { background: #edf4ff; color: #16457e; border: 1px solid #cbd8e9; border-radius: 20px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.gen-steps { display: flex; flex-wrap: wrap; gap: 5px 13px; padding: 0; margin: 9px 0; list-style: none; font-size: 11px; color: var(--muted); }
.gen-steps li { border-bottom: 2px solid #e4ebf4; padding-bottom: 4px; }
.gen-steps li.completed { border-color: #7cbea0; }
.gen-steps li[aria-current] { color: #134c94; font-weight: 750; border-color: #2767bd; }
.gen-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.gen-totals { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.gen-totals > div { display: grid; min-width: 108px; background: #f3f7fc; border: 1px solid #e0e9f4; padding: 5px 7px; border-radius: 5px; }
.gen-totals span { font-size: 10px; color: var(--muted); }
.gen-totals strong { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.generator label, #gen-dialog label { font-size: 11px; font-weight: 650; color: #294764; }
.generator input:not([type="checkbox"]), .generator select, .generator textarea {
  font: inherit; width: 100%; min-width: 0; padding: 4px 5px; color: #17283e; border: 1px solid #cbd8e9; border-radius: 4px;
}
.generator textarea { resize: vertical; }
.generator .gen-actions > input { width: min(225px, 100%); }
.gen-workspace h3 { margin: 10px 0 4px; }
.gen-workspace .dialog-note { margin-bottom: 6px; }
.gen-table-scroll { max-height: 53vh; overflow: auto; border: 1px solid var(--line); border-radius: 5px; }
.gen-table-scroll th { position: sticky; top: 0; z-index: 1; }
.gen-milestones td { padding: 3px; }
.gen-row-tools { white-space: nowrap; width: 82px; }
.gen-row-tools .icon { min-width: 24px; min-height: 23px; padding: 0 3px; margin-right: 2px; font-size: 14px; }
.gen-errors { margin: 7px 0; padding: 6px 6px 6px 25px; border-radius: 5px; background: #fff2f0; color: #912e29; }
.gen-saved-meta { margin: 8px 0; color: #28466a; }
.gen-saved-meta p { margin: 3px 0; overflow-wrap: anywhere; }
#gen-dialog-body { padding: 12px 18px 18px; }
#gen-dialog-body > button { margin-top: 10px; }
#gen-notice { margin: 0 0 6px; }
@media (max-width: 900px) {
  .gen-layout { grid-template-columns: 165px minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 650px) {
  .gen-layout { grid-template-columns: 1fr; }
  .gen-sidebar { position: static; max-height: 155px; }
  .generator .heading { align-items: start; }
}

.gen-totals > .gen-balance-metric {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.gen-balance-metric > div { display: grid; }
.gen-balance-choice { display: flex; align-items: center; gap: 5px; }
.gen-balance-choice input { margin: 0; accent-color: #1757b6; }
.gen-balance-scroll td:nth-child(n+2) { white-space: nowrap; text-align: right; }
.gen-balance-result { font-weight: 650; }
.gen-budget-feedback { grid-column: 1 / -1; margin: 0; color: #902d28; font-size: 12px; }

.gen-section { padding: 12px 0; border-top: 1px solid var(--line); }
.gen-section h3 { margin: 0 0 8px; font-size: 16px; }
.gen-section h4 { margin: 10px 0 5px; font-size: 14px; }
.gen-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; max-width: 690px; }
.gen-form-fields label, .gen-selected-category label { display: grid; min-width: 0; gap: 3px; }
.gen-disclosure { margin-top: 9px; }
.gen-disclosure summary { cursor: pointer; color: #24486c; font-weight: 700; }
.gen-disclosure[open] summary { margin-bottom: 6px; }
.gen-fixed { margin-top: 8px; }
.gen-fixed label { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.gen-fixed strong { white-space: nowrap; }
.gen-section .gen-actions > select { width: min(265px, 100%); }
.gen-picker > select { display: block; max-width: 360px; margin-bottom: 6px; }
.gen-selected-categories { display: grid; gap: 4px; margin-top: 8px; max-width: 750px; }
.gen-selected-category { display: grid; grid-template-columns: minmax(0, 1fr) minmax(105px, 135px) minmax(75px, 100px) auto; align-items: end; gap: 8px; border-bottom: 1px solid var(--line); padding: 5px 0; }
.gen-selected-category strong { align-self: center; font-size: 13px; overflow-wrap: anywhere; }
.gen-generated-total { font-weight: 650; }
.gen-milestones { min-width: 650px; }
.gen-milestones td:nth-child(1) { width: 56px; }
.gen-milestones td:nth-child(2) { width: 120px; }
.gen-milestones td:nth-child(4) { width: 78px; }
.gen-milestones td:nth-child(5) { width: 100px; }
.gen-milestones td:nth-child(n+6) { white-space: nowrap; }
@media (max-width: 560px) {
  .gen-form-fields { grid-template-columns: 1fr; }
  .gen-selected-category { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .gen-selected-category strong { grid-column: 1 / -1; }
}

.gen-section[hidden], .gen-actions[hidden], .gen-fixed[hidden], .gen-review-result[hidden] { display: none; }
.gen-wizard { margin: 10px 0 0; }
.gen-wizard li { padding: 5px 9px; background: #f4f7fb; border-radius: 4px; }
.gen-work-choices { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; max-width: 750px; }
.gen-work-choices h4 { margin: 8px 0 4px; color: #28486a; }
.gen-work-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #edf2f8; padding: 4px 0; }
.gen-work-option label { display: flex; align-items: center; gap: 6px; }
.gen-work-icon { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 5px; margin-right: 3px; background: #f0f4fa; font-size: 13px; vertical-align: middle; }
.generator select.gen-place { width: 115px; min-width: 85px; }
.gen-place-factory, .gen-totals > .gen-place-factory { background: #eaf3ff; color: #174f8a; }
.gen-place-site, .gen-totals > .gen-place-site { background: #eaf7ed; color: #246144; }
.gen-place-general, .gen-totals > .gen-place-general { background: #f0f2f5; color: #43536a; }
.gen-review-result { color: #246144; font-weight: 700; }
.gen-row-tools select { width: auto; max-width: 145px; margin-right: 4px; }
.gen-milestones td:nth-child(6) { min-width: 94px; }
