:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #18202b;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #047857;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #9aa7b8;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.topbar p,
.muted,
label {
  color: var(--muted);
}

.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 12px;
  white-space: nowrap;
}

.status.warning {
  border-color: #f59e0b;
  color: var(--warn);
}

.status.error {
  border-color: #fca5a5;
  color: var(--danger);
}

.topActions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tokenInput {
  min-height: 36px;
  width: 160px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(260px, 360px) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  padding: 16px;
}

.panelHeader {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.intake {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-width: 0;
  padding: 10px 11px;
  width: 100%;
}

textarea {
  resize: vertical;
}

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

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.toggles label {
  align-items: center;
  display: flex;
  gap: 8px;
}

.toggles input {
  width: auto;
}

.leadList {
  display: grid;
  gap: 8px;
}

.leadItem {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  display: grid;
  gap: 6px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.leadItem.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.leadMeta,
.row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.pill.hot,
.pill.sent,
.pill.approved {
  color: var(--ok);
}

.pill.needs_review,
.pill.warning {
  color: var(--warn);
}

.pill.cold,
.pill.error {
  color: var(--danger);
}

.detail {
  display: grid;
  gap: 14px;
}

.emptyState {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}

.scoreLine {
  align-items: center;
  display: flex;
  gap: 12px;
}

.score {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  font-size: 28px;
  font-weight: 800;
  height: 70px;
  justify-content: center;
  width: 86px;
}

.section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 14px;
}

.messageBox {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  white-space: pre-wrap;
}

.eventList {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.eventList li {
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

@media (max-width: 1100px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .detail {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .topbar,
  .metrics,
  .workspace,
  .gridTwo {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topActions {
    justify-content: start;
  }
}
