/*
 * Write-back issue panels: the approval-check panel and the grouped issue
 * lines (writeback/_line_issue_groups), shared by every page that lists
 * failing write-back lines. Global (loaded by the :app glob), so every class
 * carries the wb- prefix and no rule leads with a page class. Tokens only;
 * the ink tones are writeback.css's --wb-*-ink.
 */

/* Non-dismissible banners: a tinted block with a tone rule along the top. */
.wb-banner {
  padding: 14px 24px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  border-top: 1px solid var(--border);
}

.wb-banner--error {
  background: var(--red-tint);
  border-top-color: var(--red);
}

.wb-banner--warn {
  background: var(--amber-tint);
  border-top-color: var(--amber);
}

.wb-banner--error .wb-issue-groups__heading {
  color: var(--wb-red-ink);
}

.wb-banner--warn .wb-issue-groups__heading {
  color: var(--wb-amber-ink);
}

/* The panel's buttons sit under the blocks. */
.wb-approval-check__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px 14px;
  border-bottom: 1px solid var(--border);
}

.wb-approval-check__form {
  display: inline;
}

/* ---- Grouped issue lines ---- */
.wb-issue-groups__heading {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

h3.wb-issue-groups__heading {
  font-size: 14px;
}

.wb-issue-groups__heading:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wb-issue-groups__notice {
  margin: 0 0 6px;
  font-weight: 600;
}

.wb-issue-groups__sentence {
  margin: 0 0 10px;
  color: var(--muted);
}

.wb-issue-group {
  margin: 6px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.wb-issue-group__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.wb-issue-group__count {
  min-width: 28px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.wb-issue-group__fix {
  color: var(--muted);
}

.wb-issue-table {
  width: 100%;
  border-collapse: collapse;
}

.wb-issue-row td {
  padding: 5px 12px;
  border-top: 1px solid var(--border-light);
  vertical-align: top;
}

.wb-issue-row__sku {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.wb-issue-row__qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wb-issue-row__text {
  color: var(--muted);
  width: 100%;
}

.wb-issue-row__fix {
  white-space: nowrap;
}

.wb-issue-fix {
  color: var(--accent);
  font-weight: 600;
}

.wb-issue-group__more,
.wb-issue-collapsed {
  margin: 0;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 12px;
}

.wb-issue-groups__csv {
  margin-top: 8px;
}

/* ---- The PO page's state notice and the destination's banner ---- */
.wb-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 24px;
  font-size: 13px;
  line-height: 1.5;
  border-top: 1px solid var(--border);
}

.wb-notice--neutral {
  background: var(--border-light);
  color: var(--ink);
}

.wb-notice--amber {
  background: var(--amber-tint);
  color: var(--wb-amber-ink);
  border-top-color: var(--amber);
}

.wb-notice__text {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}

.wb-notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wb-notice__form {
  display: inline;
}

/* The group tables scroll sideways inside their block on a narrow screen. */
.wb-issue-group {
  overflow-x: auto;
}

@media (max-width: 768px) {
  .wb-notice__actions {
    width: 100%;
    flex-direction: column;
  }

  .wb-notice__actions .btn,
  .wb-notice__form {
    width: 100%;
  }
}

/* ---- The PO page's "{name} delivery" tab ---- */
.wb-delivery__summary {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink);
}

.wb-delivery__loading,
.wb-delivery__empty {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0;
}

.wb-attempt {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

/* The header line sits outside the details, so its controls (the copy
   button, the sent-rows CSV) never toggle it. */
.wb-attempt__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 4px;
  font-size: 13px;
}

.wb-attempt__toggle {
  cursor: pointer;
  padding: 0 14px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.wb-attempt__number {
  font-weight: 700;
}

.wb-attempt__counts {
  color: var(--muted);
  font-size: 12px;
}

.wb-attempt__csv {
  margin-left: auto;
}

.wb-attempt__body {
  padding: 4px 14px 14px;
}

/* The line table scrolls sideways inside its block on a narrow screen. */
.wb-delivery-lines__scroll {
  overflow-x: auto;
  margin-top: 10px;
}

.wb-delivery-lines__raw {
  display: block;
  color: var(--muted);
  font-size: 11px;
  word-break: break-word;
}

.wb-line-removed {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
}

.wb-delivery__log {
  margin-top: 12px;
}

.wb-delivery__log > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ---- The PO index ---- */
/* POs the Status filter hides that are in the destination, announced once. */
.wb-hidden-rows {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}
