/*
 * Document write-back, every surface (super-admin destination pages now; the
 * PO chip, delivery panel and status page later). Global: loaded by the :app
 * glob, so every class carries the wb- prefix. A wb- rule never leads with a
 * page class such as .po-v2: these render on pages outside PO management.
 */

/* Chip text tones dark enough on their tints (the PO badges' text colours). */
:root {
  --wb-green-ink: #166534;
  --wb-amber-ink: #92400e;
  --wb-red-ink: #991b1b;
  --wb-blue-ink: #1e40af;
}

/* State / status chips: the shared .badge pill plus one tone. Always a word,
   never colour alone (WritebackHelper#writeback_chip). */
.wb-chip--neutral {
  background: var(--border-light);
  color: var(--ink);
}

.wb-chip--blue {
  background: var(--blue-tint);
  color: var(--wb-blue-ink);
}

.wb-chip--amber {
  background: var(--amber-tint);
  color: var(--wb-amber-ink);
}

.wb-chip--green {
  background: var(--green-tint);
  color: var(--wb-green-ink);
}

.wb-chip--red {
  background: var(--red-tint);
  color: var(--wb-red-ink);
}

/* A page-level problem that must be seen before anything else. */
.wb-banner--red {
  background: var(--red-tint);
  color: var(--wb-red-ink);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-weight: 600;
}

.wb-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}

.wb-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

/* A details table: a fixed label column beside the values. */
.wb-details th {
  width: 200px;
  text-align: left;
}

.wb-state-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wb-activation-blockers {
  color: var(--wb-amber-ink);
  font-size: 12px;
  font-weight: 600;
}

.wb-open-count,
.wb-num {
  text-align: right;
}

/* A numeric column's header aligns with its cells (the shared .data-table
   rule right-aligns td.num only). */
.data-table thead th.wb-num,
.wb-health-table thead th.num,
.wb-open-submissions thead th.num {
  text-align: right;
}

.wb-error-text {
  color: var(--red);
  font-size: 11px;
  margin: 3px 0 0;
}

.wb-required {
  color: var(--wb-amber-ink);
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wb-config-map {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Test destination: a checklist, one row per step. */
.wb-test-summary {
  font-weight: 700;
  margin: 0 0 8px;
}

.wb-test-detail {
  white-space: pre-wrap;
  word-break: break-word;
}

/* The tenant status page: one card per destination. */
.wb-banner--amber {
  background: var(--amber-tint);
  color: var(--wb-amber-ink);
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-weight: 600;
}

.wb-health-card {
  margin-bottom: 20px;
}

.wb-health-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.wb-health-head h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.wb-health-times {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* The destination page's tabs are links on the shared tab bar
   (.po-tab-nav / .po-tab-btn): no link underline, room under the bar. */
.wb-tab-nav {
  margin-bottom: 16px;
}

.wb-tab-nav .po-tab-btn:hover {
  text-decoration: none;
}

/* Four tiles fill the strip (dash-kpi-strip is five columns). */
.wb-health-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.wb-health-none,
.wb-health-empty,
.wb-health-capped {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}

.wb-health-table {
  margin-bottom: 18px;
}

.wb-health-sample {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-word;
}

@media (max-width: 768px) {
  .wb-health-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Destination page, Needs action: each row opens to its send log and the
   recovery actions its state allows. */
.wb-recovery-row > td {
  padding-top: 0;
}

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

.wb-recovery {
  padding: 10px 0 4px;
}

.wb-recovery-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin: 12px 0 8px;
}

.wb-recovery-action {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
  max-width: 640px;
}

.wb-recovery-action-title {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
}

.wb-attempt-log {
  margin-bottom: 10px;
}

/* The delivery chip (writeback/_chip): the badge, then once accepted the
   destination's number in a monospace pill with its copy button. Wraps under
   the PO number on a narrow screen. */
.wb-chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.wb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* PO index, only where the write-back column shows: the Status pill and the
   chip keep to one line; the column sizes to its content. */
.wb-index-nowrap {
  white-space: nowrap;
}

.wb-chip-number {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.wb-mono-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.wb-chip-more {
  font-weight: 600;
}

.wb-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 11px;
}

.wb-copy:hover {
  color: var(--ink);
}

/* The write-back lock, one line under the PO header's title row. */
.wb-lock-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
