.advanced-operations {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) + 0.25rem);
  background: var(--toolbox-surface);
  color: var(--toolbox-text);
  box-shadow: 0 8px 25px rgb(24 34 68 / 5%);
}

.advanced-operations *,
.advanced-operations *::before,
.advanced-operations *::after {
  box-sizing: border-box;
}

.advanced-operations h2,
.advanced-operations h3,
.advanced-operations h4,
.advanced-operations p {
  margin-block-start: 0;
}

.advanced-operations__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--toolbox-border);
}

.advanced-operations__header h2 {
  margin-block-end: 0.28rem;
  font-size: 1.05rem;
}

.advanced-operations__header p:not(.advanced-operations__eyebrow) {
  max-width: 50rem;
  margin-block-end: 0;
  color: var(--toolbox-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.advanced-operations__eyebrow {
  margin-block-end: 0.25rem;
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.advanced-operations__local {
  flex: none;
  padding: 0.45rem 0.65rem;
  border: 1px solid
    color-mix(
      in srgb,
      var(--toolbox-success, #2f8f5b) 34%,
      var(--toolbox-border)
    );
  border-radius: 999px;
  background: color-mix(
    in srgb,
    var(--toolbox-success, #2f8f5b) 8%,
    var(--toolbox-surface)
  );
  color: var(--toolbox-success, #2f8f5b);
  font-size: 0.68rem;
  font-weight: 800;
}

.advanced-operations__tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.45rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--toolbox-border);
  background: var(--toolbox-surface-soft);
  scrollbar-width: thin;
}

.advanced-operations__tabs button {
  min-height: 2.35rem;
  flex: 1 0 auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid transparent;
  border-radius: calc(var(--toolbox-radius) - 0.12rem);
  background: transparent;
  color: var(--toolbox-muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 760;
  white-space: nowrap;
}

.advanced-operations__tabs button[aria-selected='true'] {
  border-color: var(--toolbox-border);
  background: var(--toolbox-surface);
  color: var(--toolbox-accent);
  box-shadow: 0 2px 8px rgb(24 34 68 / 8%);
}

.advanced-operations__tab-short {
  display: none;
}

.advanced-operations__panel {
  padding: 1rem;
}

.advanced-operations__panel[hidden] {
  display: none;
}

.advanced-operations__section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 1rem;
}

.advanced-operations__stack {
  display: grid;
  gap: 1rem;
}

.advanced-operation-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--toolbox-border);
  border-radius: var(--toolbox-radius);
  background: color-mix(
    in srgb,
    var(--toolbox-surface) 94%,
    var(--toolbox-background)
  );
}

.advanced-operation-card--wide {
  grid-column: 1 / -1;
}

.advanced-operation-card > header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-block-end: 1rem;
}

.advanced-operation-card > header h3 {
  margin: 0 0 0.2rem;
  font-size: 0.87rem;
}

.advanced-operation-card > header p {
  max-width: 48rem;
  margin-block-end: 0;
  color: var(--toolbox-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.advanced-operation-card > h4 {
  margin: 1.2rem 0 0.65rem;
  color: var(--toolbox-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.advanced-operation-card__step {
  width: 1.8rem;
  height: 1.8rem;
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--toolbox-accent-soft);
  color: var(--toolbox-accent);
  font-size: 0.72rem;
  font-weight: 850;
}

.advanced-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-block-end: 0.85rem;
}

.advanced-form-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.advanced-form-grid--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.advanced-field,
.advanced-file-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0.34rem;
  margin-block-end: 0.85rem;
  color: var(--toolbox-text);
  font-size: 0.7rem;
  font-weight: 740;
}

.advanced-field > span:first-child,
.advanced-file-field > span:first-child {
  min-height: 1rem;
}

.advanced-field > span small {
  color: var(--toolbox-muted);
  font-weight: 650;
}

.advanced-field input,
.advanced-field select,
.advanced-file-field input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.48rem 0.62rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.14rem);
  background: var(--toolbox-surface);
  color: var(--toolbox-text);
  font: inherit;
  font-weight: 620;
}

.advanced-field input:focus-visible,
.advanced-field select:focus-visible,
.advanced-file-field input:focus-visible,
.advanced-operations button:focus-visible {
  outline: 3px solid var(--toolbox-focus);
  outline-offset: 2px;
}

.advanced-field > small,
.advanced-file-field > small {
  color: var(--toolbox-muted);
  font-size: 0.64rem;
  font-weight: 580;
  line-height: 1.4;
}

.advanced-field--color > span:last-child {
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.5rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.14rem);
  background: var(--toolbox-surface);
}

.advanced-field--color input {
  width: 2rem;
  min-height: 1.75rem;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.advanced-field--color code {
  color: var(--toolbox-muted);
  font-size: 0.68rem;
}

.advanced-inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.6rem;
}

