:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --panel: #171a21;
  --border: #262b36;
  --text: #e7e9ee;
  --muted: #8b91a0;
  --accent: #4f8cff;
  --approved: #35c17c;
  /* Declines are a normal business outcome (like a bank declining a card) —
     deliberately NOT red, so they don't read as an infrastructure problem. */
  --rejected: #7c8db5;
  --pending: #d9a441;
  /* Reserved for genuine pipeline failures only. */
  --failed: #e8555f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 { font-size: 20px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; }

button#trigger-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
button#trigger-btn:hover { opacity: 0.9; }
button#trigger-btn:active { transform: translateY(1px); }

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-tile-alert {
  border-color: rgba(232, 85, 95, 0.35);
}

.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-label .hint { text-transform: none; letter-spacing: normal; }
.stat-declined { color: var(--rejected); }
.stat-failed { color: var(--failed); }

.panels {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.panel h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

#feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed-item .row1 { display: flex; justify-content: space-between; gap: 8px; }
.feed-item .amount { font-weight: 600; }
.feed-item .meta { color: var(--muted); font-size: 12px; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-pending { background: rgba(217, 164, 65, 0.15); color: var(--pending); }
.status-approved { background: rgba(53, 193, 124, 0.15); color: var(--approved); }
.status-rejected { background: rgba(124, 141, 181, 0.18); color: var(--rejected); }
.status-failed { background: rgba(232, 85, 95, 0.15); color: var(--failed); }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .panels { grid-template-columns: 1fr; }
}
