.kiz-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.kiz-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgb(215 25 32 / 0.11), transparent 34%),
    #fff;
  padding: 18px;
}

.kiz-hero__icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--red);
  color: #fff;
}

.kiz-hero h2,
.kiz-queue h3,
.kiz-dialog h3 {
  margin: 0;
}

.kiz-hero p:not(.eyebrow),
.kiz-queue header span {
  margin: 5px 0 0;
  color: var(--muted);
}

.kiz-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.kiz-summary__card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 11px;
  background: #fff;
  padding: 14px 16px;
}

.kiz-summary__card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kiz-summary__card strong {
  font-size: 25px;
}

.kiz-summary__card--danger {
  border-left-color: #d71920;
}

.kiz-summary__card--warning {
  border-left-color: #d97706;
}

.kiz-summary__card--success {
  border-left-color: #16803b;
}

.kiz-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kiz-tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.kiz-tabs button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  padding: 8px 12px;
}

.kiz-tabs button.active {
  background: #1f2937;
  color: #fff;
}

.kiz-search {
  display: grid;
  grid-template-columns: auto minmax(240px, 440px) auto;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 560px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 5px 6px 5px 11px;
}

.kiz-search svg {
  color: var(--muted);
}

.kiz-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 7px 0;
}

.kiz-search button,
.kiz-fix-button,
.kiz-write-off-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-weight: 850;
  padding: 8px 11px;
}

.kiz-discrepancy-table {
  min-width: 1040px;
}

.kiz-excess-count {
  color: #b42318;
  font-size: 17px;
}

.kiz-write-off-button {
  white-space: nowrap;
}

.kiz-write-off-button:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}

.kiz-discrepancies__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kiz-write-off-all-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-weight: 850;
  padding: 9px 13px;
  white-space: nowrap;
}

.kiz-write-off-all-button:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}

.kiz-queue {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.kiz-queue > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 15px 17px;
}

.kiz-queue > header strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 999px;
  background: #f3f4f6;
}

.kiz-table-wrap {
  overflow: auto;
}

.kiz-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.kiz-table th,
.kiz-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 13px;
  text-align: left;
  vertical-align: top;
}

.kiz-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kiz-table td {
  font-size: 13px;
}

.kiz-row--unread td {
  background: #fff8f8;
}

.kiz-row--unread td:first-child {
  box-shadow: inset 4px 0 0 #dc2626;
}

.kiz-unread-label {
  display: inline-flex;
  margin-left: 8px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.kiz-table td > .kiz-stock-conflict {
  color: #9a3412;
  font-weight: 800;
}

.kiz-table td > strong,
.kiz-table td > small,
.kiz-table td > code {
  display: block;
}

.kiz-table td > small {
  margin-top: 4px;
  color: var(--muted);
}

.kiz-table td > code {
  max-width: 230px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.kiz-severity,
.kiz-resolved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}

.kiz-severity--critical {
  color: #b42318;
}

.kiz-severity--warning {
  color: #a15c00;
}

.kiz-error-detail,
.kiz-duplicate {
  color: #b42318 !important;
}

.kiz-resolution,
.kiz-resolved {
  color: #16803b !important;
}

.kiz-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  padding: 54px 20px;
  text-align: center;
}

.kiz-empty svg {
  color: #16803b;
}

.kiz-dialog-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgb(15 23 42 / 0.55);
  padding: 22px;
}

.kiz-dialog {
  display: grid;
  gap: 15px;
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 24px 80px rgb(15 23 42 / 0.28);
  padding: 20px;
}

.kiz-dialog > header,
.kiz-dialog > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kiz-dialog > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.kiz-dialog__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.kiz-dialog__facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
  padding: 9px 10px;
}

.kiz-dialog__facts span,
.kiz-dialog__field > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.kiz-dialog__facts strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
}

.kiz-dialog__explanation,
.kiz-dialog__notice {
  margin: 0;
  border-radius: 9px;
  background: #fff7ed;
  color: #8a4b00;
  padding: 11px 12px;
}

.kiz-dialog__diagnostic {
  display: grid;
  gap: 9px;
  border: 1px solid #fdba74;
  border-radius: 10px;
  background: #fff7ed;
  padding: 12px;
}

.kiz-dialog__diagnostic > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kiz-dialog__diagnostic > div > div {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.kiz-dialog__diagnostic span,
.kiz-dialog__diagnostic strong {
  display: block;
}

.kiz-dialog__diagnostic span {
  color: var(--muted);
  font-size: 11px;
}

.kiz-dialog__diagnostic ul {
  margin: 0;
  padding-left: 20px;
  color: #7c2d12;
  font-size: 12px;
}

.kiz-dialog__check--warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.kiz-dialog__notice {
  background: #f8fafc;
  color: var(--muted);
}

.kiz-dialog__field {
  display: grid;
  gap: 6px;
}

.kiz-dialog__field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
}

.kiz-dialog__field small {
  color: var(--muted);
}

.kiz-dialog__check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
}

.kiz-dialog__check input {
  margin-top: 3px;
}

