/* The existing choices stay direct. This layer only gives each popover a
   consistent, compact surface and each option a legible selected state. */
.reference-ui-shell #referenceComposerSettingsPanel {
  width: min(400px, calc(100vw - 20px)) !important;
  height: auto !important;
  border: 1px solid var(--ref-border) !important;
  border-radius: 14px !important;
  background: var(--ref-surface) !important;
  box-shadow: 0 16px 46px #0b183629, 0 2px 8px #0b18360d !important;
}
html[data-zq-theme="dark"] .reference-ui-shell #referenceComposerSettingsPanel {
  box-shadow: 0 18px 48px #0006, 0 2px 8px #0003 !important;
}
.reference-ui-shell #referenceComposerSettingsPanel:is([data-active-section="resolution"],[data-active-section="ratio"]) { width: min(360px, calc(100vw - 20px)) !important; }
.reference-ui-shell #referenceComposerSettingsPanel:is([data-active-section="reference"],[data-active-section="project"]) { width: min(380px, calc(100vw - 20px)) !important; }
.reference-ui-shell #referenceComposerSettingsPanel[data-active-section="model"] { width: min(420px, calc(100vw - 20px)) !important; }
.reference-ui-shell #referenceComposerSettingsPanel:is([data-active-section="audio"],[data-active-section="parameters"]) { width: min(560px, calc(100vw - 20px)) !important; }
.reference-ui-shell #referenceComposerSettingsPanel::after { display: none !important; }
.reference-ui-shell #referenceComposerSettingsPanel > header {
  flex: 0 0 auto; min-height: 0; gap: 12px;
  padding: 16px 16px 12px !important;
  border: 0 !important; background: transparent !important;
}
.reference-ui-shell #referenceComposerSettingsPanel > header > div { min-width: 0; gap: 3px; }
.reference-ui-shell #referenceComposerSettingsPanel > header strong { font-size: 14px !important; line-height: 1.4; font-weight: 650; letter-spacing: .01em; }
.reference-ui-shell #referenceComposerSettingsPanel > header span { font-size: 11px !important; line-height: 1.55; color: var(--ref-muted) !important; }
.reference-ui-shell #referenceComposerSettingsPanel > header > button {
  display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px;
  min-height: 28px; padding: 0 !important; border: 0 !important;
  border-radius: 7px !important; background: transparent !important;
  color: var(--ref-muted) !important; font-size: 21px !important; line-height: 1;
}
.reference-ui-shell #referenceComposerSettingsPanel > header > button:hover { background: var(--ref-bg-2) !important; color: var(--ref-text) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .reference-composer-settings-body { padding: 0 16px 16px !important; background: transparent !important; overflow: auto; scrollbar-width: thin; }
.reference-ui-shell #referenceComposerSettingsPanel .reference-composer-settings-section {
  height: auto; max-height: none; grid-template-columns: minmax(0, 1fr);
  padding: 0 !important; gap: 12px; overflow: visible;
}
.reference-ui-shell #referenceComposerSettingsPanel :is(#referenceField,#promptField) { width: 100%; min-width: 0; padding: 0 !important; border: 0 !important; background: transparent !important; }
.reference-ui-shell #referenceComposerSettingsPanel :is(#referenceField,#promptField) > .field-head { display: none !important; }
.reference-ui-shell #referenceComposerSettingsPanel :is(#ratioControl,#resolutionControl) { min-width: 0; margin: 0; }

