:root {
  --ink: #0f1c26;
  --night: #202b36;
  --teal: #1f5b5e;
  --teal-soft: #6c9d9d;
  --orange: #e8945a;
  --sand: #e5dfd6;
  --cream: #faf5e9;
  --mist: #f2f4f5;
  --white: #ffffff;
  --line: #ded8cc;
  --muted: #667078;
  --green: #17745d;
  --red: #a93c3c;
  --amber: #925f17;
  --shadow: 0 18px 40px rgba(15, 28, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: var(--night);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  font-weight: 800;
}

.brand-sub {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.78rem;
  width: 24px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(31, 91, 94, 0.45);
  border-left-color: var(--orange);
  color: var(--white);
}

.sidebar-footer {
  margin-top: auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--orange);
}

.main {
  min-width: 0;
  padding: 26px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.92rem;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.search input {
  width: min(320px, 34vw);
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--white);
  color: var(--ink);
}

.ghost-button,
.primary-button,
.soft-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.ghost-button {
  background: var(--white);
  border-color: var(--line);
  color: var(--teal);
}

.primary-button {
  background: var(--teal);
  color: var(--white);
}

.soft-button {
  background: #f7eee2;
  border-color: #ead4bb;
  color: var(--amber);
}

.danger-button {
  background: #fff4f1;
  border-color: #e7b9ad;
  color: var(--red);
}

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

.metric {
  min-height: 88px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

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

.metric strong {
  font-size: 2rem;
  line-height: 1;
  color: var(--night);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.queue-panel,
.detail-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.queue-panel {
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 46px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: #fbfaf6;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.82rem;
}

.tab.active {
  border-bottom-color: var(--orange);
  color: var(--ink);
  background: var(--white);
}

.list-head {
  display: grid;
  grid-template-columns: 1fr 120px;
  min-height: 34px;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
}

.lead-list {
  max-height: calc(100vh - 252px);
  overflow: auto;
}

.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  width: 100%;
  min-height: 92px;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid #ede7dc;
  background: var(--white);
  color: var(--ink);
  text-align: left;
}

.lead-row:hover,
.lead-row.active {
  background: #fbf4ea;
}

.lead-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.lead-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill.high {
  background: #ffe5d7;
  color: #9d431f;
}

.pill.medium {
  background: #e6f0ee;
  color: var(--teal);
}

.pill.low {
  background: var(--mist);
  color: var(--muted);
}

.lead-meta,
.lead-note {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-action {
  align-self: center;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-panel {
  min-height: calc(100vh - 184px);
  padding: 20px;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--night);
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.muted {
  color: var(--muted);
}

.score {
  width: 92px;
  min-height: 76px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--night);
  color: var(--white);
  text-align: center;
}

.score span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.68);
}

.score strong {
  font-size: 1.75rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.info-section,
.copy-section {
  border: 1px solid #e8e0d3;
  border-radius: 8px;
  padding: 14px;
  background: #fffdfa;
}

dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
}

dt {
  color: var(--muted);
  font-size: 0.8rem;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-section {
  margin-top: 12px;
}

.copy-section.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.subject {
  margin-bottom: 0;
  font-weight: 800;
  color: var(--teal);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  color: var(--ink);
  line-height: 1.52;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  border-radius: 8px;
  padding: 13px 16px;
  background: var(--night);
  color: var(--white);
  box-shadow: var(--shadow);
  font-weight: 700;
}

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

  .brand-name,
  .brand-sub,
  .nav-item:not(.active),
  .sidebar-footer span:not(.status-dot) {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item span {
    display: none;
  }

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

  .lead-list {
    max-height: none;
  }
}

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

  .sidebar {
    position: static;
    padding: 14px;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: auto;
  }

  .nav-item {
    min-width: 90px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px;
  }

  .nav-item.active {
    border-bottom-color: var(--orange);
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .top-actions {
    display: grid;
    width: 100%;
  }

  .search input {
    width: 100%;
  }

  .metrics,
  .info-grid,
  .copy-section.two-column {
    grid-template-columns: 1fr;
  }

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

  .detail-header {
    display: grid;
  }
}
