/* Appearance preview stays separate from graph controls. */
#theme-open { white-space: nowrap; }
#theme-dialog { width: min(590px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px; border: 1px solid var(--ct-border-control); border-radius: 14px; background: var(--ct-surface); color: var(--ct-text); box-shadow: 0 18px 60px var(--ct-shadow); }
#theme-dialog::backdrop { background: var(--ct-backdrop); }
.theme-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.theme-heading h2 { margin: 0; }
#theme-dialog p { margin: 14px 0 20px; }
#theme-options { border: 0; margin: 0; padding: 0; }
#theme-options legend { font: 12px system-ui; color: var(--ct-text-secondary); margin-bottom: 8px; }
.theme-option { display: flex; align-items: center; gap: 12px; padding: 15px 12px; margin-bottom: 10px; border: 1px solid var(--ct-border-control); border-radius: 8px; cursor: pointer; }
.theme-option:has(input:checked) { outline: 2px solid var(--ct-accent); outline-offset: 1px; background: var(--ct-hover); }
.theme-option input { accent-color: var(--ct-accent); margin: 0; flex: 0 0 auto; }
.theme-option strong { display: block; font: 600 15px system-ui; }
.theme-option small { display: block; margin-top: 5px; font: 12px/1.5 system-ui; color: var(--ct-text-secondary); }
.theme-swatches { display: flex; flex: 0 0 auto; }
.theme-swatches i { width: 15px; height: 32px; border: 1px solid var(--ct-border-control); background: var(--swatch); }
.theme-swatches i:nth-child(1) { --swatch: var(--s1); border-radius: 4px 0 0 4px; }
.theme-swatches i:nth-child(2) { --swatch: var(--s2); }
.theme-swatches i:nth-child(3) { --swatch: var(--s3); }
.theme-swatches i:nth-child(4) { --swatch: var(--s4); border-radius: 0 4px 4px 0; }
.theme-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
#theme-status { font: 12px/1.5 system-ui; color: var(--ct-text-secondary); }
.legend-line { display: inline-block; width: 16px; margin-right: 5px; vertical-align: middle; border-top: 2px solid var(--ct-relationship); }
.legend-line.split { border-color: var(--ct-relationship-split); }
.legend-line.mixed { border-color: var(--ct-relationship-mixed); border-top-style: dashed; }
@media (max-width: 1099px) {
  header { position: relative; }
  #theme-open { position: absolute; right: 12px; top: 7px; font-size: 12px; min-height: 36px; padding: 6px 9px; }
  header > div { padding-right: 90px; }
  header > div p { display: none; }
  #theme-dialog { padding: 16px; }
  .theme-heading h2 { font-size: 20px; }
  .theme-option { padding: 12px 9px; gap: 8px; }
  .theme-swatches i { width: 10px; }
}
#theme-options { min-inline-size: 0; }
.theme-option > span:not(.theme-swatches) { min-width: 0; overflow-wrap: anywhere; }
.theme-heading h2 { min-width: 0; }
.theme-heading button { flex-shrink: 0; }
.theme-option input { width: 18px; height: 18px; padding: 0; }
