/* Edit-request workspaces (edit/ for editors, approve/ for approvers): lists
   beside a field-by-field comparison of the approved entry and the proposal.
   Builds on review.css. */

.edit-layout {
  grid-template-columns: 300px minmax(0, 1fr);
}

/* One window tall, like the review workspace, so the action buttons stay on screen. */
:where(html:not(.is-narrow)) .edit-layout {
  height: max(560px, calc(100vh / var(--site-zoom, 1) - 2rem));
}

/* ---------- Title bar figures ---------- */

.edit-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
}

.edit-stats:empty {
  display: none;
}

.edit-stat {
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.edit-stat strong {
  color: var(--text-default);
}

.edit-stat--reply {
  border-color: #f9dbaf;
  background: #fef6ee;
  color: #b93815;
}

.edit-stat--reply strong {
  color: #b93815;
}

/* ---------- Lists ---------- */

.queue-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0 0.75rem 0.6rem;
}

/* The side column is narrow: one list per row keeps every label whole. */
:where(html:not(.is-narrow)) .queue-nav {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

:where(html:not(.is-narrow)) .queue-nav__item {
  min-height: 2.25rem;
  padding-block: 0.3rem;
}

.queue-nav__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-default);
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.queue-nav__item:hover {
  border-color: var(--green-300);
}

.queue-nav__item[aria-pressed='true'] {
  border-color: var(--green-600);
  background: var(--green-50);
  box-shadow: 0 0 0 1px var(--green-600);
}

.queue-nav__label {
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-nav__count {
  flex-shrink: 0;
  min-width: 1.6rem;
  padding: 0 0.4rem;
  border-radius: var(--radius-full);
  background: var(--bg-neutral);
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-align: center;
}

.queue-nav__item[aria-pressed='true'] .queue-nav__count {
  background: var(--green-600);
  color: #fff;
}

.queue-options {
  display: grid;
  gap: 0.4rem;
}

.queue-options__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.25rem, 1fr));
  gap: 0.5rem;
}

.queue-options__toggle {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-option {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.queue-option__label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

/* Chips in list cards. */
.card-chip,
.outcome-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.6;
}

.card-chip--reply {
  background: #fef6ee;
  color: #b93815;
}

.card-chip--draft {
  background: var(--green-50);
  color: var(--green-600);
}

.card-chip--open {
  background: #fef0c7;
  color: var(--pending);
}

.card-chip--muted {
  background: var(--bg-neutral);
  color: var(--text-secondary);
}

.outcome-chip {
  background: var(--bg-neutral);
  color: var(--text-secondary);
}

.outcome-chip--approved {
  background: var(--success-bg);
  color: var(--success-text);
}

.outcome-chip--rejected {
  background: #fef3f2;
  color: var(--danger);
}

.list-more {
  display: block;
  margin: 0.75rem auto 0.25rem;
}

.list-note--error {
  color: var(--danger);
}

/* ---------- Header ---------- */

.request-head {
  margin-bottom: 0.75rem;
  border-color: var(--border);
}

/* On narrow screens the previous/next buttons and the meta items wrap rather than squeeze the name. */
.request-head .editor-head__title {
  flex-wrap: wrap;
}

.request-head .editor-head__title h2 {
  flex: 1 1 8rem;
}

.request-head__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 1rem;
  margin: 0;
  padding-inline-start: 1.6rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.request-head__meta .icon {
  flex-shrink: 0;
}

/* Each icon stays with its text when the line wraps. */
.request-head__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.entry-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline-start: auto;
  color: var(--text-secondary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.entry-nav__button {
  width: 2rem;
  height: 2rem;
}

.entry-nav__pos {
  min-width: 4.5rem;
  text-align: center;
}

.hint-banner--info {
  border-style: solid;
  border-color: #b2ddff;
  background: #eff8ff;
}

.hint-banner--warn {
  border-style: solid;
  border-color: #fedf89;
  background: #fffaeb;
}

.request-head__count {
  margin-inline-start: auto;
  color: var(--green-700);
  font-weight: 700;
}

.editor__scroll > .hint-banner,
.editor__scroll > .validation-banner {
  margin-bottom: 0.75rem;
}

.hint-banner > .btn {
  flex-shrink: 0;
}

/* ---------- Comparison ---------- */

.diff-columns,
.diff-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.diff-body {
  position: relative;
}

/* The column titles stay in view over the comparison only. */
.diff-columns {
  position: sticky;
  top: -0.75rem;
  z-index: 1;
  margin: 0 -0.75rem 0.25rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.diff-section {
  margin-bottom: 1rem;
}

.diff-section__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--green-50);
  color: var(--green-900);
  font-size: 0.9rem;
}

.diff-section__note {
  margin: 0 0 0.5rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.7;
}

.diff-section__note a {
  color: var(--green-600);
  font-weight: 700;
}

.diff-row {
  align-items: start;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--bg-neutral);
  border-radius: var(--radius-md);
}

