/* Assessment inspector → Review tab. */

.review-ingredients {
  container: review / inline-size;
}

/* Reading copy and fields use the pane's full width here. */
.review-tab .ui-paragraph {
  max-width: none;
}

.review-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.review-toolbar > * {
  flex-wrap: wrap;
}

/* Filter chips stay together: FieldActions pins its last child right, which
   split «Not allowed» / «Remove from assessment» off the rest of their row. */
.review-chips .field-actions > :last-child {
  margin-left: 0;
}

.review-row__name {
  min-width: 7rem;
}

/* The catalog badge sits in its own column, or under the name when narrow. */
.review-row__badge {
  display: none;
  margin-top: 2px;
}
@container review (max-width: 600px) {
  .review-col-status {
    display: none;
  }
  .review-row__badge {
    display: block;
  }
}

.review-row__verdict {
  width: 1%;
  white-space: nowrap;
}

/* One control, four segments. Each segment is a light tint of its colour
   until pressed, then the full colour. */
.verdict-seg {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-sm);
  overflow: hidden;
  vertical-align: middle;
}

.verdict-seg__btn {
  --c: var(--success);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 3px 9px;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--c) 30%, var(--border-outer));
  background: color-mix(in srgb, var(--c) 10%, var(--bg-elevated));
  color: color-mix(in srgb, var(--c) 75%, var(--text));
  font: inherit;
  font-size: 0.75rem;
  line-height: 1rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.verdict-seg__btn:first-child {
  border-left: 0;
}
.verdict-seg__btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--c) 22%, var(--bg-elevated));
}
.verdict-seg__btn:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: -2px;
}
.verdict-seg__btn[aria-pressed="true"] {
  background: var(--c);
  color: #fff;
  font-weight: 600;
}
.verdict-seg__btn:disabled {
  cursor: default;
}
.verdict-seg__btn:disabled:not([aria-pressed="true"]) {
  opacity: 0.45;
}
/* Assist's proposal: outlined in its colour until accepted. */
.verdict-seg__btn[data-proposed="true"]:not([aria-pressed="true"]) {
  box-shadow: inset 0 0 0 2px var(--c);
}

.verdict-seg__btn--approve {
  --c: var(--success);
}
.verdict-seg__btn--clarify {
  --c: var(--caution);
}
.verdict-seg__btn--name {
  --c: var(--accent-strong);
}
.verdict-seg__btn--reject {
  --c: var(--danger);
}
.verdict-seg__btn--remove {
  --c: #64748b;
}

.verdict-seg__icon {
  display: none;
}

/* Narrow pane: icons only. */
@container review (max-width: 760px) {
  .verdict-seg__label {
    display: none;
  }
  .verdict-seg__icon {
    display: inline-flex;
  }
  .verdict-seg__btn {
    padding: 4px 8px;
  }
}

/* Products-step review of automated ingredient repairs.
   The list scrolls on its own so the actions stay put. The dialog body can
   still scroll on a short window so the buttons are never clipped. */
.modal[data-testid="intake-review"] .modal__body {
  min-height: 0;
}

.modal[data-testid="intake-review"] .ui-paragraph {
  max-width: none;
}

.intake-review__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.intake-review__links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Bottom fade while the change list can still scroll. */
.intake-review__list-frame {
  position: relative;
  min-height: 0;
}

.intake-review__fade {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(2 * var(--row-h));
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--bg-elevated) 80%, transparent) 42%,
    var(--bg-elevated)
  );
}

.intake-review__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  max-height: min(40vh, 24rem);
  overflow: auto;
  padding-right: var(--space-1);
}

.modal[data-testid="intake-review"] .modal__actions {
  flex: 0 0 auto;
}

.intake-review__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.intake-review__product {
  font-size: 0.8em;
  font-weight: 500;
  padding: 0 var(--space-1);
}

.intake-review__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--row-h);
  padding: 0 var(--space-2);
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-md, 6px);
  cursor: pointer;
}

.intake-review__reason {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 0.8em;
  padding: 0 0.5em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  white-space: nowrap;
}

.intake-review__diff {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

.intake-review__to {
  font-weight: 600;
}

/* Dictionary lookup: a box in the toolbar whose results panel drops under it
   and is capped (inline max-height) at the window's bottom edge. */
.review-lookup {
  position: relative;
  flex: 1 1 calc(80 * var(--u));
  max-width: calc(140 * var(--u));
}
/* Strong, visible edge on the box itself. */
.review-lookup input {
  border: 1.5px solid color-mix(in srgb, currentColor 55%, transparent) !important;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated) !important;
  box-shadow: 0 1px 2px color-mix(in srgb, black 14%, transparent);
}
.review-lookup input:focus {
  border-color: currentColor !important;
  outline: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  outline-offset: 1px;
}
.review-lookup__panel {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  width: max(100%, calc(140 * var(--u)));
  max-width: calc(100vw - 16 * var(--u));
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1.5px solid color-mix(in srgb, currentColor 55%, transparent);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: 0 calc(2 * var(--u)) calc(10 * var(--u)) color-mix(in srgb, black 24%, transparent);
  outline: none;
}
.review-lookup__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.review-lookup__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-outer);
}
.review-lookup__item:last-child {
  border-bottom: 0;
}
.review-lookup__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.review-lookup__name {
  overflow-wrap: anywhere;
}
.review-lookup__empty {
  padding: var(--space-2);
}
