.fh-experiment-backdrop { --experiment-bg: #fff; --experiment-fg: #202124; --experiment-muted: #62656c; --experiment-line: #dce0e6; --experiment-chip: #f4f6f8; position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0008; color: var(--experiment-fg); }
.dark .fh-experiment-backdrop { --experiment-bg: #1d2128; --experiment-fg: #edf0f5; --experiment-muted: #b4bdca; --experiment-line: #434b58; --experiment-chip: #2a3039; color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not(.light):not(.dark) .fh-experiment-backdrop { --experiment-bg: #1d2128; --experiment-fg: #edf0f5; --experiment-muted: #b4bdca; --experiment-line: #434b58; --experiment-chip: #2a3039; color-scheme: dark; } }
.fh-experiment-dialog { box-sizing: border-box; min-width: 0; width: min(1500px, 100%); max-height: 92vh; overflow: auto; padding: 24px; background: var(--experiment-bg); border: 1px solid var(--experiment-line); border-radius: 14px; box-shadow: 0 20px 80px #0005; font-size: 14px; line-height: 1.5; word-break: keep-all; overflow-wrap: normal; }
.fh-experiment-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.fh-experiment-dialog h2 { margin: 0; font-size: 22px; font-weight: 650; }
.fh-experiment-dialog h3 { font-size: 15px; font-weight: 650; }
.fh-experiment-dialog p { margin: 10px 0; color: var(--experiment-muted); white-space: normal; }
.fh-experiment-dialog form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 18px 0; }
.fh-experiment-dialog label { display: flex; flex-direction: column; gap: 4px; }
.fh-experiment-dialog input, .fh-experiment-dialog select, .fh-experiment-dialog button { border: 1px solid var(--experiment-line); border-radius: 6px; background: var(--experiment-bg); color: var(--experiment-fg); padding: 7px 10px; font: inherit; }
.fh-experiment-dialog input { width: 170px; }
.fh-experiment-dialog input[type="datetime-local"] { width: 210px; }
.fh-experiment-dialog button { cursor: pointer; }
.fh-experiment-dialog button:disabled { opacity: .5; cursor: default; }
.fh-experiment-dialog :focus-visible { outline: 2px solid #3878e4; outline-offset: 2px; }
.fh-experiment-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.fh-experiment-summary > div { flex: 1 1 150px; min-width: 0; padding: 12px 14px; background: var(--experiment-chip); border-radius: 8px; }
.fh-experiment-summary dt { color: var(--experiment-muted); white-space: nowrap; }
.fh-experiment-summary dd { white-space: nowrap; overflow-x: auto; font-size: 22px; font-weight: 600; margin: 3px 0 0; }
.fh-experiment-summary .fh-experiment-cost-card { flex-basis: 250px; }
.fh-experiment-summary .fh-experiment-cost-status { display: block; font-size: 14px; font-weight: 400; }
.fh-experiment-summary > p { width: 100%; }
.fh-experiment-scroll { max-width: 100%; overflow-x: auto; }
.fh-experiment-dialog table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fh-experiment-dialog caption { text-align: left; font-weight: 600; padding: 8px 0; }
.fh-experiment-dialog th, .fh-experiment-dialog td { padding: 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--experiment-line); }
.fh-experiment-dialog th { white-space: nowrap; color: var(--experiment-muted); }
.fh-experiment-dialog td { min-width: 90px; }
.fh-experiment-dialog td:first-child { min-width: 170px; }
.fh-experiment-dialog [data-fh-experiment="query-row"] > td, .fh-experiment-dialog [data-fh-experiment="query-row"] button { white-space: nowrap; }
.fh-experiment-dialog td button { text-align: left; }
.fh-experiment-dialog ol { list-style: decimal; padding-left: 28px; }
.fh-experiment-dialog li { padding: 10px 14px; margin: 10px 0; border: 1px solid var(--experiment-line); border-radius: 8px; }
.fh-experiment-dialog li dl { display: grid; grid-template-columns: minmax(160px, auto) minmax(0, 1fr); gap: 4px 20px; }
.fh-experiment-dialog li dd { margin: 0; }
.fh-experiment-dialog nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding-top: 16px; }
.fh-experiment-dialog [hidden] { display: none !important; }
@media (max-width: 640px) { .fh-experiment-backdrop { padding: 8px; } .fh-experiment-dialog { padding: 16px; max-height: 96vh; } .fh-experiment-dialog label { flex: 1 1 160px; min-width: 0; } .fh-experiment-dialog input, .fh-experiment-dialog select { box-sizing: border-box; min-width: 0; width: 100%; } .fh-experiment-dialog input[type="datetime-local"] { width: 100%; } .fh-experiment-summary [data-fh-experiment="summary-cost"] { font-size: 18px; } }

@media (max-width: 640px) { .fh-experiment-dialog li dl { grid-template-columns: 1fr; gap: 4px; } .fh-experiment-dialog li dd { margin-bottom: 8px; } }

.fh-experiment-dialog nav { justify-content: flex-start; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
.fh-experiment-dialog nav button[aria-pressed="true"] { background: #1f5a9c; color: white; border-color: #1f5a9c; }
.fh-experiment-dialog input[type="checkbox"] { width: 22px; height: 22px; }
.fh-experiment-dialog td code { display: block; overflow-wrap: anywhere; }
.fh-experiment-dialog td p { margin: 4px 0; }
.fh-experiment-dialog td select { min-width: 175px; }
.fh-experiment-dialog td button { margin: 4px; }
.fh-experiment-summary { display: block; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--experiment-line); }

/* Model-management-only controls; shared API usage layouts stay unchanged. */
.fh-experiment-person-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.fh-experiment-person-filter select { max-width: 300px; }
.fh-experiment-dialog [data-fh-experiment="config-form"] { align-items: start; }
.fh-experiment-dialog [data-fh-experiment="config-form"] small { max-width: 240px; color: var(--experiment-muted); }
.fh-experiment-dialog [data-fh-experiment="accounts"] details,
.fh-experiment-dialog [data-fh-experiment="feedback-groups"] details { max-width: 240px; }
.fh-experiment-dialog [data-fh-experiment="accounts"] summary,
.fh-experiment-dialog [data-fh-experiment="feedback-groups"] summary { cursor: pointer; color: var(--experiment-muted); }
.fh-experiment-dialog [data-fh-experiment="accounts"] details p,
.fh-experiment-dialog [data-fh-experiment="feedback-groups"] details p { margin: 6px 0 0; }

.fh-model-management .fh-experiment-person-filter { flex: 1 1 100%; min-width: 0; }
.fh-model-management .fh-experiment-person-filter label { flex: 1 1 210px; min-width: 0; }
.fh-model-management .fh-experiment-person-filter input,
.fh-model-management .fh-experiment-person-filter select { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }
.fh-model-management .fh-model-table td { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .fh-model-management .fh-model-table,
  .fh-model-management .fh-model-table tbody { display: block; }
  .fh-model-management .fh-model-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .fh-model-management .fh-model-table tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; margin: 12px 0; padding: 14px; border: 1px solid var(--experiment-line); border-radius: 8px; }
  .fh-model-management .fh-model-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .fh-model-management .fh-model-table td::before { display: block; content: attr(data-label); margin-bottom: 4px; color: var(--experiment-muted); font-weight: 600; }
  .fh-model-management .fh-model-table td[colspan],
  .fh-model-management [data-fh-experiment="accounts"] td:first-child { grid-column: 1 / -1; }
  .fh-model-management .fh-model-table td select,
  .fh-model-management .fh-model-table td button { box-sizing: border-box; min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .fh-model-management .fh-model-table td select { width: 100%; }
  .fh-model-management .fh-model-table td button { margin-left: 0; }
}
@media (max-width: 480px) {
  .fh-model-management .fh-model-table tbody > tr { grid-template-columns: minmax(0, 1fr); }
}

.fh-model-management .fh-model-headcounts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; }
.fh-model-management .fh-model-headcounts dt { color: var(--experiment-muted); }
.fh-model-management .fh-model-headcounts dd { margin: 0; }
.fh-model-management .fh-model-tabs { flex-wrap: nowrap; gap: 0; padding: 12px 0 0; margin-bottom: 18px; border-bottom: 1px solid var(--experiment-line); }
.fh-model-management .fh-model-tabs [role="tab"] { flex: 1 1 0; min-width: 0; border: 0; border-bottom: 3px solid transparent; border-radius: 0; margin-bottom: -1px; padding: 12px 8px; background: transparent; color: var(--experiment-muted); white-space: nowrap; }
.fh-model-management .fh-model-tabs [role="tab"][aria-selected="true"] { border-bottom-color: #3878e4; color: var(--experiment-fg); font-weight: 650; }
.fh-model-management .fh-model-tabs [role="tab"]:hover { background: var(--experiment-chip); }
.fh-model-management .fh-model-period { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.fh-model-management .fh-model-period > strong { flex-basis: 100%; font-weight: 600; }

.fh-model-management .fh-model-current { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fh-model-management .fh-model-current > button { margin: 0; }
.fh-model-management .fh-model-access-menu { display: flex; flex-direction: column; flex-basis: 100%; align-items: stretch; max-width: 240px; padding: 4px; border: 1px solid var(--experiment-line); border-radius: 8px; background: var(--experiment-bg); box-shadow: 0 4px 12px #0002; }
.fh-model-management .fh-model-access-menu > button { margin: 0; border: 0; padding: 8px 10px; text-align: left; }
.fh-model-management .fh-model-access-menu > button:hover,
.fh-model-management .fh-model-access-menu > button:focus { background: var(--experiment-chip); }
.fh-model-management .fh-model-access-menu > button::before { content: ""; display: inline-block; width: 1.25em; }
.fh-model-management .fh-model-access-menu > button[aria-checked="true"]::before { content: "\2713"; content: "\2713" / ""; }
.fh-model-access-backdrop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: #0005; }
.fh-model-access-dialog { width: min(480px, 100%); padding: 24px; }
.fh-model-access-dialog h2 { font-size: 19px; }
.fh-model-access-dialog [id="fh-model-access-person"] { overflow-wrap: anywhere; }
.fh-model-access-dialog [id="fh-model-access-person"] > span { display: block; }
.fh-model-access-dialog .fh-model-access-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.fh-model-access-dialog [data-fh-experiment="access-confirm"] { background: #1f5a9c; color: white; border-color: #1f5a9c; }

/* The server decides whether this compact composer control exists. */
.fh-model-composer { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: 8px; }
/* Same outline and chevron as the source group headings under answers, with the chevron kept on the right. */
.fh-model-composer select { -webkit-appearance: none; appearance: none; max-width: 185px; min-width: 0; padding: 0.28rem 1.75rem 0.28rem 0.6rem; border: 1px solid var(--border-medium, #cdc4b2); border-radius: 8px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239a8d70' d='M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z'/%3E%3C/svg%3E") no-repeat right 0.35rem center / 18px 18px;
  color: var(--text-secondary, #625c55); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
/* Browsers that draw the option list inside the page take its colors from here, so dark mode needs them set. */
.fh-model-composer select option { background-color: var(--surface-chat, #fbf9f4); color: var(--text-primary, #14110d); }
.fh-model-composer select:disabled { opacity: .6; cursor: default; }
.fh-model-composer [role="status"] { font-size: 12px; max-width: 220px; }
.fh-model-composer [role="status"]:empty { display: none; }
.fh-model-composer button { font-size: 12px; text-decoration: underline; white-space: nowrap; }
.fh-model-composer :focus-visible { outline: 2px solid #3878e4; outline-offset: 2px; }
@media (max-width: 640px) { .fh-model-composer { gap: 4px; margin-left: 4px; flex-wrap: wrap; } .fh-model-composer select { max-width: 155px; } .fh-model-composer [role="status"] { max-width: 150px; } }

.fh-model-management .fh-model-rating-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0; margin: 16px 0 24px; background: transparent; }
.fh-model-rating-cards article { padding: 14px 18px; border: 1px solid var(--experiment-line); border-radius: 8px; background: var(--experiment-chip); }
.fh-model-rating-cards h4 { margin: 0; font-size: 14px; font-weight: 600; }
.fh-model-rating-cards .fh-model-rating-rate { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.fh-model-rating-rate strong { font-size: 24px; font-weight: 650; color: var(--experiment-fg); }
.fh-model-rating-cards .fh-model-rating-count { margin: 0; font-size: 13px; }
.fh-model-rating-pair { display: flex; flex-wrap: wrap; gap: 4px 48px; }
.fh-model-rating-pair > div { flex: 0 1 auto; min-width: 0; }
@media (max-width: 480px) { .fh-model-management .fh-model-rating-cards { grid-template-columns: 1fr; } }

/* Download of the four tabs: the button beside the title and its period dialog. */
.fh-model-management .fh-model-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.fh-model-management .fh-model-download,
.fh-model-export-dialog .fh-model-export-confirm { display: inline-flex; align-items: center; gap: 6px; }
.fh-model-management .fh-model-download > span:first-child { display: inline-flex; }
.fh-model-export-dialog { width: min(520px, 100%); }
.fh-model-export-dialog .fh-model-period { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fh-model-export-dialog .fh-model-period > strong { font-weight: 600; }
.fh-model-export-dialog input[type="datetime-local"] { width: 220px; max-width: 100%; box-sizing: border-box; }
.fh-model-export-dialog ul { margin: 12px 0 0; padding-left: 18px; color: var(--experiment-muted); list-style: disc; }
.fh-model-export-dialog li { margin: 2px 0; padding: 0; border: 0; border-radius: 0; }
.fh-model-export-dialog .fh-model-export-confirm { background: #1f5a9c; color: white; border-color: #1f5a9c; }
.fh-model-export-dialog .fh-model-export-confirm:disabled { opacity: 1; }
.fh-model-spin { box-sizing: border-box; width: 14px; height: 14px; border: 2px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: fh-model-spin .7s linear infinite; }
@keyframes fh-model-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fh-model-spin { animation-duration: 2s; } }
