/* Feature-modal shell (docs/architecture/03 → Layer 3). Sits below the confirm
   layer (z 1000) so a discard prompt can appear above an open modal. */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgb(0 0 0 / 0.5);
}

.modal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--layer-01);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.3);
  /* Modal chrome sits on --layer-01, so ghost/secondary controls in the header
     step their hover fill up, and fields step their fill off this surface
     (arch 09 §4). The body resets to --bg below. */
  --control-hover-fill: var(--layer-02);
  --field: var(--field-02);
  --field-hover: var(--field-hover-02);
}

/* Large: the two-pane managers (Datasets). Definite height so inner panes scroll. */
.large {
  width: min(960px, 94vw);
  height: min(700px, 88vh);
}

/* Extra-large: the Chart Builder — a work surface (config + a chart that wants room),
   with nothing useful behind it. Near-fullscreen, capped so it doesn't stretch absurdly
   on ultra-wide displays. Definite height so its panes scroll internally (not the modal). */
.xlarge {
  width: min(1800px, 96vw);
  height: min(1100px, 92vh);
}

/* Small: single-form modals (Extract). Grows with content up to a cap. */
.small {
  width: min(560px, 92vw);
  max-height: 88vh;
}

.header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: var(--header-height);
  padding: 0 var(--space-5);
  border-bottom: var(--border-width) solid var(--border);
}

.title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* The title is only a programmatic focus target (large-manager initial focus);
   it shouldn't paint a ring the way a keyboard-reached control would. */
.title:focus {
  outline: none;
}

/* The close affordance is the shared IconButton. */

/* The modal body. Background steps to --bg so the panes read as the work surface
   against the --layer-01 chrome. Fills the remaining height; inner content scrolls. */
.body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
  --control-hover-fill: var(--layer-01);
  --field: var(--field-01);
  --field-hover: var(--field-hover-01);
}
