:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #667085;
  --paper: #f7f7f4;
  --panel: #ffffff;
  --line: #d9ded8;
  --green: #1f7a4d;
  --red: #a33b3b;
  --gold: #a46b18;
  --blue: #286ca6;
  --violet: #7154a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 42vw);
  min-height: 100vh;
}

.queue-panel {
  padding: 28px;
  border-right: 1px solid var(--line);
}

.detail-panel {
  padding: 28px;
  background: #eef3ef;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 92px);
  gap: 8px;
}

.summary-grid div {
  min-height: 68px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-grid span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.summary-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-button {
  min-height: 36px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

.filter-button.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.signal-list {
  display: grid;
  gap: 10px;
}

.signal-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 72px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 92px;
  padding: 14px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.signal-item.is-active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(24, 32, 42, 0.08);
}

.badge,
.tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.tier {
  width: max-content;
  margin-bottom: 14px;
}

.badge.ACT_NOW,
.tier.ACT_NOW {
  background: var(--red);
}

.badge.STOPLINE,
.tier.STOPLINE {
  background: var(--violet);
}

.badge.WAITING,
.tier.WAITING {
  background: var(--blue);
}

.badge.WATCH,
.tier.WATCH {
  background: var(--gold);
}

.badge.HANDLED,
.tier.HANDLED {
  background: var(--green);
}

.signal-copy h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.25;
}

.signal-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.score {
  text-align: right;
  font-weight: 800;
}

.detail-header {
  margin-bottom: 18px;
}

.slack-card {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.action-text {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.detail-grid div {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.audit-log {
  min-height: 92px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  background: #111820;
  color: #edf4f0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .queue-panel,
  .detail-panel {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .signal-item {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .score {
    grid-column: 2;
    text-align: left;
  }
}
