:root {
  --ink: #141414;
  --ink-soft: #2E2E2E;
  --paper: #F6F4F4;
  --paper-2: #EDEAEA;
  --ring: #D7263D;
  --ring-dark: #B01E32;
  --ring-soft: #FDECEE;
  --charcoal: #141414;
  --charcoal-2: #1F1F1F;
  --muted: #5A5A5A;
  --line: rgba(20, 20, 20, 0.12);
  --ok: #E7F3EC;
  --err: #FDECEE;
  --warn: #FFF4D6;
  --forest: #1F7A4D;
  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Outfit", "Segoe UI", sans-serif;
  --font-loud: "Anton", Impact, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}
a { color: var(--ring-dark); }
.top {
  background: var(--ring);
  color: #fff;
  padding: 0.85rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-loud);
  letter-spacing: 0.04em;
}
.brand img { width: 32px; height: 32px; }
.top nav { display: flex; gap: 0.4rem 0.9rem; flex-wrap: wrap; align-items: center; }
.top nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.25rem 0.2rem;
}
.top nav a.active, .top nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 0.25rem; }
.badge {
  background: #fff;
  color: var(--ring);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.2rem;
}
.switcher, .session-tools { display: flex; gap: 0.5rem; align-items: center; }
select, input, textarea {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  width: 100%;
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-weight: 650; margin: 0.8rem 0 0.3rem; font-size: 0.92rem; }
.wrap { width: min(1100px, calc(100% - 2rem)); margin: 1.4rem auto 3rem; }
h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.6rem;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.sub { color: var(--muted); margin: 0 0 1.2rem; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: #fff;
  font-weight: 550;
  font-size: 0.9rem;
}
.chip.on { background: var(--ring); color: #fff; border-color: var(--ring); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--charcoal);
}
.btn-primary { background: var(--ring); box-shadow: 0 8px 18px rgba(215, 38, 61, 0.28); }
.btn-primary:hover { background: var(--ring-dark); }
.btn-big { padding: 1rem 1.4rem; font-size: 1.05rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: #8E1528; }
.btn-ok { background: var(--forest); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.flash {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
}
.flash.ok { background: var(--ok); }
.flash.error { background: var(--err); }
.mode {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-weight: 650;
}
.leads { display: grid; gap: 0.7rem; }
.lead-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1rem;
  text-decoration: none;
  color: inherit;
}
.lead-card:hover { border-color: var(--ring); }
.lead-card h3 { font-size: 1.15rem; margin: 0 0 0.2rem; }
.meta { color: var(--muted); font-size: 0.9rem; }
.pills { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; align-items: start; }
.pill {
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--paper-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill.needs_review { background: #FFE0B3; }
.pill.approved { background: #CFE8D8; }
.pill.dismissed { background: #E8E4E0; color: var(--muted); }
.pill.contacted { background: #D9E4F7; }
.pill.new { background: var(--ring-soft); color: var(--ring-dark); }
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1.1rem; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.15rem 1.25rem;
}
.thread { display: flex; flex-direction: column; gap: 0.6rem; }
.bubble {
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  max-width: 100%;
  white-space: pre-wrap;
}
.bubble.inbound { background: var(--paper-2); }
.bubble.outbound { background: var(--charcoal); color: #f4f4f4; }
.bubble.owner_notify { background: var(--warn); }
.bubble .who { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.25rem; opacity: 0.75; }
body.login-page {
  background: var(--ring);
  min-height: 100vh;
}
.login-card {
  width: min(420px, calc(100% - 2rem));
  margin: 4rem auto;
  background: #fff;
  border-radius: 20px;
  padding: 1.8rem 1.6rem;
  border: 1px solid transparent;
  box-shadow: 0 24px 50px rgba(20, 20, 20, 0.2);
}
.login-card .brand { color: var(--ink); margin-bottom: 0.8rem; }
.sim-hero {
  background: var(--ring);
  color: #fff;
  border-radius: 20px;
  padding: 1.3rem 1.3rem 1.4rem;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.sim-hero p { margin: 0.3rem 0 0; color: rgba(255, 255, 255, 0.85); }
.sim-hero .btn-primary {
  background: #fff;
  color: var(--ring);
  box-shadow: none;
}
.sim-hero .btn-primary:hover { background: #fff4f5; }
.scope-box {
  background: var(--paper-2);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
}
.scope-box ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.tiny { font-size: 0.8rem; color: var(--muted); }
.top .tiny { color: rgba(255, 255, 255, 0.85); }
form.inline { display: inline; }
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .lead-card { grid-template-columns: 1fr; }
  .pills { justify-content: flex-start; }
}