.advanced-inline-fields .advanced-button {
  margin-block-end: 0.85rem;
}

.advanced-choice-cards {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  padding: 0;
  border: 0;
}

.advanced-choice-cards label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.72rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.12rem);
  background: var(--toolbox-surface);
  cursor: pointer;
}

.advanced-choice-cards label:has(input:checked) {
  border-color: color-mix(
    in srgb,
    var(--toolbox-accent) 48%,
    var(--toolbox-border)
  );
  background: var(--toolbox-accent-soft);
}

.advanced-choice-cards input {
  margin-block-start: 0.15rem;
  accent-color: var(--toolbox-accent);
}

.advanced-choice-cards span,
.advanced-choice-cards strong,
.advanced-choice-cards small {
  display: block;
}

.advanced-choice-cards strong {
  margin-block-end: 0.18rem;
  font-size: 0.74rem;
}

.advanced-choice-cards small {
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  line-height: 1.4;
}

.advanced-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-block-end: 0.9rem;
}

.advanced-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.2rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.14rem);
  background: var(--toolbox-surface);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 680;
}

.advanced-check input {
  accent-color: var(--toolbox-accent);
}

.advanced-stream-metadata {
  display: grid;
  gap: 0.7rem;
  margin-block: 0.85rem;
}

.advanced-stream-metadata fieldset {
  min-width: 0;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.08rem);
  background: var(--toolbox-surface-soft);
}

.advanced-stream-metadata legend {
  padding-inline: 0.35rem;
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  font-weight: 780;
}

.advanced-disposition-details {
  border-block-start: 1px solid var(--toolbox-border);
  padding-block-start: 0.55rem;
}

.advanced-disposition-details summary {
  cursor: pointer;
  color: var(--toolbox-muted);
  font-size: 0.65rem;
  font-weight: 720;
}

.advanced-disposition-details .advanced-check-grid {
  margin-block: 0.65rem 0;
}

.advanced-button,
.advanced-file-button {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 0.82rem;
  border: 1px solid transparent;
  border-radius: var(--toolbox-radius);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 780;
  line-height: 1.1;
  text-align: center;
}

.advanced-button--primary {
  border-color: var(--toolbox-accent);
  background: var(--toolbox-accent);
  color: var(--toolbox-accent-contrast);
}

.advanced-button--primary:hover:not(:disabled) {
  border-color: var(--toolbox-accent-hover);
  background: var(--toolbox-accent-hover);
}

.advanced-button--secondary,
.advanced-file-button {
  border-color: var(--toolbox-border);
  background: var(--toolbox-surface);
  color: var(--toolbox-accent);
}

.advanced-button--secondary:hover:not(:disabled),
.advanced-file-button:hover {
  border-color: color-mix(
    in srgb,
    var(--toolbox-accent) 35%,
    var(--toolbox-border)
  );
  background: var(--toolbox-accent-soft);
}

.advanced-button--danger {
  border-color: color-mix(
    in srgb,
    var(--toolbox-danger) 35%,
    var(--toolbox-border)
  );
  background: color-mix(
    in srgb,
    var(--toolbox-danger) 8%,
    var(--toolbox-surface)
  );
  color: var(--toolbox-danger);
}

.advanced-button:disabled,
.advanced-file-button--disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.advanced-file-button {
  position: relative;
  overflow: hidden;
}

.advanced-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.advanced-action {
  min-width: min(100%, 13rem);
  display: grid;
  align-content: start;
  gap: 0.28rem;
}

.advanced-action .advanced-button {
  width: 100%;
}

.advanced-action__reason {
  max-width: 22rem;
  color: var(--toolbox-muted);
  font-size: 0.61rem;
  line-height: 1.35;
}

.advanced-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  margin-block-start: 0.85rem;
}

.advanced-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--toolbox-border);
}

.advanced-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0;
  list-style: none;
}

.advanced-chip-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.35rem 0.25rem 0.55rem;
  border: 1px solid var(--toolbox-border);
  border-radius: 999px;
  background: var(--toolbox-surface-soft);
  font-size: 0.67rem;
  font-weight: 700;
}

.advanced-chip-list button {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--toolbox-muted);
  cursor: pointer;
}

.advanced-chip-list button:hover {
  background: var(--toolbox-surface);
  color: var(--toolbox-danger);
}

.advanced-segment-list {
  display: grid;
  gap: 0.45rem;
  margin-block-end: 0.85rem;
}

.advanced-segment-list > strong {
  font-size: 0.67rem;
}

.advanced-segment-list ol,
.advanced-segment-status {
  max-height: 16rem;
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  scrollbar-width: thin;
}

.advanced-segment-list li,
.advanced-segment-status li {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) minmax(9rem, 1fr) minmax(
      7rem,
      0.8fr
    );
  gap: 0.55rem;
  align-items: center;
  padding: 0.48rem 0.58rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.18rem);
  background: var(--toolbox-surface-soft);
  font-size: 0.63rem;
  font-variant-numeric: tabular-nums;
}