/* Quality is a side-by-side comparison; ratios give the outline a fixed row
   so landscape, square and portrait choices share the same text baseline. */
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-options { gap: 8px; padding: 2px; margin: -2px; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice {
  border-color: var(--ref-border) !important; border-radius: 10px !important;
  background: var(--ref-bg-2) !important; color: var(--ref-text) !important;
  transition: background-color .14s, border-color .14s, box-shadow .14s;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice:hover:not(:disabled) { border-color: var(--ref-border-2) !important; background: var(--ref-surface-2) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice[aria-checked="true"] {
  border-color: var(--ref-primary) !important; background: var(--refine-soft) !important;
  color: var(--ref-primary) !important; box-shadow: inset 0 0 0 .5px var(--ref-primary) !important;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice-copy { gap: 3px; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice-copy small { line-height: 1.45; color: var(--ref-muted) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice-check {
  display: grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px;
  border-radius: 50%; background: var(--refine-button); color: #fff !important;
  font-size: 10px !important; font-weight: 700; line-height: 1;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-quality .direct-choices-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-quality .direct-choice {
  display: flex; justify-content: center; min-height: 90px; padding: 20px 8px 14px !important;
  text-align: center;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-quality .direct-choice-copy strong { font-size: 18px !important; font-weight: 650; letter-spacing: -.035em; line-height: 1.4; white-space: nowrap; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-quality .direct-choice-copy small { font-size: 11px !important; }
.reference-ui-shell #referenceComposerSettingsPanel :is(.direct-choices-quality,.direct-choices-ratio) .direct-choice-check { position: absolute; top: 7px; right: 7px; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-ratio .direct-choices-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-ratio .direct-choice {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 32px auto;
  align-items: center; justify-items: center; align-content: center;
  gap: 8px; min-height: 103px; padding: 14px 6px 10px !important; text-align: center;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choice-ratio { border-width: 1.5px; border-radius: 3px; background: color-mix(in srgb, currentColor 5%, transparent); opacity: .85; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-ratio .direct-choice-copy { gap: 1px; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-ratio .direct-choice-copy strong { font-size: 13px !important; line-height: 1.45; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-ratio .direct-choice-copy small { font-size: 10px !important; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-project .direct-choice {
  min-height: 44px; padding: 10px 12px !important; background: transparent !important; border-color: transparent !important;
}
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-project .direct-choice:hover:not(:disabled) { background: var(--ref-bg-2) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-project .direct-choice[aria-checked="true"] { background: var(--refine-soft) !important; border-color: transparent !important; box-shadow: none !important; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-project .direct-choice-copy strong { font-weight: 550; }
.reference-ui-shell #referenceComposerSettingsPanel .direct-choices-search { height: 38px; margin-bottom: 12px; border-radius: 8px; background: var(--ref-bg-2) !important; }

/* Reference modes and model results use the same quiet list treatment. */
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-card {
  position: relative; min-height: 54px; padding: 12px 30px 12px 12px !important;
  border: 1px solid var(--ref-border) !important; border-radius: 10px !important;
  background: var(--ref-bg-2) !important; color: var(--ref-text) !important; box-shadow: none !important; text-align: left;
}
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-card strong { font-size: 13px !important; font-weight: 550; line-height: 1.5; }
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-card:hover:not(:disabled) { border-color: var(--ref-border-2) !important; background: var(--ref-surface-2) !important; }
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-card.active { border-color: var(--ref-primary) !important; background: var(--refine-soft) !important; color: var(--ref-primary) !important; }
.reference-ui-shell #referenceComposerSettingsPanel #referenceField .ref-card.active::after,
.reference-ui-shell #referenceComposerSettingsPanel .model-option-rich.active::after {
  content: "✓"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--refine-button); color: white; font-size: 10px; font-weight: 700; line-height: 1;
}
.reference-ui-shell #referenceComposerSettingsPanel #referenceComposerModelPanel #modelSelect .model-menu { margin: 0; padding: 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
.reference-ui-shell #referenceComposerSettingsPanel .model-channel-tabs { gap: 3px; margin: 0 0 10px; padding: 3px; border: 0; border-radius: 9px; background: var(--ref-bg-2); }
.reference-ui-shell #referenceComposerSettingsPanel .model-channel-tab { height: 32px; min-height: 32px; padding: 0 9px; border: 1px solid transparent !important; border-radius: 6px; color: var(--ref-sub); background: transparent; font-size: 11px; }
.reference-ui-shell #referenceComposerSettingsPanel .model-channel-tab.active { border-color: var(--ref-border) !important; background: var(--ref-surface) !important; color: var(--ref-primary) !important; box-shadow: 0 1px 3px #10223f0a; }
.reference-ui-shell #referenceComposerSettingsPanel .model-channel-list { gap: 5px; padding: 2px; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-rich { position: relative; min-height: 57px; padding: 10px 34px 10px 12px !important; border: 1px solid transparent !important; border-radius: 9px !important; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-rich:hover:not(:disabled) { background: var(--ref-bg-2) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-rich.active { background: var(--refine-soft) !important; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-copy { gap: 3px; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-copy strong { font-size: 13px !important; font-weight: 600; }
.reference-ui-shell #referenceComposerSettingsPanel .model-option-copy small { font-size: 11px !important; line-height: 1.5; color: var(--ref-muted); }
.reference-ui-shell #referenceComposerSettingsPanel .model-availability-dot { width: 6px; height: 6px; box-shadow: none; }

/* Image ratios share the same three-column rhythm as video ratios. */
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel #imageRatioChoices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel #imageRatioChoices button { position: relative; min-height: 103px; border-radius: 10px; gap: 5px; background: var(--ref-bg-2); }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel #imageRatioChoices button[aria-pressed="true"] { border-color: var(--ref-primary); color: var(--ref-primary); background: var(--refine-soft); }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-picker { gap: 10px !important; }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-channel-tabs { padding-bottom: 10px; gap: 4px !important; }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-channel-tab { padding: 7px 10px !important; min-height: 32px !important; font-size: 11px !important; border-radius: 7px !important; }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-card { min-height: 57px !important; border-color: transparent !important; background: transparent !important; border-radius: 9px !important; }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-card.active { background: var(--refine-soft) !important; }
.reference-ui-shell #workspace[data-creation-type="image"] #referenceComposerSettingsPanel .image-model-card:hover:not(:disabled) { background: var(--ref-bg-2) !important; }

.reference-ui-shell #referenceComposerSettingsPanel :is(.direct-choice,.ref-card,.model-option-rich,.image-model-card):disabled { opacity: .45 !important; cursor: not-allowed !important; box-shadow: none !important; }
.reference-ui-shell #referenceComposerSettingsPanel :is(button,input):focus-visible { outline: 2px solid var(--refine-focus) !important; outline-offset: 2px !important; }
@media (max-width: 700px) {
  .reference-ui-shell #referenceComposerSettingsPanel > header { padding: 14px 14px 11px !important; }
  .reference-ui-shell #referenceComposerSettingsPanel .reference-composer-settings-body { padding: 0 14px 14px !important; }
  .reference-ui-shell #referenceComposerSettingsPanel .direct-choices-quality .direct-choice { min-height: 88px; }
  .reference-ui-shell #referenceComposerSettingsPanel .model-channel-tabs { flex-wrap: wrap; }
  .reference-ui-shell #referenceComposerSettingsPanel .model-channel-tab { flex: 1 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .reference-ui-shell #referenceComposerSettingsPanel, .reference-ui-shell #referenceComposerSettingsPanel * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
