:root {
  --bg: #efe7d7;
  --bg-strong: #e4d3b6;
  --surface: rgba(255, 251, 244, 0.76);
  --surface-strong: rgba(255, 249, 241, 0.94);
  --ink: #1b1712;
  --muted: #655d53;
  --line: rgba(38, 28, 15, 0.12);
  --accent: #9d5527;
  --accent-strong: #7a3417;
  --success: #29593f;
  --danger: #7f2d22;
  --shadow: 0 28px 60px rgba(72, 50, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(208, 145, 88, 0.28), transparent 24%),
    radial-gradient(circle at bottom right, rgba(133, 85, 47, 0.12), transparent 30%),
    linear-gradient(180deg, #f7f2ea 0%, #ebe0cd 100%);
}

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

button {
  cursor: pointer;
}

.shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 18px 42px;
}

.masthead {
  display: grid;
  grid-template-columns: 1.5fr 0.85fr;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(125deg, rgba(255, 251, 245, 0.96), rgba(240, 223, 196, 0.72));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.masthead h1,
.surface h2,
.panel h2 {
  margin: 0;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.masthead h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.95;
}

.subcopy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.auth-block {
  align-self: end;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 238, 0.84);
}

.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  margin-top: 22px;
}

.rail {
  display: grid;
  gap: 18px;
  align-self: start;
  position: sticky;
  top: 18px;
}

.panel,
.surface {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 18px;
}

.surface {
  padding: 22px;
}

.workspace {
  display: grid;
  gap: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.stack {
  display: grid;
  gap: 10px;
}

.button {
  border: 1px solid var(--line);
  background: rgba(255, 248, 240, 0.84);
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 999px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: rgba(255, 246, 235, 0.96);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff7ef;
  border-color: transparent;
}

.button-ghost {
  background: transparent;
}

.wide {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.console {
  margin: 14px 0 0;
  min-height: 140px;
  max-height: 240px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(31, 20, 10, 0.2);
  background: #1d1610;
  color: #f5e6d2;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d4a45b;
  box-shadow: 0 0 0 6px rgba(212, 164, 91, 0.12);
}

.provider-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.provider-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 245, 0.9);
  color: var(--muted);
  font-size: 0.84rem;
}

.provider-pill.ready,
.badge.good {
  color: var(--success);
  background: rgba(41, 89, 63, 0.1);
}

.provider-pill.missing,
.badge.bad {
  color: var(--danger);
  background: rgba(127, 45, 34, 0.1);
}

.provider-pill.notice {
  color: var(--accent-strong);
  background: rgba(157, 85, 39, 0.12);
}

.provider-pill.idle {
  color: var(--muted);
  background: rgba(101, 93, 83, 0.08);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stats article {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(140deg, rgba(255, 250, 242, 0.96), rgba(241, 227, 205, 0.76));
  box-shadow: var(--shadow);
}

.kicker {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.stats strong {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

.campaign-list {
  display: grid;
  gap: 12px;
}

.campaign-item {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.campaign-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 20px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

tbody tr {
  transition: background 160ms ease;
}

tbody tr:hover {
  background: rgba(157, 85, 39, 0.06);
}

tbody tr.is-selected {
  background: rgba(157, 85, 39, 0.12);
}

.lead-name {
  font-weight: 700;
}

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

.meta-cell {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.meta-label {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.detail {
  min-height: 720px;
}

.detail-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-block h3 {
  margin: 0 0 10px;
}

.message-stream {
  display: grid;
  gap: 10px;
}

.message {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 251, 244, 0.88);
}

.message-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.message pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 0.86rem;
  line-height: 1.5;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.reveal {
  animation: rise 520ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .layout,
  .grid,
  .masthead {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
  }

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

@media (max-width: 720px) {
  .stats,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 16px 12px 28px;
  }

  .surface,
  .panel,
  .masthead {
    padding: 18px;
    border-radius: 20px;
  }
}
