:root {
  --ink: #16181d;
  --muted: #667085;
  --line: #d8dde6;
  --panel: #f6f7f9;
  --paper: #ffffff;
  --gold: #b8872a;
  --gold-soft: #fff2cc;
  --green: #1f7a4d;
  --green-soft: #dff7e8;
  --red: #a33b3b;
  --red-soft: #fde5e5;
  --blue: #244e8f;
  --blue-soft: #e7eefb;
  --shadow: 0 12px 32px rgba(17, 24, 39, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e8ebef;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  border-color: var(--gold);
}

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

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

.queue-panel,
.action-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
  max-height: 100vh;
}

.action-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
}

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

.brand-row h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.brand-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.counter,
.status-pill {
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6b4a05;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.toolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  padding: 0 10px;
}

.tracking-block label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-weight: 700;
}

.tracking-block input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

.tracking-block textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  padding: 10px;
  resize: vertical;
  line-height: 1.35;
}

.import-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  margin-bottom: 14px;
}

.import-box input {
  display: none;
}

.import-box button {
  width: 100%;
}

.import-box p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.lead-list {
  display: grid;
  gap: 8px;
}

.lead-item {
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 7px;
  text-align: left;
  padding: 10px;
}

.lead-item.active {
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold);
}

.lead-item .top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lead-item strong {
  font-size: 14px;
}

.lead-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.25;
}

.mini-status {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
  background: var(--blue-soft);
  color: var(--blue);
}

.mini-status.APPROVED {
  background: var(--green-soft);
  color: var(--green);
}

.mini-status.SCHEDULED,
.status-pill.SCHEDULED {
  background: var(--green-soft);
  color: var(--green);
}

.mini-status.REJECTED {
  background: var(--red-soft);
  color: var(--red);
}

.mini-status.SENT {
  background: var(--blue-soft);
  color: var(--blue);
}

.mini-status.DRAFTED,
.status-pill.DRAFTED {
  background: var(--gold-soft);
  color: #6b4a05;
}

.review-panel {
  padding: 24px;
  overflow: auto;
  max-height: 100vh;
}

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

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

.review-header h2 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.meta-strip {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.meta-strip div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-width: 0;
}

.meta-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 800;
}

.meta-strip strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.email-paper {
  min-height: 760px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px 42px;
  line-height: 1.55;
  font-size: 16px;
  outline: none;
}

.email-paper:focus {
  border-color: var(--gold);
}

.email-paper p {
  margin: 0 0 18px;
}

.email-paper .pain {
  font-style: italic;
}

.email-paper a {
  color: #0d4f9e;
  font-weight: 800;
}

.action-block,
.notes-block,
.help-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  margin-bottom: 12px;
}

.action-block {
  display: grid;
  gap: 8px;
}

.google-block input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.action-block h3,
.notes-block h3,
.help-block h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
  margin-top: 10px;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.help-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .action-panel {
    grid-column: 1 / -1;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .action-block,
  .notes-block,
  .help-block {
    margin-bottom: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .queue-panel,
  .review-panel,
  .action-panel {
    max-height: none;
  }

  .meta-strip,
  .action-panel {
    grid-template-columns: 1fr;
  }

  .email-paper {
    padding: 24px;
    min-height: 520px;
  }
}