.diff-row.is-changed {
  background: #fffaeb;
}

.diff-row.is-invalid {
  background: #fef3f2;
}

.diff-row--single {
  grid-template-columns: minmax(120px, 0.55fr) minmax(0, 2fr);
}

.diff-row__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.45rem;
  color: var(--text-default);
  font-weight: 700;
}

.diff-tag {
  padding: 0 0.45rem;
  border-radius: var(--radius-full);
  background: #fef0c7;
  color: var(--pending);
  font-size: 0.68rem;
  font-weight: 700;
}

.diff-cell {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

/* Captions repeat the column titles where the columns stack. */
.diff-cell__caption {
  display: none;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.diff-cell--current {
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  color: var(--text-paragraph);
  line-height: 1.8;
}

.diff-row--single .diff-cell--current {
  background: transparent;
  padding-inline: 0;
}

.diff-text {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.diff-empty {
  color: #9da4ae;
}

.diff-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diff-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  overflow-wrap: anywhere;
}

.diff-editor-list {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

.diff-editor-list .inline-item {
  width: 100%;
  align-items: flex-start;
}

.diff-editor-list .inline-item select.review-input {
  flex: 0 0 8.5rem;
}

.diff-media {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.diff-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 700;
}

.diff-none {
  margin-bottom: 1rem;
}

/* Values the approver changed, against the author's proposal. */
.diff-row.is-mine {
  background: var(--green-50);
  box-shadow: inset -3px 0 0 var(--green-600);
}

.diff-tag--conflict {
  background: #fef3f2;
  color: var(--danger);
}

.diff-tag--mine {
  background: var(--green-600);
  color: #fff;
}

.diff-row__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.9rem;
}

.diff-row__tools:not(:has(> :not([hidden]))) {
  display: none;
}

.diff-proposed-by {
  flex-basis: 100%;
  padding: 0.35rem 0.6rem;
  border: 1px dashed var(--green-300);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-paragraph);
  font-size: 0.8rem;
  line-height: 1.7;
}

.diff-proposed-by__label {
  display: block;
  color: var(--green-700);
  font-size: 0.72rem;
  font-weight: 700;
}

.link-button {
  padding: 0.15rem 0;
  border: 0;
  background: none;
  color: var(--green-600);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-button:hover {
  color: var(--green-700);
}

/* ---------- Comments ---------- */

.comments__list {
  display: grid;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.comment {
  max-width: 85%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-start-start-radius: 4px;
  background: var(--bg-white);
}

.comment--mine {
  justify-self: end;
  border-color: var(--enrichment-line);
  border-start-start-radius: 12px;
  border-start-end-radius: 4px;
  background: var(--enrichment-bg);
}

.comment__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
}

.comment__meta time {
  color: var(--text-secondary);
}

.comment__text {
  margin: 0;
  white-space: pre-line;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.comments__more {
  justify-self: center;
  margin-bottom: 0.6rem;
}

.comments__empty {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
}

.comments__form {
  display: grid;
  gap: 0.4rem;
}

.comments__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* The approver's note about a rewrite, set apart from the conversation. */
.comment--system {
  max-width: 100%;
  justify-self: stretch;
  border-style: dashed;
  border-color: var(--green-300);
  background: var(--bg-neutral);
}

/* ---------- History ---------- */

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

.history__item details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.history__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
}

.history__who {
  font-weight: 700;
}

.history__date,
.history__count {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.history__count {
  margin-inline-start: auto;
}

.history__comments {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
}

.history__item details > .comments__empty {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
}

/* What a past request proposed. */
.history__proposal {
  display: grid;
  justify-items: start;
  gap: 0.5rem;
  padding: 0 0.75rem 0.6rem;
}

.history__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.history__fields {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: 0.4rem 0.9rem;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-neutral);
  line-height: 1.8;
}

.history__fields {
  justify-self: stretch;
}

.history__used {
  color: var(--success-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.history__fields dt {
  color: var(--text-secondary);
  font-weight: 700;
}

.history__fields dd {
  display: grid;
  justify-items: start;
  gap: 0.2rem;
  min-width: 0;
  margin: 0;
}

.list-note--top {
  margin: 0 0.25rem 0.6rem;
  text-align: start;
}

/* ---------- Dialog text box ---------- */

.modal__field {
  display: grid;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  text-align: start;
}

.modal__field .review-input {
  width: 100%;
  resize: vertical;
}

/* ---------- Footer ---------- */

.btn--danger-outline,
.btn--danger-outline:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn--danger-outline:hover {
  background: #fef3f2;
}

.footer-status {
  color: var(--text-secondary);
  font-weight: 700;
}

/* ---------- Responsive ---------- */

:where(html.is-medium) .edit-layout {
  grid-template-columns: 260px minmax(0, 1fr);
}

:where(html.is-narrow) .review-tabs--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Each tab: a caption over what it shows (the list, the open entry). */
:where(html.is-narrow) .review-tabs--two .review-tabs__tab {
  display: grid;
  align-content: center;
  gap: 0.05rem;
  min-height: 54px;
  padding: 0.3rem 0.75rem;
  line-height: 1.35;
}

:where(html.is-narrow) .review-tabs--two .review-tabs__tab small {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
}

:where(html.is-narrow) .review-tabs--two .review-tabs__tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:where(html.is-narrow) .review-tabs--two .review-tabs__tab.is-empty:not([aria-selected='true']) span {
  color: var(--text-secondary);
  font-weight: 400;
}

:where(html.is-narrow) .edit-layout {
  grid-template-columns: minmax(0, 1fr);
}

/* Narrow editors stack the columns, each value under its caption. */
:where(html.is-le-900) .history__fields {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
}

:where(html.is-le-900) .history__fields dd + dt {
  margin-top: 0.4rem;
}

:where(html.is-le-900) .diff-columns {
  display: none;
}

:where(html.is-le-900) .diff-row,
:where(html.is-le-900) .diff-row--single {
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
}

:where(html.is-le-900) .diff-row__label {
  padding-top: 0;
}

:where(html.is-le-900) .diff-cell__caption {
  display: block;
}

:where(html.is-le-900) .comment {
  max-width: 100%;
}

/* Approver's pick (RNAB-23): move the request's changes into the version to approve. */
.pick-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--green-300);
  border-radius: var(--radius-md);
  background: var(--bg-white);
}

.pick-bar__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  color: var(--text-paragraph);
  font-size: 0.82rem;
}

.pick-bar__text strong {
  color: var(--green-700);
  font-size: 0.9rem;
}

.pick-move {
  align-self: flex-start;
  margin-top: 0.35rem;
}

.diff-tag--moved {
  background: var(--green-600);
  color: #fff;
}

.diff-tag--pending {
  background: var(--bg-neutral);
  color: var(--text-paragraph);
}