.advanced-segment-list li span,
.advanced-segment-list li small,
.advanced-segment-status li span,
.advanced-segment-status li small {
  color: var(--toolbox-muted);
}

.advanced-segment-status {
  max-height: 20rem;
}

.advanced-segment-status li {
  grid-template-columns: minmax(10rem, 1fr) auto;
}

.advanced-segment-status li > div {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.advanced-segment-status li > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advanced-segment-status li > b {
  padding: 0.18rem 0.38rem;
  border-radius: 999px;
  background: var(--toolbox-accent-soft);
  color: var(--toolbox-accent);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.advanced-segment-status li > small {
  grid-column: 1 / -1;
  color: var(--toolbox-warning, #a96700);
  line-height: 1.4;
}

.advanced-segment-status--failed,
.advanced-segment-status--cancelled {
  border-color: color-mix(
    in srgb,
    var(--toolbox-danger) 35%,
    var(--toolbox-border)
  ) !important;
}

.advanced-summary,
.advanced-hint,
.advanced-empty,
.advanced-warning {
  margin-block-end: 0.8rem;
  padding: 0.58rem 0.68rem;
  border-radius: calc(var(--toolbox-radius) - 0.15rem);
  color: var(--toolbox-muted);
  font-size: 0.67rem;
  line-height: 1.45;
}

.advanced-summary,
.advanced-hint,
.advanced-empty {
  background: var(--toolbox-surface-soft);
}

.advanced-warning {
  border: 1px solid
    color-mix(
      in srgb,
      var(--toolbox-warning, #a96700) 28%,
      var(--toolbox-border)
    );
  background: color-mix(
    in srgb,
    var(--toolbox-warning, #a96700) 8%,
    var(--toolbox-surface)
  );
  color: color-mix(
    in srgb,
    var(--toolbox-warning, #a96700) 72%,
    var(--toolbox-text)
  );
}

.advanced-measurement {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.advanced-measurement div {
  min-width: 0;
  padding: 0.6rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.14rem);
  background: var(--toolbox-surface-soft);
}

.advanced-measurement dt {
  margin-block-end: 0.22rem;
  color: var(--toolbox-muted);
  font-size: 0.62rem;
}

.advanced-measurement dd {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 780;
}

.advanced-stream-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.advanced-stream-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.55rem;
  padding: 0.65rem;
  border: 1px solid var(--toolbox-border);
  border-radius: calc(var(--toolbox-radius) - 0.14rem);
  background: var(--toolbox-surface);
  font-size: 0.68rem;
}

.advanced-stream-list li > span {
  padding: 0.18rem 0.38rem;
  border-radius: 999px;
  background: var(--toolbox-surface-soft);
  color: var(--toolbox-muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
}

.advanced-stream-list small {
  grid-column: 1 / -1;
  color: var(--toolbox-muted);
}

.advanced-preset-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
}

.advanced-preset-toolbar .advanced-field {
  min-width: min(100%, 18rem);
  flex: 1;
  margin-block-end: 0;
}

.advanced-preset-toolbar .advanced-action {
  min-width: auto;
}

.advanced-operations__status {
  min-height: 1.25rem;
  padding: 0 1rem 0.7rem;
  color: var(--toolbox-muted);
  font-size: 0.68rem;
}

.advanced-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 64rem) {
  .advanced-operations__section-grid {
    grid-template-columns: 1fr;
  }

  .advanced-form-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-operations__tab-long {
    display: none;
  }

  .advanced-operations__tab-short {
    display: inline;
  }
}

@media (max-width: 40rem) {
  .advanced-operations__header {
    display: grid;
    gap: 0.75rem;
  }

  .advanced-operations__local {
    justify-self: start;
  }

  .advanced-operations__panel {
    padding: 0.7rem;
  }

  .advanced-operation-card {
    padding: 0.8rem;
  }

  .advanced-form-grid,
  .advanced-form-grid--three,
  .advanced-form-grid--four,
  .advanced-inline-fields,
  .advanced-measurement {
    grid-template-columns: 1fr;
  }

  .advanced-inline-fields .advanced-button {
    margin-block: -0.35rem 0.85rem;
  }

  .advanced-action,
  .advanced-action .advanced-button,
  .advanced-action-row > .advanced-button,
  .advanced-action-row > .advanced-file-button {
    width: 100%;
  }

  .advanced-segment-list li,
  .advanced-segment-status li {
    grid-template-columns: 1fr;
  }

  .advanced-segment-status li > b {
    justify-self: start;
  }

  .advanced-segment-status li > small {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .advanced-operations *,
  .advanced-operations *::before,
  .advanced-operations *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
