/*
 * A report page is built from this fragment rather than from bare `.fs-page`
 * children, so the distance between its canonical blocks is set here. It reads
 * the same token as the shell: the two must not carry separate numbers.
 */
.fs-report-page {
  display: grid;
  gap: var(--fs-page-gap);
}

.fs-report-page__header,
.fs-report-page__header-side,
.fs-report-page__query-form,
.fs-report-page__query-fields,
.fs-report-page__query-actions,
.fs-report-page__metadata {
  display: flex;
  align-items: center;
}

/*
 * The title block is as tall as its heading, not a padded box around it: the
 * page name costs one row, and the space goes to the data below.
 */
.fs-report-page__header {
  justify-content: space-between;
  gap: var(--fs-space-4);
  padding: 4px var(--fs-space-4);
}

.fs-report-page__header-side,
.fs-report-page__query-actions {
  gap: var(--fs-space-2);
}

.fs-report-page__query-actions {
  margin-left: auto;
}

.fs-report-page__query {
  background-color: var(--fs-color-panel-query);
}

.fs-report-page__query-message {
  flex-basis: 100%;
  margin: 0;
  color: var(--fs-color-text-secondary);
  font-size: var(--fs-text-xs);
}

.fs-report-page__query-message--error {
  color: var(--fs-color-danger-text);
}

.fs-report-page__query-form {
  align-items: end;
  flex-wrap: wrap;
  gap: var(--fs-space-3);
}

.fs-report-page__query-fields {
  align-items: end;
  flex-wrap: wrap;
  gap: var(--fs-space-3);
}

.fs-report-page__query-fields > * {
  min-width: 200px;
}

.fs-report-page__summary {
  display: grid;
  gap: var(--fs-space-3);
}

/* Filters are operated, so they share the recessed tone with the query panel. */
.fs-report-page__controls {
  background: var(--fs-color-panel-filter);
}

.fs-report-page__metadata {
  justify-content: space-between;
  gap: var(--fs-space-3);
  padding: 0 var(--fs-space-1);
  color: var(--fs-color-text-muted);
  font-size: var(--fs-text-sm);
}

.fs-user-picker {
  position: relative;
}

/* Flex, not block: like `.fs-field__label` it may carry an icon before the name. */
.fs-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--fs-space-2);
  color: var(--fs-color-text-secondary);
  font-size: var(--fs-text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fs-user-picker__dropdown {
  position: relative;
}

.fs-user-picker__dropdown > summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--fs-control-height);
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--fs-color-border);
  border-radius: var(--fs-radius-md);
  background: var(--fs-color-field);
  font-size: var(--fs-text-sm);
  cursor: pointer;
  list-style: none;
}

.fs-user-picker__dropdown > summary::-webkit-details-marker {
  display: none;
}

.fs-user-picker__dropdown > summary:hover {
  border-color: var(--fs-color-primary-line);
}

.fs-user-picker__dropdown > summary:focus-visible {
  outline: 0;
  border-color: var(--fs-color-primary);
  box-shadow: var(--fs-focus-ring);
}

/* Drawn, not typed: the "⌄" glyph sits off-centre and changes with the font. */
.fs-user-picker__dropdown > summary::after {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1.5px solid var(--fs-color-text-muted);
  border-bottom: 1.5px solid var(--fs-color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
  content: "";
}

.fs-user-picker__dropdown[open] > summary::after {
  margin-top: -1px;
  transform: rotate(225deg);
}

.fs-user-picker__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  width: min(440px, 90vw);
  max-height: 300px;
  overflow: auto;
  padding: var(--fs-space-2);
  border: 1px solid var(--fs-color-border);
  border-radius: var(--fs-radius-md);
  background: var(--fs-color-surface);
  box-shadow: var(--fs-shadow-md);
}

.fs-user-picker__panel label {
  display: flex;
  gap: var(--fs-space-2);
  align-items: center;
  padding: var(--fs-space-2);
  border-radius: var(--fs-radius-sm);
  font-size: var(--fs-text-sm);
}

.fs-user-picker__panel label:hover {
  background: var(--fs-color-surface-hover);
}

.fs-user-picker__toolbar {
  display: flex;
  gap: var(--fs-space-1);
  padding: 2px 2px var(--fs-space-2);
  border-bottom: 1px solid var(--fs-color-border-subtle);
}

.fs-user-picker__toolbar button {
  padding: 5px 8px;
  border: 0;
  border-radius: var(--fs-radius-sm);
  background: transparent;
  color: var(--fs-color-primary-text);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-text-sm);
  font-weight: 500;
}

.fs-user-picker__toolbar button:hover {
  background: var(--fs-color-surface-hover);
}

@media (max-width: 760px) {
  .fs-report-page__header,
  .fs-report-page__query-form,
  .fs-report-page__query-fields,
  .fs-report-page__metadata {
    align-items: stretch;
    flex-direction: column;
  }

  .fs-report-page__header-side,
  .fs-report-page__query-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .fs-report-page__query-actions {
    width: auto;
    margin-left: 0;
    align-self: flex-end;
  }

  .fs-report-page__query-fields > * {
    min-width: 0;
    width: 100%;
  }
}
