.delivery-inbox {
  margin-top: 24px;
  padding: 22px;
  border-top: 4px solid #b78b39;
  background: #f8fafb;
}

.delivery-heading h4 {
  margin: 0;
  color: #123f68;
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.delivery-heading > strong {
  padding: 7px 12px;
  border-radius: 18px;
  background: #fff1d6;
  color: #845f1b;
}

.delivery-list {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.delivery-card {
  padding: 17px;
  border: 1px solid #d9e2e8;
  border-left: 4px solid #bd8c32;
  background: white;
}

.delivery-card.approved {
  border-left-color: #27815f;
}

.delivery-card.changes_requested {
  border-left-color: #a94848;
}

.delivery-card header {
  justify-content: flex-start;
}

.delivery-card header img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  object-fit: cover;
}

.delivery-card header div {
  display: grid;
  flex: 1;
}

.delivery-card header small,
.delivery-card header span,
.delivery-card footer {
  color: #768895;
  font-size: 0.73rem;
}

.delivery-card header > b {
  color: #94691d;
  font-size: 0.76rem;
}

.delivery-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 13px 0;
}

.delivery-metrics span {
  display: grid;
  min-width: 125px;
  padding: 9px 12px;
  background: #f1f5f7;
}

.delivery-metrics small {
  color: #6c7f8e;
}

.delivery-actions {
  justify-content: flex-start;
  align-items: flex-start;
  border-top: 1px solid #e3e9ed;
  padding-top: 13px;
}

.delivery-actions details {
  flex: 1;
}

.delivery-actions summary {
  color: #174872;
  cursor: pointer;
  font-weight: 700;
}

.delivery-actions form {
  display: grid;
  gap: 8px;
  margin-top: 9px;
}

.delivery-actions textarea {
  min-height: 65px;
  resize: vertical;
}

.review-note,
.empty-deliveries {
  padding: 12px;
  background: #f3f6f8;
  color: #4e6577;
}

.empty-deliveries {
  display: grid;
  text-align: center;
}

@media (max-width: 850px) {
  .delivery-actions {
    flex-direction: column;
  }
}

.delivery-analysis {
  margin: 0.6rem 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--accent, #1f6f5f);
  background: rgba(31, 111, 95, 0.06);
  display: grid;
  gap: 0.45rem;
}
.delivery-analysis .analysis-diagnosis {
  margin: 0;
  font-weight: 500;
}
.delivery-analysis p {
  margin: 0;
}
.delivery-analysis ol,
.delivery-analysis ul {
  margin: 0.2rem 0 0;
  padding-left: 1.2rem;
}
.delivery-analysis li {
  margin: 0.2rem 0;
}
.delivery-analysis li span {
  display: inline-block;
  margin-right: 0.7rem;
}
.delivery-analysis li span small {
  opacity: 0.7;
  margin-right: 0.25rem;
}
.delivery-analysis details summary {
  cursor: pointer;
  font-weight: 500;
}
.delivery-analysis pre {
  white-space: pre-wrap;
  font: inherit;
  margin: 0.3rem 0 0;
}

/* ==========================================================================
   AGENT SYSTEM ALERT BANNER & SPLIT-SCREEN DIFF MODAL (MRD CONTROLADORIA)
   ========================================================================== */

.agent-system-alert-banner {
  background: #7f1d1d;
  color: #fef2f2;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: 500;
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

.agent-system-alert-banner.warning {
  background: #92400e;
  color: #fffbeb;
}

.alert-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-banner-icon {
  font-size: 1.25rem;
  animation: pulseAlert 1.5s infinite;
}

.alert-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-banner-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.alert-banner-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Modal Backdrop & Container */
.diff-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.diff-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.diff-modal {
  background: #ffffff;
  width: 90%;
  max-width: 1100px;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.2),
    0 10px 10px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.diff-modal-header {
  padding: 20px 24px;
  background: #1e293b;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
}

.diff-modal-header h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  color: #f8fafc;
}

.diff-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Split-Screen Diff Grid */
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.diff-column {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.diff-column-header {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-column-agent .diff-column-header {
  background: #eff6ff;
  color: #1e40af;
  border-bottom: 2px solid #3b82f6;
}

.diff-column-system .diff-column-header {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 2px solid #64748b;
}

.diff-field-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: white;
  border: 1px solid #cbd5e1;
}

.diff-field-item.changed {
  background: #fefce8;
  border-color: #fde047;
}

.diff-field-item.new {
  background: #f0fdf4;
  border-color: #86efac;
}

.diff-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.diff-field-value {
  font-size: 0.95rem;
  color: #0f172a;
  font-weight: 500;
}

.diff-field-item.changed .diff-field-value {
  color: #854d0e;
  font-weight: 700;
}

/* Evidence Box */
.diff-evidence-box {
  background: #0f172a;
  color: #38bdf8;
  padding: 14px 18px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  max-height: 150px;
  overflow-y: auto;
  border-left: 4px solid #0284c7;
}

/* Footer & Keyboard Shortcuts */
.diff-modal-footer {
  padding: 16px 24px;
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kbd-shortcut-hints {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: #64748b;
}

.kbd-badge {
  background: #e2e8f0;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes pulseAlert {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.diff-modal-backdrop.active {
  opacity: 1 !important;
  pointer-events: auto !important;
  display: flex !important;
  z-index: 99999 !important;
}