@media (max-width: 900px) {
  .kiz-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kiz-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .kiz-search {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .kiz-panel {
    padding: 12px;
  }

  .kiz-hero {
    grid-template-columns: auto 1fr;
  }

  .kiz-hero > button {
    grid-column: 1 / -1;
  }

  .kiz-summary,
  .kiz-dialog__facts {
    grid-template-columns: 1fr;
  }

  .kiz-search {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .kiz-search button {
    grid-column: 1 / -1;
  }

  .kiz-dialog > footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

/* FIX: keep decisions beside the scan evidence and history in the viewport. */
.kiz-review-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-width:560px;margin-top:12px}
.kiz-review-actions button,.kiz-history-dialog button {min-height:44px;padding:8px 12px;border:1px solid var(--line,#cad8d8);border-radius:9px;color:inherit;background:var(--surface,#fff);font:inherit;font-weight:600}
.kiz-review-actions button:disabled {opacity:.55}
.kiz-review-actions button:last-child {background:var(--accent-soft,#eaf1f3)}
.kiz-scan-timeline p {border-left:3px solid #bdb0d5;padding:8px 12px;margin:6px 0}
.kiz-history-dialog {position:fixed;inset:0;margin:auto;max-height:85vh;overflow:auto;width:min(800px,94vw);border:1px solid var(--line,#cedcdd);border-radius:14px;padding:22px;color:inherit;background:var(--surface,#fff)}
.kiz-history-dialog::backdrop {background:#20334466}
.kiz-history-dialog header {display:flex;justify-content:space-between;align-items:center}

/* FIX: receipt review follows the approved 920px card, including themed screens. */
.kiz-panel:has(.kiz-review-case) {box-sizing:border-box;width:min(100%,960px);margin-inline:auto}
.kiz-panel .kiz-queue:has(>.kiz-receipt-card) {display:grid;gap:12px;padding:0;border:0}
.kiz-panel .kiz-queue nav button,.kiz-panel .kiz-queue>.secondary-button,.kiz-panel .kiz-queue>button {border:1px solid #d2dfe0;border-radius:9px;padding:9px 13px;background:#fff;color:#253948;font-weight:600;box-shadow:none;width:fit-content}
.kiz-panel .kiz-queue nav button[aria-pressed=true] {background:#f2edf8;color:#51436e}
.kiz-panel details.kiz-receipt-card {width:100%;max-width:920px;box-sizing:border-box;padding:clamp(14px,3vw,24px);border:1px solid #d5e1e1;border-radius:16px;background:#fff;color:#253948}
.kiz-receipt-card>summary,.kiz-scan-band>div,.kiz-receipt-foot {display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.kiz-receipt-card>summary {cursor:pointer;list-style:none}
.kiz-receipt-card .kiz-receipt-status {border-radius:18px;background:#fff1cf;color:#76510c;padding:5px 12px;font-weight:600}
.kiz-receipt-card .kiz-scan-timeline {margin-top:14px}
.kiz-scan-timeline>strong {font-size:1.35em}
.kiz-scan-timeline p.kiz-scan-note {border:0;padding:0;margin:8px 0 16px;color:#536875}
.kiz-scan-band {background:#f8f7fa;color:#253948;border-left:3px solid #bdb0d5;padding:8px 14px;margin:6px 0;border-radius:0 8px 8px 0}
.kiz-receipt-card small {color:#536875;overflow-wrap:anywhere}
.kiz-receipt-foot {margin:12px 0 14px;padding-bottom:15px;border-bottom:1px solid #dbe4e4}
.kiz-panel .kiz-receipt-foot button,.kiz-panel .kiz-receipt-card .kiz-review-actions button {border:1px solid #d2dfe0;border-radius:9px;box-shadow:none;padding:9px 13px;font-weight:600}
.kiz-panel .kiz-receipt-foot button {background:#f2edf8;color:#51436e}
.kiz-receipt-card .kiz-review-actions {margin:9px 0;max-width:560px}
.kiz-panel .kiz-receipt-card .kiz-review-actions button:nth-child(3) {background:#fff6f6;color:#883e43}
.kiz-panel .kiz-receipt-card .kiz-review-actions button:last-child {background:#eaf1f3;color:#253948}

/* FIX: keep one centered reading column and the same inset for heading, evidence and decisions. */
:root .kiz-panel:has(.kiz-receipt-card) {
  display:grid;grid-template-columns:minmax(0,1fr);box-sizing:border-box;
  width:100%;max-width:none;margin:0;justify-items:center;padding:clamp(12px,2vw,24px)
}
:root .kiz-panel:has(.kiz-receipt-card)>:is(h2,section,p,form) {box-sizing:border-box;width:min(100%,920px);min-width:0;margin-inline:auto}
:root .kiz-panel .kiz-queue:has(>.kiz-receipt-card) {background:transparent;border:none;padding:0;gap:10px}
:root .kiz-panel .kiz-queue:has(>.kiz-receipt-card)>:is(p,h3,nav) {margin:0}
:root .kiz-panel .kiz-queue:has(>.kiz-receipt-card)>section.kiz-queue {padding:16px;background:white;border-radius:14px}
:root .kiz-panel .kiz-queue details.kiz-receipt-card {
  padding:clamp(14px,2vw,24px);display:block;box-sizing:border-box;margin:0
}
:root .kiz-panel details.kiz-receipt-card>summary {padding:0;margin:0}
:root .kiz-panel details.kiz-receipt-card>.kiz-scan-timeline {padding:0;margin-inline:0}

/* FIX: the WB trigger scopes the two assembly controls to this window. */
:is(.online-execution-modal__actions,.fbo-inline-execution__actions):has(.wb-supply-trigger)>button.icon-button,
dialog.wb-supply-dialog .wb-window-close {
  box-sizing:border-box; display:inline-grid; place-items:center; flex:0 0 40px;
  width:40px; min-width:40px; max-width:40px; height:40px; min-height:40px; max-height:40px;
  padding:0; margin:0; border:1px solid #cbd8da; border-radius:10px;
  background:#f7f9f9; color:#253948; font:normal 23px/1 "Segoe UI",sans-serif; box-shadow:none;
}
dialog.wb-supply-dialog {
  box-sizing:border-box; position:fixed; inset:0; margin:auto; width:min(580px,94vw);
  max-height:86vh; overflow:auto; padding:clamp(16px,3vw,24px); color:#253948;
  background:white; border:1px solid #ccdcdc; border-radius:16px; box-shadow:0 16px 60px #24344333;
}
dialog.wb-supply-dialog::backdrop {background:#20334459}
.wb-supply-dialog header,.wb-supply-dialog footer {display:flex;align-items:center;justify-content:space-between;gap:8px}
.wb-supply-dialog header small {font-size:12px;font-weight:700;letter-spacing:.08em;color:#665679}
.wb-supply-dialog header h2 {font-size:20px;margin:0}
.wb-supply-dialog .wb-supply-content {padding:0;border:0;margin:12px 0 0}
.wb-supply-dialog .wb-supply-form {border-top:1px solid #dbe4e4;padding-top:4px;margin-top:18px}
.wb-supply-dialog label {display:grid;gap:5px;margin:14px 0;font-weight:600}
.wb-supply-dialog :is(select,input,button) {box-sizing:border-box;font:inherit;color:inherit;background:white;border:1px solid #cfdbdd;border-radius:9px;padding:9px 13px}
.wb-supply-dialog :is(select,input) {width:100%;min-width:0}
.wb-supply-dialog footer {margin-top:20px;justify-content:flex-end;flex-wrap:wrap}
.wb-supply-dialog button {cursor:pointer;font-weight:600}
.wb-supply-dialog .wb-bind,.wb-supply-trigger {background:#f2edf8;color:#51436e;border-color:#d5c9e4}
.wb-supply-dialog button:disabled {opacity:.55;cursor:default}

/* FIX: wrap the request title and reserve a single row for the controls. */
:is(.online-execution-modal__header,.fbo-inline-execution__header):has(.wb-supply-trigger) {flex-wrap:wrap}
:is(.online-execution-modal__header,.fbo-inline-execution__header):has(.wb-supply-trigger)>h2 {flex:1 1 12ch;min-width:0;white-space:normal;overflow-wrap:anywhere}
:is(.online-execution-modal__actions,.fbo-inline-execution__actions):has(.wb-supply-trigger) {display:flex;flex:0 0 auto;align-items:center;flex-flow:row nowrap;gap:8px;margin-inline-start:auto;width:max-content}
.wb-supply-trigger {white-space:nowrap}
:root :is(.online-execution-modal__actions,.fbo-inline-execution__actions):has(.wb-supply-trigger)>button.icon-button,
:root dialog.wb-supply-dialog button.wb-window-close {
  box-sizing:border-box;width:40px;height:40px;min-width:40px;min-height:40px;max-width:40px;max-height:40px;
  flex:0 0 40px;border:1px solid #cbd8da;border-radius:10px;background:#f7f9f9;color:#253948;
  padding:0;margin:0;font-size:0;line-height:0;display:inline-grid;place-items:center;
  --wb-window-glyph:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m3 3 14 14M17 3 3 17' fill='none' stroke='black' stroke-linecap='round' stroke-width='2'/%3E%3C/svg%3E");
}
:root :is(.online-execution-modal__actions,.fbo-inline-execution__actions):has(.wb-supply-trigger)>button.panthera-window-minimize {
  --wb-window-glyph:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M3 10h14' fill='none' stroke='black' stroke-linecap='round' stroke-width='2'/%3E%3C/svg%3E");
}
:root :is(.online-execution-modal__actions,.fbo-inline-execution__actions):has(.wb-supply-trigger)>button.icon-button::before,
:root dialog.wb-supply-dialog button.wb-window-close::before {
  content:"";grid-area:1/1;display:block;width:20px;height:20px;background:currentColor;mask:var(--wb-window-glyph) center/contain no-repeat
}
